diff --git a/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java
index e97f11988..da5bcc5d8 100644
--- a/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java
@@ -37,6 +37,7 @@ import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
+import java.awt.SystemColor;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.AffineTransform;
@@ -202,6 +203,7 @@ public class FolderPreviewPanel extends JPanel {
int finish_y = (int) Math.ceil((r.y + r.height) / (float) CELL_HEIGHT);
Color color;
Color selectedColor;
+ Color selectedTextColor;
Color borderColor;
Color textColor;
if (Configuration.useRibbonInterface.get()) {
@@ -209,12 +211,14 @@ public class FolderPreviewPanel extends JPanel {
color = skin.getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getBackgroundFillColor();
selectedColor = skin.getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).getBackgroundFillColor();
borderColor = skin.getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.BORDER, ComponentState.ROLLOVER_SELECTED).getUltraDarkColor();
- textColor = skin.getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).getForegroundColor();
+ textColor = skin.getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getForegroundColor();
+ selectedTextColor = skin.getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).getForegroundColor();
} else {
- color = new Color(0xd9, 0xe8, 0xfb);
- selectedColor = new Color(0xfe, 0xca, 0x81);
- borderColor = Color.BLACK;
- textColor = Color.BLACK;
+ color = SystemColor.control;
+ selectedColor = SystemColor.textHighlight;
+ borderColor = SystemColor.controlShadow;
+ textColor = SystemColor.controlText;
+ selectedTextColor = SystemColor.textHighlightText;
}
//g.setColor(SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED));
@@ -253,6 +257,9 @@ public class FolderPreviewPanel extends JPanel {
g.drawLine(x * CELL_WIDTH, y * CELL_HEIGHT + BORDER_SIZE + PREVIEW_SIZE, x * CELL_WIDTH + CELL_WIDTH, y * CELL_HEIGHT + BORDER_SIZE + PREVIEW_SIZE);
g.drawRect(x * CELL_WIDTH, y * CELL_HEIGHT, CELL_WIDTH, CELL_HEIGHT);
g.setColor(textColor);
+ if (selectedItems.containsKey(index)) {
+ g.setColor(selectedTextColor);
+ }
g.drawString(s, x * CELL_WIDTH + BORDER_SIZE, y * CELL_HEIGHT + BORDER_SIZE + PREVIEW_SIZE + LABEL_HEIGHT);
}
diff --git a/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java b/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java
index c98c4936d..3116ce77c 100644
--- a/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java
+++ b/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java
@@ -1,106 +1,107 @@
-/*
- * 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 .
- */
-package com.jpexs.decompiler.flash.gui;
-
-import com.jpexs.decompiler.flash.configuration.Configuration;
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.geom.GeneralPath;
-import java.util.EnumSet;
-import java.util.Set;
-import javax.swing.JLabel;
-import org.pushingpixels.substance.api.ColorSchemeAssociationKind;
-import org.pushingpixels.substance.api.ComponentState;
-import org.pushingpixels.substance.api.DecorationAreaType;
-import org.pushingpixels.substance.api.SubstanceConstants;
-import org.pushingpixels.substance.api.SubstanceLookAndFeel;
-import org.pushingpixels.substance.api.SubstanceSkin;
-import org.pushingpixels.substance.api.painter.border.StandardBorderPainter;
-import org.pushingpixels.substance.internal.utils.SubstanceOutlineUtilities;
-
-/**
- *
- * @author JPEXS
- */
-public class HeaderLabel extends JLabel {
-
- public HeaderLabel(String text) {
- super(text);
- //setBorder(BorderFactory.createRaisedBevelBorder());
-
-
- /*setBorder(new Border() {
-
- @Override
- public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
- g.setColor(Color.gray);
- g.drawLine(0, 0,width-1, 0);
- g.drawLine(0, 0, 0, height-1);
- g.setColor(Color.darkGray);
- g.drawLine(width-1, 0, width-1, height-1);
- g.drawLine(0, height-1, width-1, height-1);
- }
-
- @Override
- public Insets getBorderInsets(Component c) {
- return new Insets(2, 2, 2, 2);
- }
-
- @Override
- public boolean isBorderOpaque() {
- return false;
- }
- });*/
- }
-
- @Override
- public void paint(Graphics g) {
- if (Configuration.useRibbonInterface.get()) {
- SubstanceSkin skin = SubstanceLookAndFeel.getCurrentSkin();
- g.setColor(skin.getColorScheme(DecorationAreaType.HEADER, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getBackgroundFillColor());
- } else {
- g.setColor(new Color(217, 232, 251));
- }
- g.fillRect(0, 0, getWidth(), getHeight());
- if (Configuration.useRibbonInterface.get()) {
- StandardBorderPainter borderPainter = new StandardBorderPainter();
-
- Set straightSides = EnumSet.of(SubstanceConstants.Side.BOTTOM);
- int dy = 0;
- float cornerRadius = 5f;
- int borderThickness = 1;
- int borderInsets = 0;
- GeneralPath contourInner = borderPainter.isPaintingInnerContour() ? SubstanceOutlineUtilities.getBaseOutline(getWidth(), getHeight() + dy,
- cornerRadius - borderThickness, straightSides, borderThickness + borderInsets)
- : null;
-
- GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(getWidth(),
- getHeight() + dy, cornerRadius, straightSides, borderInsets);
-
- SubstanceSkin skin = SubstanceLookAndFeel.getCurrentSkin();
- borderPainter.paintBorder(g, this, getWidth(), getHeight() + dy,
- contour, contourInner, skin.getColorScheme(DecorationAreaType.HEADER, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED));
- g.setColor(skin.getColorScheme(DecorationAreaType.HEADER, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getForegroundColor());
- } else {
- g.setColor(Color.BLACK);
- }
-
- JLabel lab = new JLabel(getText(), JLabel.CENTER);
- lab.setSize(getSize());
- lab.paint(g);
- }
-}
+/*
+ * 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 .
+ */
+package com.jpexs.decompiler.flash.gui;
+
+import com.jpexs.decompiler.flash.configuration.Configuration;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.SystemColor;
+import java.awt.geom.GeneralPath;
+import java.util.EnumSet;
+import java.util.Set;
+import javax.swing.JLabel;
+import org.pushingpixels.substance.api.ColorSchemeAssociationKind;
+import org.pushingpixels.substance.api.ComponentState;
+import org.pushingpixels.substance.api.DecorationAreaType;
+import org.pushingpixels.substance.api.SubstanceConstants;
+import org.pushingpixels.substance.api.SubstanceLookAndFeel;
+import org.pushingpixels.substance.api.SubstanceSkin;
+import org.pushingpixels.substance.api.painter.border.StandardBorderPainter;
+import org.pushingpixels.substance.internal.utils.SubstanceOutlineUtilities;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class HeaderLabel extends JLabel {
+
+ public HeaderLabel(String text) {
+ super(text);
+ //setBorder(BorderFactory.createRaisedBevelBorder());
+
+
+ /*setBorder(new Border() {
+
+ @Override
+ public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
+ g.setColor(Color.gray);
+ g.drawLine(0, 0,width-1, 0);
+ g.drawLine(0, 0, 0, height-1);
+ g.setColor(Color.darkGray);
+ g.drawLine(width-1, 0, width-1, height-1);
+ g.drawLine(0, height-1, width-1, height-1);
+ }
+
+ @Override
+ public Insets getBorderInsets(Component c) {
+ return new Insets(2, 2, 2, 2);
+ }
+
+ @Override
+ public boolean isBorderOpaque() {
+ return false;
+ }
+ });*/
+ }
+
+ @Override
+ public void paint(Graphics g) {
+ if (Configuration.useRibbonInterface.get()) {
+ SubstanceSkin skin = SubstanceLookAndFeel.getCurrentSkin();
+ g.setColor(skin.getColorScheme(DecorationAreaType.HEADER, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getBackgroundFillColor());
+ } else {
+ g.setColor(SystemColor.control);
+ }
+ g.fillRect(0, 0, getWidth(), getHeight());
+ if (Configuration.useRibbonInterface.get()) {
+ StandardBorderPainter borderPainter = new StandardBorderPainter();
+
+ Set straightSides = EnumSet.of(SubstanceConstants.Side.BOTTOM);
+ int dy = 0;
+ float cornerRadius = 5f;
+ int borderThickness = 1;
+ int borderInsets = 0;
+ GeneralPath contourInner = borderPainter.isPaintingInnerContour() ? SubstanceOutlineUtilities.getBaseOutline(getWidth(), getHeight() + dy,
+ cornerRadius - borderThickness, straightSides, borderThickness + borderInsets)
+ : null;
+
+ GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(getWidth(),
+ getHeight() + dy, cornerRadius, straightSides, borderInsets);
+
+ SubstanceSkin skin = SubstanceLookAndFeel.getCurrentSkin();
+ borderPainter.paintBorder(g, this, getWidth(), getHeight() + dy,
+ contour, contourInner, skin.getColorScheme(DecorationAreaType.HEADER, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED));
+ g.setColor(skin.getColorScheme(DecorationAreaType.HEADER, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getForegroundColor());
+ } else {
+ g.setColor(SystemColor.controlText);
+ }
+
+ JLabel lab = new JLabel(getText(), JLabel.CENTER);
+ lab.setSize(getSize());
+ lab.paint(g);
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java
index 100e93e9b..3122e78d5 100644
--- a/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java
+++ b/src/com/jpexs/decompiler/flash/gui/MainFrameClassicMenu.java
@@ -1,264 +1,571 @@
-/*
- * 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 .
- */
-package com.jpexs.decompiler.flash.gui;
-
-import com.jpexs.decompiler.flash.SWF;
-import com.jpexs.decompiler.flash.configuration.Configuration;
-import com.jpexs.decompiler.flash.console.ContextMenuTools;
-import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import com.sun.jna.Platform;
-import java.awt.event.ActionEvent;
-import java.util.List;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-
-/**
- *
- * @author JPEXS
- */
-public class MainFrameClassicMenu extends MainFrameMenu {
-
- private final MainFrameClassic mainFrame;
-
- private JCheckBoxMenuItem miAutoDeobfuscation;
-
- private JCheckBoxMenuItem miInternalViewer;
-
- private JCheckBoxMenuItem miParallelSpeedUp;
-
- private JCheckBoxMenuItem miAssociate;
-
- private JCheckBoxMenuItem miDecompile;
-
- private JCheckBoxMenuItem miCacheDisk;
-
- private JCheckBoxMenuItem miGotoMainClassOnStartup;
-
- private JCheckBoxMenuItem miAutoRenameIdentifiers;
-
- public MainFrameClassicMenu(MainFrameClassic mainFrame, boolean externalFlashPlayerUnavailable) {
- super(mainFrame);
- this.mainFrame = mainFrame;
-
- createMenuBar(externalFlashPlayerUnavailable);
- }
-
- @Override
- public boolean isInternalFlashViewerSelected() {
- return miInternalViewer.isSelected();
- }
-
- private String fixCommandTitle(String title) {
- if (title.length() > 2) {
- if (title.charAt(1) == ' ') {
- title = title.charAt(0) + "\u00A0" + title.substring(2);
- }
- }
- return title;
- }
-
- private void createMenuBar(boolean externalFlashPlayerUnavailable) {
- JMenuBar menuBar = new JMenuBar();
-
- JMenu menuFile = new JMenu(translate("menu.file"));
- JMenuItem miOpen = new JMenuItem(translate("menu.file.open"));
- miOpen.setIcon(View.getIcon("open16"));
- miOpen.addActionListener(this::open);
- JMenuItem miSave = new JMenuItem(translate("menu.file.save"));
- miSave.setIcon(View.getIcon("save16"));
- miSave.addActionListener(this::save);
- JMenuItem miSaveAs = new JMenuItem(translate("menu.file.saveas"));
- miSaveAs.setIcon(View.getIcon("saveas16"));
- miSaveAs.addActionListener(this::saveAs);
- JMenuItem miSaveAsExe = new JMenuItem(translate("menu.file.saveasexe"));
- miSaveAsExe.setIcon(View.getIcon("saveas16"));
- miSaveAsExe.addActionListener(this::saveAsExe);
-
- JMenuItem menuExportFla = new JMenuItem(translate("menu.file.export.fla"));
- menuExportFla.addActionListener(this::exportFla);
- menuExportFla.setIcon(View.getIcon("flash16"));
-
- JMenuItem menuExportAll = new JMenuItem(translate("menu.file.export.all"));
- menuExportAll.addActionListener(this::exportAll);
- JMenuItem menuExportSel = new JMenuItem(translate("menu.file.export.selection"));
- menuExportSel.addActionListener(this::exportSelected);
- menuExportAll.setIcon(View.getIcon("export16"));
- menuExportSel.setIcon(View.getIcon("exportsel16"));
-
- menuFile.add(miOpen);
- menuFile.add(miSave);
- menuFile.add(miSaveAs);
- menuFile.add(miSaveAsExe);
- menuFile.add(menuExportFla);
- menuFile.add(menuExportAll);
- menuFile.add(menuExportSel);
- menuFile.addSeparator();
- JMenuItem miClose = new JMenuItem(translate("menu.file.exit"));
- miClose.setIcon(View.getIcon("exit16"));
- miClose.addActionListener(this::exit);
- menuFile.add(miClose);
- menuBar.add(menuFile);
- JMenu menuDeobfuscation = new JMenu(translate("menu.tools.deobfuscation"));
- menuDeobfuscation.setIcon(View.getIcon("deobfuscate16"));
-
- JMenuItem miDeobfuscation = new JMenuItem(translate("menu.tools.deobfuscation.pcode"));
- miDeobfuscation.addActionListener(this::deobfuscate);
-
- miAutoDeobfuscation = new JCheckBoxMenuItem(translate("menu.settings.autodeobfuscation"));
- miAutoDeobfuscation.setSelected(Configuration.autoDeobfuscate.get());
- miAutoDeobfuscation.addActionListener(this::autoDeobfuscate);
-
- JMenuItem miRenameOneIdentifier = new JMenuItem(translate("menu.tools.deobfuscation.globalrename"));
- miRenameOneIdentifier.addActionListener(this::renameOneIdentifier);
-
- JMenuItem miRenameIdentifiers = new JMenuItem(translate("menu.tools.deobfuscation.renameinvalid"));
- miRenameIdentifiers.addActionListener(this::renameIdentifiers);
-
- menuDeobfuscation.add(miRenameOneIdentifier);
- menuDeobfuscation.add(miRenameIdentifiers);
- menuDeobfuscation.add(miDeobfuscation);
- JMenu menuTools = new JMenu(translate("menu.tools"));
- JMenuItem miProxy = new JMenuItem(translate("menu.tools.proxy"));
- miProxy.setIcon(View.getIcon("proxy16"));
- miProxy.addActionListener(this::showProxy);
-
- JMenuItem miSearchScript = new JMenuItem(translate("menu.tools.searchas"));
- miSearchScript.addActionListener((ActionEvent e) -> {
- search(e, null);
- });
- miSearchScript.setIcon(View.getIcon("search16"));
-
- menuTools.add(miSearchScript);
-
- miInternalViewer = new JCheckBoxMenuItem(translate("menu.settings.internalflashviewer"));
- miInternalViewer.setSelected(Configuration.internalFlashViewer.get() || externalFlashPlayerUnavailable);
- if (externalFlashPlayerUnavailable) {
- miInternalViewer.setEnabled(false);
- }
- miInternalViewer.addActionListener(this::internalViewerSwitch);
-
- miParallelSpeedUp = new JCheckBoxMenuItem(translate("menu.settings.parallelspeedup"));
- miParallelSpeedUp.setSelected(Configuration.parallelSpeedUp.get());
- miParallelSpeedUp.addActionListener(this::parallelSpeedUp);
-
- menuTools.add(miProxy);
-
- menuTools.add(menuDeobfuscation);
-
- JMenuItem miGotoDocumentClass = new JMenuItem(translate("menu.tools.gotodocumentclass"));
- miGotoDocumentClass.addActionListener(this::gotoDucumentClass);
- menuBar.add(menuTools);
-
- miDecompile = new JCheckBoxMenuItem(translate("menu.settings.disabledecompilation"));
- miDecompile.setSelected(!Configuration.decompile.get());
- miDecompile.addActionListener(this::disableDecompilation);
-
- miCacheDisk = new JCheckBoxMenuItem(translate("menu.settings.cacheOnDisk"));
- miCacheDisk.setSelected(Configuration.cacheOnDisk.get());
- miCacheDisk.addActionListener(this::cacheOnDisk);
-
- miGotoMainClassOnStartup = new JCheckBoxMenuItem(translate("menu.settings.gotoMainClassOnStartup"));
- miGotoMainClassOnStartup.setSelected(Configuration.gotoMainClassOnStartup.get());
- miGotoMainClassOnStartup.addActionListener(this::gotoDucumentClassOnStartup);
-
- miAutoRenameIdentifiers = new JCheckBoxMenuItem(translate("menu.settings.autoRenameIdentifiers"));
- miAutoRenameIdentifiers.setSelected(Configuration.autoRenameIdentifiers.get());
- miAutoRenameIdentifiers.addActionListener(this::autoRenameIdentifiers);
-
- JMenu menuSettings = new JMenu(translate("menu.settings"));
- menuSettings.add(miAutoDeobfuscation);
- menuSettings.add(miInternalViewer);
- menuSettings.add(miParallelSpeedUp);
- menuSettings.add(miDecompile);
- menuSettings.add(miCacheDisk);
- menuSettings.add(miGotoMainClassOnStartup);
- menuSettings.add(miAutoRenameIdentifiers);
-
- miAssociate = new JCheckBoxMenuItem(translate("menu.settings.addtocontextmenu"));
- miAssociate.addActionListener(this::associate);
- miAssociate.setSelected(ContextMenuTools.isAddedToContextMenu());
-
- JMenuItem miLanguage = new JMenuItem(translate("menu.settings.language"));
- miLanguage.addActionListener(this::setLanguage);
-
- if (Platform.isWindows()) {
- menuSettings.add(miAssociate);
- }
- menuSettings.add(miLanguage);
-
- JMenuItem advancedSettingsCommandButton = new JMenuItem(translate("menu.advancedsettings.advancedsettings"));
- advancedSettingsCommandButton.setIcon(View.getIcon("settings16"));
- advancedSettingsCommandButton.addActionListener(this::advancedSettings);
- menuSettings.add(advancedSettingsCommandButton);
-
- menuBar.add(menuSettings);
- JMenu menuHelp = new JMenu(translate("menu.help"));
- JMenuItem miAbout = new JMenuItem(translate("menu.help.about"));
- miAbout.setIcon(View.getIcon("about16"));
- miAbout.addActionListener(this::about);
-
- JMenuItem miCheckUpdates = new JMenuItem(translate("menu.help.checkupdates"));
- miCheckUpdates.setIcon(View.getIcon("update16"));
- miCheckUpdates.addActionListener(this::checkUpdates);
-
- JMenuItem miHelpUs = new JMenuItem(translate("menu.help.helpus"));
- miHelpUs.setIcon(View.getIcon("donate16"));
- miHelpUs.addActionListener(this::helpUs);
-
- JMenuItem miHomepage = new JMenuItem(translate("menu.help.homepage"));
- miHomepage.setIcon(View.getIcon("homepage16"));
- miHomepage.addActionListener(this::homePage);
-
- menuHelp.add(miCheckUpdates);
- menuHelp.add(miHelpUs);
- menuHelp.add(miHomepage);
- menuHelp.add(miAbout);
- menuBar.add(menuHelp);
-
- mainFrame.setJMenuBar(menuBar);
-
- //if (hasAbc) {
- menuTools.add(miGotoDocumentClass);
- //}
- }
-
- @Override
- public void updateComponents(SWF swf) {
- super.updateComponents(swf);
- boolean swfLoaded = swf != null;
- List abcList = swfLoaded ? swf.getAbcList() : null;
- boolean hasAbc = swfLoaded && abcList != null && !abcList.isEmpty();
-
- /*saveCommandButton.setEnabled(swfLoaded);
- saveasCommandButton.setEnabled(swfLoaded);
- saveasexeCommandButton.setEnabled(swfLoaded);
- exportAllCommandButton.setEnabled(swfLoaded);
- exportFlaCommandButton.setEnabled(swfLoaded);
- exportSelectionCommandButton.setEnabled(swfLoaded);
- reloadCommandButton.setEnabled(swfLoaded);
-
- renameInvalidCommandButton.setEnabled(swfLoaded);
- globalRenameCommandButton.setEnabled(swfLoaded);
- deobfuscationCommandButton.setEnabled(swfLoaded);
- searchCommandButton.setEnabled(swfLoaded);
-
- gotoDocumentClassCommandButton.setEnabled(hasAbc);
- deobfuscationCommandButton.setEnabled(hasAbc);*/
- }
-}
+/*
+ * 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 .
+ */
+package com.jpexs.decompiler.flash.gui;
+
+import com.jpexs.decompiler.flash.SWF;
+import com.jpexs.decompiler.flash.configuration.Configuration;
+import com.jpexs.decompiler.flash.console.ContextMenuTools;
+import com.jpexs.decompiler.flash.gui.debugger.DebuggerTools;
+import com.jpexs.decompiler.flash.tags.ABCContainerTag;
+import com.sun.jna.Platform;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class MainFrameClassicMenu extends MainFrameMenu {
+
+ private final MainFrameClassic mainFrame;
+
+ private JCheckBoxMenuItem miAutoDeobfuscation;
+
+ private JCheckBoxMenuItem miInternalViewer;
+
+ private JCheckBoxMenuItem miParallelSpeedUp;
+
+ private JCheckBoxMenuItem miAssociate;
+
+ private JCheckBoxMenuItem miDecompile;
+
+ private JCheckBoxMenuItem miCacheDisk;
+
+ private JCheckBoxMenuItem miGotoMainClassOnStartup;
+
+ private JCheckBoxMenuItem miAutoRenameIdentifiers;
+ private ButtonGroup viewGroup;
+
+ private JRadioButtonMenuItem miViewResources;
+ private JRadioButtonMenuItem miViewHex;
+
+ private JCheckBoxMenuItem miDebuggerSwitch;
+ private JMenuItem miDebuggerReplaceTrace;
+
+ private JCheckBoxMenuItem miViewTimeline;
+
+ private ButtonGroup grpDeobfuscation;
+ private JRadioButtonMenuItem miDeobfuscationModeOld;
+ private JRadioButtonMenuItem miDeobfuscationModeNew;
+ private JMenu menuRecent;
+
+ private JMenuItem miReload;
+ private JMenuItem miExportAll;
+ private JMenuItem miExportXml;
+ private JMenuItem miExportSel;
+ private JMenuItem miExportFla;
+ private JMenuItem miSave;
+ private JMenuItem miSaveAs;
+ private JMenuItem miSaveAsExe;
+ private JMenuItem miClose;
+ private JMenuItem miCloseAll;
+
+ private JMenu menuExport;
+ private JMenuItem miImportText;
+ private JMenuItem miImportScript;
+ private JMenuItem miImportSymbolClass;
+ private JMenuItem miImportXml;
+ private JMenu menuImport;
+ private JMenuItem miRenameIdentifiers;
+ private JMenuItem miRenameOneIdentifier;
+
+ private JMenuItem miReplace;
+ private JMenuItem miSearch;
+ private JMenuItem miDeobfuscation;
+ private JMenuItem miGotoDocumentClass;
+
+ public MainFrameClassicMenu(MainFrameClassic mainFrame, boolean externalFlashPlayerUnavailable) {
+ super(mainFrame);
+ this.mainFrame = mainFrame;
+
+ createMenuBar(externalFlashPlayerUnavailable);
+ }
+
+ @Override
+ public boolean isInternalFlashViewerSelected() {
+ return miInternalViewer.isSelected();
+ }
+
+ private String fixCommandTitle(String title) {
+ if (title.length() > 2) {
+ if (title.charAt(1) == ' ') {
+ title = title.charAt(0) + "\u00A0" + title.substring(2);
+ }
+ }
+ return title;
+ }
+
+ private void loadRecent() {
+ List recentFiles = Configuration.getRecentFiles();
+ menuRecent.removeAll();
+ for (int i = recentFiles.size() - 1; i >= 0; i--) {
+ JMenuItem miRecent = new JMenuItem(recentFiles.get(i));
+ final String f = recentFiles.get(i);
+ miRecent.addActionListener((ActionEvent e) -> {
+ if (Main.openFile(f, null) == OpenFileResult.NOT_FOUND) {
+ if (View.showConfirmDialog(null, translate("message.confirm.recentFileNotFound"), translate("message.confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) {
+ Configuration.removeRecentFile(f);
+ }
+ }
+ });
+ menuRecent.add(miRecent);
+ }
+ }
+
+ private void createMenuBar(boolean externalFlashPlayerUnavailable) {
+ JMenuBar menuBar = new JMenuBar();
+
+ JMenuItem miOpen = new JMenuItem(translate("menu.file.open"));
+ miOpen.setIcon(View.getIcon("open16"));
+ miOpen.addActionListener(this::open);
+
+ menuRecent = new JMenu(translate("menu.recentFiles"));
+
+ miSave = new JMenuItem(translate("menu.file.save"));
+ miSave.setIcon(View.getIcon("save16"));
+ miSave.addActionListener(this::save);
+ miSaveAs = new JMenuItem(translate("menu.file.saveas"));
+ miSaveAs.setIcon(View.getIcon("saveas16"));
+ miSaveAs.addActionListener(this::saveAs);
+ miSaveAsExe = new JMenuItem(translate("menu.file.saveasexe"));
+ miSaveAsExe.setIcon(View.getIcon("saveasexe16"));
+ miSaveAsExe.addActionListener(this::saveAsExe);
+
+ miReload = new JMenuItem(translate("menu.file.reload"));
+ miReload.setIcon(View.getIcon("reload16"));
+ miReload.addActionListener(this::reload);
+
+ miExportFla = new JMenuItem(translate("menu.file.export.fla"));
+ miExportFla.addActionListener(this::exportFla);
+ miExportFla.setIcon(View.getIcon("flash16"));
+
+ miExportAll = new JMenuItem(translate("menu.file.export.all"));
+ miExportAll.addActionListener(this::exportAll);
+ miExportAll.setIcon(View.getIcon("export16"));
+
+ miExportSel = new JMenuItem(translate("menu.file.export.selection"));
+ miExportSel.addActionListener(this::exportSelected);
+ miExportSel.setIcon(View.getIcon("exportsel16"));
+
+ miExportXml = new JMenuItem(translate("menu.file.export.xml"));
+ miExportXml.addActionListener(this::exportSwfXml);
+ miExportXml.setIcon(View.getIcon("exportxml32", 16));
+
+ menuExport = new JMenu(translate("menu.export"));
+ menuExport.add(miExportFla);
+ menuExport.add(miExportXml);
+ menuExport.addSeparator();
+ menuExport.add(miExportAll);
+ menuExport.add(miExportSel);
+
+ miImportText = new JMenuItem(translate("menu.file.import.text"));
+ miImportText.addActionListener(this::importText);
+ miImportText.setIcon(View.getIcon("importtext32", 16));
+
+ miImportScript = new JMenuItem(translate("menu.file.import.script"));
+ miImportScript.addActionListener(this::importScript);
+ miImportScript.setIcon(View.getIcon("importtext32", 16));
+
+ miImportSymbolClass = new JMenuItem(translate("menu.file.import.symbolClass"));
+ miImportSymbolClass.addActionListener(this::importSymbolClass);
+ miImportSymbolClass.setIcon(View.getIcon("importsymbolclass32", 16));
+
+ miImportXml = new JMenuItem(translate("menu.file.import.xml"));
+ miImportXml.addActionListener(this::importSwfXml);
+ miImportXml.setIcon(View.getIcon("importxml32", 16));
+ menuImport = new JMenu(translate("menu.import"));
+ menuImport.add(miImportXml);
+ menuImport.add(miImportText);
+ menuImport.add(miImportScript);
+ menuImport.add(miImportSymbolClass);
+
+ /*
+ JMenuItem menuX;
+ menuX = new JMenuItem(translate("menu.file.export.all"));
+ menuX.addActionListener(this::exportAll);
+ menuX.setIcon(View.getIcon("export16"));
+ menu.file.close
+ */
+ miClose = new JMenuItem(translate("menu.file.close"));
+ miClose.addActionListener(this::close);
+ miClose.setIcon(View.getIcon("close32", 16));
+
+ miCloseAll = new JMenuItem(translate("menu.file.closeAll"));
+ miCloseAll.addActionListener(this::closeAll);
+ miCloseAll.setIcon(View.getIcon("close32", 16));
+
+ JMenuItem miExit = new JMenuItem(translate("menu.file.exit"));
+ miExit.setIcon(View.getIcon("exit16"));
+ miExit.addActionListener(this::exit);
+
+ JMenu menuFile = new JMenu(translate("menu.file"));
+
+ menuFile.addMenuListener(new MenuListener() {
+
+ @Override
+ public void menuSelected(MenuEvent e) {
+ loadRecent();
+ }
+
+ @Override
+ public void menuDeselected(MenuEvent e) {
+
+ }
+
+ @Override
+ public void menuCanceled(MenuEvent e) {
+
+ }
+ });
+
+ menuFile.add(miOpen);
+ menuFile.add(menuRecent);
+ menuFile.add(miSave);
+ menuFile.add(miSaveAs);
+ menuFile.add(miSaveAsExe);
+ menuFile.add(miReload);
+ menuFile.addSeparator();
+
+ menuFile.add(menuExport);
+ menuFile.add(menuImport);
+ menuFile.addSeparator();
+
+ menuFile.add(miClose);
+ menuFile.add(miCloseAll);
+ menuFile.addSeparator();
+
+ menuFile.add(miExit);
+
+ menuBar.add(menuFile);
+
+ miViewResources = new JRadioButtonMenuItem(translate("menu.file.view.resources"));
+ miViewResources.addActionListener(this::viewModeResourcesButtonActionPerformed);
+ miViewResources.setIcon(View.getIcon("viewresources16"));
+
+ miViewHex = new JRadioButtonMenuItem(translate("menu.file.view.hex"));
+ miViewHex.addActionListener(this::viewModeHexDumpButtonActionPerformed);
+ miViewHex.setIcon(View.getIcon("viewhex16"));
+
+ viewGroup = new ButtonGroup();
+ viewGroup.add(miViewResources);
+ viewGroup.add(miViewHex);
+
+ if (Configuration.dumpView.get()) {
+ miViewHex.setSelected(true);
+ } else {
+ miViewResources.setSelected(true);
+ }
+
+ JMenu menuView = new JMenu(translate("menu.view"));
+ menuView.add(miViewResources);
+ menuView.add(miViewHex);
+
+ menuBar.add(menuView);
+ miDebuggerSwitch = new JCheckBoxMenuItem(translate("menu.debugger.switch"));
+ miDebuggerSwitch.addActionListener(this::debuggerSwitchButtonActionPerformed);
+ miDebuggerSwitch.setIcon(View.getIcon("debugger32", 16));
+
+ miDebuggerReplaceTrace = new JMenuItem(translate("menu.debugger.replacetrace"));
+ miDebuggerReplaceTrace.addActionListener(this::debuggerReplaceTraceCalls);
+ miDebuggerReplaceTrace.setIcon(View.getIcon("debuggerreplace16"));
+
+ JMenuItem miDebuggerShowLog = new JMenuItem(translate("menu.debugger.showlog"));
+ miDebuggerShowLog.addActionListener(this::debuggerShowLog);
+ miDebuggerShowLog.setIcon(View.getIcon("debuggerlog16"));
+
+ JMenu menuDebugger = new JMenu(translate("menu.debugger"));
+ menuDebugger.add(miDebuggerSwitch);
+ menuDebugger.add(miDebuggerReplaceTrace);
+ menuDebugger.add(miDebuggerShowLog);
+
+ JMenu menuDeobfuscation = new JMenu(translate("menu.tools.deobfuscation"));
+ menuDeobfuscation.setIcon(View.getIcon("deobfuscate16"));
+
+ miDeobfuscation = new JMenuItem(translate("menu.tools.deobfuscation.pcode"));
+ miDeobfuscation.addActionListener(this::deobfuscate);
+
+ miAutoDeobfuscation = new JCheckBoxMenuItem(translate("menu.settings.autodeobfuscation"));
+ miAutoDeobfuscation.setSelected(Configuration.autoDeobfuscate.get());
+ miAutoDeobfuscation.addActionListener(this::autoDeobfuscate);
+
+ miRenameOneIdentifier = new JMenuItem(translate("menu.tools.deobfuscation.globalrename"));
+ miRenameOneIdentifier.addActionListener(this::renameOneIdentifier);
+
+ miRenameIdentifiers = new JMenuItem(translate("menu.tools.deobfuscation.renameinvalid"));
+ miRenameIdentifiers.addActionListener(this::renameIdentifiers);
+
+ menuDeobfuscation.add(miRenameOneIdentifier);
+ menuDeobfuscation.add(miRenameIdentifiers);
+ menuDeobfuscation.add(miDeobfuscation);
+ JMenuItem miProxy = new JMenuItem(translate("menu.tools.proxy"));
+ miProxy.setIcon(View.getIcon("proxy16"));
+ miProxy.addActionListener(this::showProxy);
+
+ JMenuItem miSearchMemory = new JMenuItem(translate("menu.tools.searchmemory"));
+ miSearchMemory.addActionListener(this::loadFromMemory);
+ miSearchMemory.setIcon(View.getIcon("loadmemory16"));
+
+ JMenuItem miSearchCache = new JMenuItem(translate("menu.tools.searchcache"));
+ miSearchCache.addActionListener(this::loadFromCache);
+ miSearchCache.setIcon(View.getIcon("loadcache16"));
+
+ miSearch = new JMenuItem(translate("menu.tools.search"));
+ miSearch.addActionListener((ActionEvent e) -> {
+ search(e, null);
+ });
+ miSearch.setIcon(View.getIcon("search16"));
+
+ miReplace = new JMenuItem(translate("menu.tools.replace"));
+ miReplace.addActionListener(this::replace);
+ miReplace.setIcon(View.getIcon("replace32", 16));
+
+ miViewTimeline = new JCheckBoxMenuItem(translate("menu.tools.timeline"));
+ miViewTimeline.addActionListener(this::timelineButtonActionPerformed);
+ miViewTimeline.setIcon(View.getIcon("timeline32", 16));
+
+ miGotoDocumentClass = new JMenuItem(translate("menu.tools.gotodocumentclass"));
+ miGotoDocumentClass.addActionListener(this::gotoDucumentClass);
+
+ JMenu menuTools = new JMenu(translate("menu.tools"));
+ menuTools.add(miSearch);
+ menuTools.add(miReplace);
+ menuTools.addSeparator();
+ menuTools.add(miViewTimeline);
+ menuTools.add(miProxy);
+ menuTools.add(miSearchMemory);
+ menuTools.add(miSearchCache);
+ menuTools.addSeparator();
+ menuTools.add(menuDeobfuscation);
+ menuTools.add(menuDebugger);
+ menuTools.add(miGotoDocumentClass);
+ menuBar.add(menuTools);
+
+ //Settings
+ miInternalViewer = new JCheckBoxMenuItem(translate("menu.settings.internalflashviewer"));
+ miInternalViewer.setSelected(Configuration.internalFlashViewer.get() || externalFlashPlayerUnavailable);
+ if (externalFlashPlayerUnavailable) {
+ miInternalViewer.setEnabled(false);
+ }
+ miInternalViewer.addActionListener(this::internalViewerSwitch);
+
+ miParallelSpeedUp = new JCheckBoxMenuItem(translate("menu.settings.parallelspeedup"));
+ miParallelSpeedUp.setSelected(Configuration.parallelSpeedUp.get());
+ miParallelSpeedUp.addActionListener(this::parallelSpeedUp);
+
+ miDecompile = new JCheckBoxMenuItem(translate("menu.settings.disabledecompilation"));
+ miDecompile.setSelected(!Configuration.decompile.get());
+ miDecompile.addActionListener(this::disableDecompilation);
+
+ miCacheDisk = new JCheckBoxMenuItem(translate("menu.settings.cacheOnDisk"));
+ miCacheDisk.setSelected(Configuration.cacheOnDisk.get());
+ miCacheDisk.addActionListener(this::cacheOnDisk);
+
+ miGotoMainClassOnStartup = new JCheckBoxMenuItem(translate("menu.settings.gotoMainClassOnStartup"));
+ miGotoMainClassOnStartup.setSelected(Configuration.gotoMainClassOnStartup.get());
+ miGotoMainClassOnStartup.addActionListener(this::gotoDucumentClassOnStartup);
+
+ miAutoRenameIdentifiers = new JCheckBoxMenuItem(translate("menu.settings.autoRenameIdentifiers"));
+ miAutoRenameIdentifiers.setSelected(Configuration.autoRenameIdentifiers.get());
+ miAutoRenameIdentifiers.addActionListener(this::autoRenameIdentifiers);
+
+ JMenu menuSettings = new JMenu(translate("menu.settings"));
+ menuSettings.add(miAutoDeobfuscation);
+ menuSettings.add(miInternalViewer);
+ menuSettings.add(miParallelSpeedUp);
+ menuSettings.add(miDecompile);
+ menuSettings.add(miCacheDisk);
+ menuSettings.add(miGotoMainClassOnStartup);
+ menuSettings.add(miAutoRenameIdentifiers);
+
+ miAssociate = new JCheckBoxMenuItem(translate("menu.settings.addtocontextmenu"));
+ miAssociate.addActionListener(this::associate);
+ miAssociate.setSelected(ContextMenuTools.isAddedToContextMenu());
+
+ JMenuItem miLanguage = new JMenuItem(translate("menu.settings.language"));
+ miLanguage.addActionListener(this::setLanguage);
+ miLanguage.setIcon(View.getIcon("setlanguage32", 16));
+
+ if (Platform.isWindows()) {
+ menuSettings.add(miAssociate);
+ }
+ menuSettings.add(miLanguage);
+
+ miDeobfuscationModeOld = new JRadioButtonMenuItem(translate("menu.file.deobfuscation.old"));
+ miDeobfuscationModeOld.addActionListener((ActionEvent e) -> {
+ deobfuscationMode(e, 0);
+ });
+ miDeobfuscationModeOld.setIcon(View.getIcon("deobfuscateold16"));
+
+ miDeobfuscationModeNew = new JRadioButtonMenuItem(translate("menu.file.deobfuscation.new"));
+ miDeobfuscationModeNew.addActionListener((ActionEvent e) -> {
+ deobfuscationMode(e, 1);
+ });
+ miDeobfuscationModeNew.setIcon(View.getIcon("deobfuscatenew16"));
+
+ grpDeobfuscation = new ButtonGroup();
+ grpDeobfuscation.add(miDeobfuscationModeOld);
+ grpDeobfuscation.add(miDeobfuscationModeNew);
+
+ int deobfuscationMode = Configuration.deobfuscationMode.get();
+ switch (deobfuscationMode) {
+ case 0:
+ grpDeobfuscation.clearSelection();
+ miDeobfuscationModeOld.setSelected(true);
+ break;
+ case 1:
+ grpDeobfuscation.clearSelection();
+ miDeobfuscationModeNew.setSelected(true);
+ break;
+ }
+
+ JMenu deobfuscationMenu = new JMenu(translate("menu.deobfuscation"));
+ deobfuscationMenu.add(miDeobfuscationModeOld);
+ deobfuscationMenu.add(miDeobfuscationModeNew);
+ menuSettings.add(deobfuscationMenu);
+
+ JMenuItem advancedSettingsCommandButton = new JMenuItem(translate("menu.advancedsettings.advancedsettings"));
+ advancedSettingsCommandButton.setIcon(View.getIcon("settings16"));
+ advancedSettingsCommandButton.addActionListener(this::advancedSettings);
+ menuSettings.add(advancedSettingsCommandButton);
+
+ menuBar.add(menuSettings);
+ JMenu menuHelp = new JMenu(translate("menu.help"));
+ JMenuItem miAbout = new JMenuItem(translate("menu.help.about"));
+ miAbout.setIcon(View.getIcon("about16"));
+ miAbout.addActionListener(this::about);
+
+ JMenuItem miCheckUpdates = new JMenuItem(translate("menu.help.checkupdates"));
+ miCheckUpdates.setIcon(View.getIcon("update16"));
+ miCheckUpdates.addActionListener(this::checkUpdates);
+
+ JMenuItem miHelpUs = new JMenuItem(translate("menu.help.helpus"));
+ miHelpUs.setIcon(View.getIcon("donate16"));
+ miHelpUs.addActionListener(this::helpUs);
+
+ JMenuItem miHomepage = new JMenuItem(translate("menu.help.homepage"));
+ miHomepage.setIcon(View.getIcon("homepage16"));
+ miHomepage.addActionListener(this::homePage);
+
+ menuHelp.add(miCheckUpdates);
+ menuHelp.add(miHelpUs);
+ menuHelp.add(miHomepage);
+ menuHelp.addSeparator();
+ menuHelp.add(miAbout);
+ menuBar.add(menuHelp);
+
+ mainFrame.setJMenuBar(menuBar);
+
+ }
+
+ @Override
+ public void updateComponents(SWF swf) {
+ super.updateComponents(swf);
+ boolean swfLoaded = swf != null;
+ List abcList = swfLoaded ? swf.getAbcList() : null;
+ boolean hasAbc = swfLoaded && abcList != null && !abcList.isEmpty();
+ boolean hasDebugger = hasAbc && DebuggerTools.hasDebugger(swf);
+
+ miSave.setEnabled(swfLoaded);
+ miSaveAs.setEnabled(swfLoaded);
+ miSaveAsExe.setEnabled(swfLoaded);
+ miClose.setEnabled(swfLoaded);
+ miCloseAll.setEnabled(swfLoaded);
+
+ menuExport.setEnabled(swfLoaded);
+ miExportAll.setEnabled(swfLoaded);
+ miExportFla.setEnabled(swfLoaded);
+ miExportSel.setEnabled(swfLoaded);
+ miExportXml.setEnabled(swfLoaded);
+
+ menuImport.setEnabled(swfLoaded);
+ miImportText.setEnabled(swfLoaded);
+ miImportScript.setEnabled(swfLoaded);
+ miImportSymbolClass.setEnabled(swfLoaded);
+ miImportXml.setEnabled(swfLoaded);
+
+ miReload.setEnabled(swfLoaded);
+
+ miRenameIdentifiers.setEnabled(swfLoaded);
+ miRenameOneIdentifier.setEnabled(swfLoaded);
+ miSearch.setEnabled(swfLoaded);
+ miReplace.setEnabled(swfLoaded);
+ miViewTimeline.setEnabled(swfLoaded);
+
+ miGotoDocumentClass.setEnabled(hasAbc);
+ miDeobfuscation.setEnabled(hasAbc);
+ miDebuggerSwitch.setEnabled(hasAbc);
+ miDebuggerSwitch.setSelected(hasDebugger);
+ miDebuggerReplaceTrace.setEnabled(hasAbc && hasDebugger);
+ }
+
+ private void viewModeResourcesButtonActionPerformed(ActionEvent evt) {
+ Configuration.dumpView.set(false);
+ mainFrame.getPanel().showView(MainPanel.VIEW_RESOURCES);
+ miViewTimeline.setSelected(false);
+ viewGroup.clearSelection();
+ miViewResources.setSelected(true);
+ }
+
+ private void viewModeHexDumpButtonActionPerformed(ActionEvent evt) {
+ Configuration.dumpView.set(true);
+ mainFrame.getPanel().showView(MainPanel.VIEW_DUMP);
+ miViewTimeline.setSelected(false);
+ viewGroup.clearSelection();
+ miViewHex.setSelected(true);
+ }
+
+ private void debuggerSwitchButtonActionPerformed(ActionEvent evt) {
+ if (!miDebuggerSwitch.isSelected() || View.showConfirmDialog(mainFrame, translate("message.debugger"), translate("dialog.message.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, Configuration.displayDebuggerInfo, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
+ switchDebugger();
+ mainFrame.getPanel().refreshDecompiled();
+ } else {
+ if (miDebuggerSwitch.isSelected()) {
+ miDebuggerSwitch.setSelected(false);
+ }
+ }
+ miDebuggerReplaceTrace.setEnabled(miDebuggerSwitch.isSelected());
+ }
+
+ private void timelineButtonActionPerformed(ActionEvent evt) {
+ if (miViewTimeline.isSelected()) {
+ if (!mainFrame.getPanel().showView(MainPanel.VIEW_TIMELINE)) {
+ miViewTimeline.setSelected(false);
+ } else {
+ viewGroup.clearSelection();
+ }
+ } else {
+ viewGroup.clearSelection();
+ if (Configuration.dumpView.get()) {
+ miViewHex.setSelected(true);
+ mainFrame.getPanel().showView(MainPanel.VIEW_DUMP);
+ } else {
+ miViewResources.setSelected(true);
+ mainFrame.getPanel().showView(MainPanel.VIEW_RESOURCES);
+ }
+ }
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java
index baf739d5a..3e2a7cf8f 100644
--- a/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java
+++ b/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java
@@ -1,738 +1,734 @@
-/*
- * 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 .
- */
-package com.jpexs.decompiler.flash.gui;
-
-import com.jpexs.decompiler.flash.SWF;
-import com.jpexs.decompiler.flash.configuration.Configuration;
-import com.jpexs.decompiler.flash.console.ContextMenuTools;
-import com.jpexs.decompiler.flash.gui.debugger.DebuggerTools;
-import com.jpexs.decompiler.flash.tags.ABCContainerTag;
-import com.jpexs.helpers.Helper;
-import com.jpexs.process.ProcessTools;
-import com.sun.jna.Platform;
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.List;
-import javax.swing.JCheckBox;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.SwingUtilities;
-import org.pushingpixels.flamingo.api.common.CommandButtonDisplayState;
-import org.pushingpixels.flamingo.api.common.CommandToggleButtonGroup;
-import org.pushingpixels.flamingo.api.common.JCommandButton;
-import org.pushingpixels.flamingo.api.common.JCommandButtonPanel;
-import org.pushingpixels.flamingo.api.common.JCommandToggleButton;
-import org.pushingpixels.flamingo.api.common.icon.ResizableIcon;
-import org.pushingpixels.flamingo.api.ribbon.JRibbon;
-import org.pushingpixels.flamingo.api.ribbon.JRibbonBand;
-import org.pushingpixels.flamingo.api.ribbon.JRibbonComponent;
-import org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenu;
-import org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryFooter;
-import org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryPrimary;
-import org.pushingpixels.flamingo.api.ribbon.RibbonElementPriority;
-import org.pushingpixels.flamingo.api.ribbon.RibbonTask;
-import org.pushingpixels.flamingo.api.ribbon.resize.BaseRibbonBandResizePolicy;
-import org.pushingpixels.flamingo.api.ribbon.resize.CoreRibbonResizePolicies;
-import org.pushingpixels.flamingo.api.ribbon.resize.IconRibbonBandResizePolicy;
-import org.pushingpixels.flamingo.api.ribbon.resize.RibbonBandResizePolicy;
-import org.pushingpixels.flamingo.internal.ui.ribbon.AbstractBandControlPanel;
-
-/**
- *
- * @author JPEXS
- */
-public class MainFrameRibbonMenu extends MainFrameMenu {
-
- private final MainFrameRibbon mainFrame;
-
- private JCheckBox miAutoDeobfuscation;
-
- private JCheckBox miInternalViewer;
-
- private JCheckBox miParallelSpeedUp;
-
- private JCheckBox miAssociate;
-
- private JCheckBox miDecompile;
-
- private JCheckBox miCacheDisk;
-
- private JCheckBox miGotoMainClassOnStartup;
-
- private JCheckBox miAutoRenameIdentifiers;
-
- private JCommandButton saveCommandButton;
-
- private JCommandButton saveasCommandButton;
-
- private JCommandButton saveasexeCommandButton;
-
- private JCommandButton exportAllCommandButton;
-
- private JCommandButton exportFlaCommandButton;
-
- private JCommandButton exportSelectionCommandButton;
-
- private JCommandButton importTextCommandButton;
-
- private JCommandButton importScriptCommandButton;
-
- private JCommandButton importSymbolClassCommandButton;
-
- private JCommandButton importXmlCommandButton;
-
- private JCommandButton exportXmlCommandButton;
-
- private JCommandToggleButton viewModeResourcesToggleButton;
-
- private JCommandToggleButton viewModeHexToggleButton;
-
- private JCommandToggleButton deobfuscationModeOldToggleButton;
-
- private JCommandToggleButton deobfuscationModeNewToggleButton;
-
- private JCommandButton reloadCommandButton;
-
- private JCommandButton renameInvalidCommandButton;
-
- private JCommandButton globalRenameCommandButton;
-
- private JCommandButton deobfuscationCommandButton;
-
- private JCommandButton searchCommandButton;
-
- private JCommandButton replaceCommandButton;
-
- private JCommandToggleButton timeLineToggleButton;
-
- private CommandToggleButtonGroup timeLineToggleGroup;
-
- private JCommandButton gotoDocumentClassCommandButton;
-
- private JCommandButton clearRecentFilesCommandButton;
-
- private JCommandToggleButton debuggerSwitchCommandButton;
-
- private CommandToggleButtonGroup debuggerSwitchGroup;
-
- private JCommandButton debuggerReplaceTraceCommandButton;
-
- private JCommandButton debuggerLogCommandButton;
-
- private CommandToggleButtonGroup viewModeToggleGroup;
-
- RibbonApplicationMenuEntryPrimary exportFlaMenu;
-
- RibbonApplicationMenuEntryPrimary exportAllMenu;
-
- RibbonApplicationMenuEntryPrimary exportSelMenu;
-
- RibbonApplicationMenuEntryPrimary saveFileMenu;
-
- RibbonApplicationMenuEntryPrimary saveAsFileMenu;
-
- RibbonApplicationMenuEntryPrimary closeFileMenu;
-
- RibbonApplicationMenuEntryPrimary closeAllFilesMenu;
-
- public MainFrameRibbonMenu(MainFrameRibbon mainFrame, JRibbon ribbon, boolean externalFlashPlayerUnavailable) {
- super(mainFrame);
- this.mainFrame = mainFrame;
-
- ribbon.addTask(createFileRibbonTask());
- ribbon.addTask(createToolsRibbonTask());
- ribbon.addTask(createSettingsRibbonTask(externalFlashPlayerUnavailable));
- ribbon.addTask(createHelpRibbonTask());
-
- if (Configuration.showDebugMenu.get() || Configuration.debugMode.get()) {
- ribbon.addTask(createDebugRibbonTask());
- }
-
- ribbon.setApplicationMenu(createMainMenu());
- }
-
- @Override
- public boolean isInternalFlashViewerSelected() {
- return miInternalViewer.isSelected();
- }
-
- private String fixCommandTitle(String title) {
- if (title.length() > 2) {
- if (title.charAt(1) == ' ') {
- title = title.charAt(0) + "\u00A0" + title.substring(2);
- }
- }
- return title;
- }
-
- private RibbonApplicationMenu createMainMenu() {
- RibbonApplicationMenu mainMenu = new RibbonApplicationMenu();
- exportFlaMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("exportfla32"), translate("menu.file.export.fla"), this::exportFla, JCommandButton.CommandButtonKind.ACTION_ONLY);
- exportAllMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("export32"), translate("menu.file.export.all"), this::exportAll, JCommandButton.CommandButtonKind.ACTION_ONLY);
- exportSelMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("exportsel32"), translate("menu.file.export.selection"), this::exportSelected, JCommandButton.CommandButtonKind.ACTION_ONLY);
- RibbonApplicationMenuEntryPrimary checkUpdatesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("update32"), translate("menu.help.checkupdates"), this::checkUpdates, JCommandButton.CommandButtonKind.ACTION_ONLY);
- RibbonApplicationMenuEntryPrimary aboutMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("about32"), translate("menu.help.about"), this::about, JCommandButton.CommandButtonKind.ACTION_ONLY);
- RibbonApplicationMenuEntryPrimary openFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("open32"), translate("menu.file.open"), this::open, JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION);
- saveFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("save32"), translate("menu.file.save"), this::save, JCommandButton.CommandButtonKind.ACTION_ONLY);
- saveAsFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("saveas32"), translate("menu.file.saveas"), this::saveAs, JCommandButton.CommandButtonKind.ACTION_ONLY);
- closeFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.close"), this::close, JCommandButton.CommandButtonKind.ACTION_ONLY);
- closeAllFilesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.closeAll"), this::closeAll, JCommandButton.CommandButtonKind.ACTION_ONLY);
- openFileMenu.setRolloverCallback(new RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback() {
- @Override
- public void menuEntryActivated(JPanel targetPanel) {
- targetPanel.removeAll();
- JCommandButtonPanel openHistoryPanel = new JCommandButtonPanel(CommandButtonDisplayState.MEDIUM);
- String groupName = translate("menu.recentFiles");
- openHistoryPanel.addButtonGroup(groupName);
- List recentFiles = Configuration.getRecentFiles();
- int j = 0;
- for (int i = recentFiles.size() - 1; i >= 0; i--) {
- String path = recentFiles.get(i);
- RecentFilesButton historyButton = new RecentFilesButton(j + " " + path, null);
- historyButton.fileName = path;
- historyButton.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent ae) {
- RecentFilesButton source = (RecentFilesButton) ae.getSource();
- if (Main.openFile(source.fileName, null) == OpenFileResult.NOT_FOUND) {
- if (View.showConfirmDialog(null, translate("message.confirm.recentFileNotFound"), translate("message.confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) {
- Configuration.removeRecentFile(source.fileName);
- }
- }
- }
- });
- j++;
- historyButton.setHorizontalAlignment(SwingUtilities.LEFT);
- openHistoryPanel.addButtonToLastGroup(historyButton);
- }
- openHistoryPanel.setMaxButtonColumns(1);
- targetPanel.setLayout(new BorderLayout());
- targetPanel.add(openHistoryPanel, BorderLayout.CENTER);
- }
- });
-
- RibbonApplicationMenuEntryFooter exitMenu = new RibbonApplicationMenuEntryFooter(View.getResizableIcon("exit32"), translate("menu.file.exit"), this::exit);
-
- mainMenu.addMenuEntry(openFileMenu);
- mainMenu.addMenuEntry(saveFileMenu);
- mainMenu.addMenuEntry(saveAsFileMenu);
- mainMenu.addMenuEntry(closeFileMenu);
- mainMenu.addMenuEntry(closeAllFilesMenu);
- mainMenu.addMenuSeparator();
- mainMenu.addMenuEntry(exportFlaMenu);
- mainMenu.addMenuEntry(exportAllMenu);
- mainMenu.addMenuEntry(exportSelMenu);
- mainMenu.addMenuSeparator();
- mainMenu.addMenuEntry(checkUpdatesMenu);
- mainMenu.addMenuEntry(aboutMenu);
- mainMenu.addFooterEntry(exitMenu);
- mainMenu.addMenuSeparator();
-
- return mainMenu;
- }
-
- private List titleResizePolicies(final JRibbonBand ribbonBand) {
- List resizePolicies = new ArrayList<>();
- resizePolicies.add(new BaseRibbonBandResizePolicy(ribbonBand.getControlPanel()) {
- @Override
- public int getPreferredWidth(int i, int i1) {
- return ribbonBand.getGraphics().getFontMetrics(ribbonBand.getFont()).stringWidth(ribbonBand.getTitle()) + 20;
- }
-
- @Override
- public void install(int i, int i1) {
- }
- });
- return resizePolicies;
- }
-
- private List getResizePolicies(JRibbonBand ribbonBand) {
- List resizePolicies = new ArrayList<>();
- resizePolicies.add(new CoreRibbonResizePolicies.Mirror(ribbonBand.getControlPanel()));
- resizePolicies.add(new IconRibbonBandResizePolicy(ribbonBand.getControlPanel()));
- return resizePolicies;
- }
-
- private List getIconBandResizePolicies(JRibbonBand ribbonBand) {
- List resizePolicies = new ArrayList<>();
- IconRibbonBandResizePolicy iconBandResizePolicy = new IconRibbonBandResizePolicy(ribbonBand.getControlPanel());
- final int width = Math.max(105, iconBandResizePolicy.getPreferredWidth(0, 0));
- resizePolicies.add(new BaseRibbonBandResizePolicy(ribbonBand.getControlPanel()) {
- @Override
- public int getPreferredWidth(int i, int i1) {
- return width;
- }
-
- @Override
- public void install(int i, int i1) {
- }
- });
- resizePolicies.add(iconBandResizePolicy);
- return resizePolicies;
- }
-
- private RibbonTask createFileRibbonTask() {
- JRibbonBand editBand = new JRibbonBand(translate("menu.general"), null);
- editBand.setResizePolicies(getResizePolicies(editBand));
- JCommandButton openCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.open")), View.getResizableIcon("open32"));
- openCommandButton.addActionListener(this::open);
- saveCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.save")), View.getResizableIcon("save32"));
- saveCommandButton.addActionListener(this::save);
- saveasCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.saveas")), View.getResizableIcon("saveas16"));
- saveasCommandButton.addActionListener(this::saveAs);
-
- reloadCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.reload")), View.getResizableIcon("reload16"));
- reloadCommandButton.addActionListener(this::reload);
-
- saveasexeCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.saveasexe")), View.getResizableIcon("saveasexe16"));
- saveasexeCommandButton.addActionListener(this::saveAsExe);;
-
- editBand.addCommandButton(openCommandButton, RibbonElementPriority.TOP);
- editBand.addCommandButton(saveCommandButton, RibbonElementPriority.TOP);
- editBand.addCommandButton(saveasCommandButton, RibbonElementPriority.MEDIUM);
- editBand.addCommandButton(saveasexeCommandButton, RibbonElementPriority.MEDIUM);
- editBand.addCommandButton(reloadCommandButton, RibbonElementPriority.MEDIUM);
-
- JRibbonBand exportBand = new JRibbonBand(translate("menu.export"), null);
- exportBand.setResizePolicies(getResizePolicies(exportBand));
- exportFlaCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.fla")), View.getResizableIcon("exportfla32"));
- exportFlaCommandButton.addActionListener(this::exportFla);
- exportAllCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.all")), View.getResizableIcon("export16"));
- exportAllCommandButton.addActionListener(this::exportAll);
- exportSelectionCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.selection")), View.getResizableIcon("exportsel16"));
- exportSelectionCommandButton.addActionListener(this::exportSelected);
-
- exportXmlCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.xml")), View.getResizableIcon("exportxml32"));
- exportXmlCommandButton.addActionListener(this::exportSwfXml);
-
- exportBand.addCommandButton(exportFlaCommandButton, RibbonElementPriority.TOP);
- 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"));
- importTextCommandButton.addActionListener(this::importText);
-
- // todo: icon
- importScriptCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.script")), View.getResizableIcon("importtext32"));
- importScriptCommandButton.addActionListener(this::importScript);
-
- importSymbolClassCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.symbolClass")), View.getResizableIcon("importsymbolclass32"));
- importSymbolClassCommandButton.addActionListener(this::importSymbolClass);
-
- importXmlCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.xml")), View.getResizableIcon("importxml32"));
- importXmlCommandButton.addActionListener(this::importSwfXml);
-
- importBand.addCommandButton(importXmlCommandButton, RibbonElementPriority.TOP);
- importBand.addCommandButton(importTextCommandButton, RibbonElementPriority.MEDIUM);
- importBand.addCommandButton(importScriptCommandButton, RibbonElementPriority.MEDIUM);
- importBand.addCommandButton(importSymbolClassCommandButton, RibbonElementPriority.MEDIUM);
-
- JRibbonBand viewBand = new JRibbonBand(translate("menu.view"), null);
- viewBand.setResizePolicies(getResizePolicies(viewBand));
-
- viewModeToggleGroup = new CommandToggleButtonGroup();
-
- viewModeResourcesToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.view.resources")), View.getResizableIcon("viewresources16"));
- viewModeResourcesToggleButton.addActionListener(this::viewModeResouresButtonActionPerformed);
-
- viewModeHexToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.view.hex")), View.getResizableIcon("viewhex16"));
- viewModeHexToggleButton.addActionListener(this::viewModeHexDumpButtonActionPerformed);;
-
- viewModeToggleGroup.add(viewModeResourcesToggleButton);
- viewModeToggleGroup.add(viewModeHexToggleButton);
-
- if (Configuration.dumpView.get()) {
- viewModeToggleGroup.setSelected(viewModeHexToggleButton, true);
- } else {
- viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, true);
- }
-
- viewBand.addCommandButton(viewModeResourcesToggleButton, RibbonElementPriority.MEDIUM);
- viewBand.addCommandButton(viewModeHexToggleButton, RibbonElementPriority.MEDIUM);
-
- return new RibbonTask(translate("menu.file"), editBand, exportBand, importBand, viewBand);
- }
-
- private RibbonTask createToolsRibbonTask() {
-
- JRibbonBand debuggerBand = new JRibbonBand(translate("menu.debugger"), null);
- debuggerBand.setResizePolicies(getResizePolicies(debuggerBand));
-
- debuggerSwitchCommandButton = new JCommandToggleButton(translate("menu.debugger.switch"), View.getResizableIcon("debugger32"));
- debuggerSwitchCommandButton.addActionListener(this::debuggerSwitchButtonActionPerformed);
-
- //debuggerDetachCommandButton = new JCommandButton("Detach debugger",View.getResizableIcon("debuggerremove16"));
- //debuggerDetachCommandButton.addActionListener(this::debuggerDetach);
- debuggerReplaceTraceCommandButton = new JCommandButton(translate("menu.debugger.replacetrace"), View.getResizableIcon("debuggerreplace16"));
- debuggerReplaceTraceCommandButton.addActionListener(this::debuggerReplaceTraceCalls);
-
- debuggerLogCommandButton = new JCommandButton(translate("menu.debugger.showlog"), View.getResizableIcon("debuggerlog16"));
- debuggerLogCommandButton.addActionListener(this::debuggerShowLog);
-
- debuggerSwitchGroup = new CommandToggleButtonGroup();
- debuggerSwitchGroup.add(debuggerSwitchCommandButton);
-
- debuggerSwitchCommandButton.setEnabled(false);
-
- debuggerReplaceTraceCommandButton.setEnabled(false);
-
- debuggerBand.addCommandButton(debuggerSwitchCommandButton, RibbonElementPriority.TOP);
- debuggerBand.addCommandButton(debuggerReplaceTraceCommandButton, RibbonElementPriority.MEDIUM);
- debuggerBand.addCommandButton(debuggerLogCommandButton, RibbonElementPriority.MEDIUM);
-
- // ----------------------------------------- TOOLS -----------------------------------
- JRibbonBand toolsBand = new JRibbonBand(translate("menu.tools"), null);
- toolsBand.setResizePolicies(getResizePolicies(toolsBand));
-
- searchCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.search")), View.getResizableIcon("search32"));
- searchCommandButton.addActionListener((ActionEvent e) -> {
- search(e, null);
- });
-
- replaceCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.replace")), View.getResizableIcon("replace32"));
- replaceCommandButton.addActionListener(this::replace);
-
- timeLineToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.tools.timeline")), View.getResizableIcon("timeline32"));
- timeLineToggleButton.addActionListener(this::timelineButtonActionPerformed);
-
- timeLineToggleGroup = new CommandToggleButtonGroup();
- timeLineToggleGroup.add(timeLineToggleButton);
-
- gotoDocumentClassCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.gotodocumentclass")), View.getResizableIcon("gotomainclass32"));
- gotoDocumentClassCommandButton.addActionListener(this::gotoDucumentClass);
-
- JCommandButton proxyCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.proxy")), View.getResizableIcon("proxy16"));
- proxyCommandButton.addActionListener(this::showProxy);
-
- JCommandButton loadMemoryCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.searchmemory")), View.getResizableIcon("loadmemory16"));
- loadMemoryCommandButton.addActionListener(this::loadFromMemory);
-
- JCommandButton loadCacheCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.searchcache")), View.getResizableIcon("loadcache16"));
- loadCacheCommandButton.addActionListener(this::loadFromCache);
-
- toolsBand.addCommandButton(searchCommandButton, RibbonElementPriority.TOP);
- toolsBand.addCommandButton(replaceCommandButton, RibbonElementPriority.TOP);
- toolsBand.addCommandButton(timeLineToggleButton, RibbonElementPriority.TOP);
- toolsBand.addCommandButton(gotoDocumentClassCommandButton, RibbonElementPriority.TOP);
- toolsBand.addCommandButton(proxyCommandButton, RibbonElementPriority.MEDIUM);
- toolsBand.addCommandButton(loadMemoryCommandButton, RibbonElementPriority.MEDIUM);
- toolsBand.addCommandButton(loadCacheCommandButton, RibbonElementPriority.MEDIUM);
- if (!ProcessTools.toolsAvailable()) {
- loadMemoryCommandButton.setEnabled(false);
- }
- JRibbonBand deobfuscationBand = new JRibbonBand(translate("menu.tools.deobfuscation"), null);
- deobfuscationBand.setResizePolicies(getResizePolicies(deobfuscationBand));
-
- deobfuscationCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.deobfuscation.pcode")), View.getResizableIcon("deobfuscate32"));
- deobfuscationCommandButton.addActionListener(this::deobfuscate);
- globalRenameCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.deobfuscation.globalrename")), View.getResizableIcon("rename16"));
- globalRenameCommandButton.addActionListener(this::renameOneIdentifier);
- renameInvalidCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.deobfuscation.renameinvalid")), View.getResizableIcon("renameall16"));
- renameInvalidCommandButton.addActionListener(this::renameIdentifiers);
-
- deobfuscationBand.addCommandButton(deobfuscationCommandButton, RibbonElementPriority.TOP);
- deobfuscationBand.addCommandButton(globalRenameCommandButton, RibbonElementPriority.MEDIUM);
- deobfuscationBand.addCommandButton(renameInvalidCommandButton, RibbonElementPriority.MEDIUM);
-
- //JRibbonBand otherToolsBand = new JRibbonBand(translate("menu.tools.otherTools"), null);
- //otherToolsBand.setResizePolicies(getResizePolicies(otherToolsBand));
- return new RibbonTask(translate("menu.tools"), toolsBand, deobfuscationBand, debuggerBand /*, otherToolsBand*/);
- }
-
- private RibbonTask createSettingsRibbonTask(boolean externalFlashPlayerUnavailable) {
- // ----------------------------------------- SETTINGS -----------------------------------
-
- JRibbonBand settingsBand = new JRibbonBand(translate("menu.settings"), null);
- settingsBand.setResizePolicies(getResizePolicies(settingsBand));
-
- miAutoDeobfuscation = new JCheckBox(translate("menu.settings.autodeobfuscation"));
- miAutoDeobfuscation.setSelected(Configuration.autoDeobfuscate.get());
- miAutoDeobfuscation.addActionListener(this::autoDeobfuscate);
-
- miInternalViewer = new JCheckBox(translate("menu.settings.internalflashviewer"));
- miInternalViewer.setSelected(Configuration.internalFlashViewer.get() || externalFlashPlayerUnavailable);
- if (externalFlashPlayerUnavailable) {
- miInternalViewer.setEnabled(false);
- }
- miInternalViewer.addActionListener(this::internalViewerSwitch);
-
- miParallelSpeedUp = new JCheckBox(translate("menu.settings.parallelspeedup"));
- miParallelSpeedUp.setSelected(Configuration.parallelSpeedUp.get());
- miParallelSpeedUp.addActionListener(this::parallelSpeedUp);
-
- miDecompile = new JCheckBox(translate("menu.settings.disabledecompilation"));
- miDecompile.setSelected(!Configuration.decompile.get());
- miDecompile.addActionListener(this::disableDecompilation);
-
- miAssociate = new JCheckBox(translate("menu.settings.addtocontextmenu"));
- miAssociate.addActionListener(this::associate);
- miAssociate.setSelected(ContextMenuTools.isAddedToContextMenu());
-
- miCacheDisk = new JCheckBox(translate("menu.settings.cacheOnDisk"));
- miCacheDisk.setSelected(Configuration.cacheOnDisk.get());
- miCacheDisk.addActionListener(this::cacheOnDisk);
-
- miGotoMainClassOnStartup = new JCheckBox(translate("menu.settings.gotoMainClassOnStartup"));
- miGotoMainClassOnStartup.setSelected(Configuration.gotoMainClassOnStartup.get());
- miGotoMainClassOnStartup.addActionListener(this::gotoDucumentClassOnStartup);
-
- miAutoRenameIdentifiers = new JCheckBox(translate("menu.settings.autoRenameIdentifiers"));
- miAutoRenameIdentifiers.setSelected(Configuration.autoRenameIdentifiers.get());
- miAutoRenameIdentifiers.addActionListener(this::autoRenameIdentifiers);
-
- settingsBand.addRibbonComponent(new JRibbonComponent(miAutoDeobfuscation));
- settingsBand.addRibbonComponent(new JRibbonComponent(miInternalViewer));
- settingsBand.addRibbonComponent(new JRibbonComponent(miParallelSpeedUp));
- settingsBand.addRibbonComponent(new JRibbonComponent(miDecompile));
- if (Platform.isWindows()) {
- settingsBand.addRibbonComponent(new JRibbonComponent(miAssociate));
- }
- settingsBand.addRibbonComponent(new JRibbonComponent(miCacheDisk));
- settingsBand.addRibbonComponent(new JRibbonComponent(miGotoMainClassOnStartup));
- settingsBand.addRibbonComponent(new JRibbonComponent(miAutoRenameIdentifiers));
-
- JRibbonBand languageBand = new JRibbonBand(translate("menu.language"), null);
- List languageBandResizePolicies = getIconBandResizePolicies(languageBand);
- languageBand.setResizePolicies(languageBandResizePolicies);
- JCommandButton setLanguageCommandButton = new JCommandButton(fixCommandTitle(translate("menu.settings.language")), View.getResizableIcon("setlanguage32"));
- setLanguageCommandButton.addActionListener(this::setLanguage);
- languageBand.addCommandButton(setLanguageCommandButton, RibbonElementPriority.TOP);
-
- JRibbonBand advancedSettingsBand = new JRibbonBand(translate("menu.advancedsettings.advancedsettings"), null);
- advancedSettingsBand.setResizePolicies(getResizePolicies(advancedSettingsBand));
- JCommandButton advancedSettingsCommandButton = new JCommandButton(fixCommandTitle(translate("menu.advancedsettings.advancedsettings")), View.getResizableIcon("settings32"));
- advancedSettingsCommandButton.addActionListener(this::advancedSettings);
- advancedSettingsBand.addCommandButton(advancedSettingsCommandButton, RibbonElementPriority.TOP);
-
- clearRecentFilesCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.otherTools.clearRecentFiles")), View.getResizableIcon("clearrecent16"));
- clearRecentFilesCommandButton.addActionListener(this::clearRecentFiles);
- advancedSettingsBand.addCommandButton(clearRecentFilesCommandButton, RibbonElementPriority.MEDIUM);
-
- JRibbonBand deobfuscationBand = new JRibbonBand(translate("menu.deobfuscation"), null);
- deobfuscationBand.setResizePolicies(titleResizePolicies(deobfuscationBand));
-
- CommandToggleButtonGroup grpDeobfuscation = new CommandToggleButtonGroup();
-
- deobfuscationModeOldToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.deobfuscation.old")), View.getResizableIcon("deobfuscateold16"));
- deobfuscationModeOldToggleButton.addActionListener((ActionEvent e) -> {
- deobfuscationMode(e, 0);
- });
-
- deobfuscationModeNewToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.deobfuscation.new")), View.getResizableIcon("deobfuscatenew16"));
- deobfuscationModeNewToggleButton.addActionListener((ActionEvent e) -> {
- deobfuscationMode(e, 1);
- });
-
- grpDeobfuscation.add(deobfuscationModeOldToggleButton);
- grpDeobfuscation.add(deobfuscationModeNewToggleButton);
-
- int deobfuscationMode = Configuration.deobfuscationMode.get();
- switch (deobfuscationMode) {
- case 0:
- grpDeobfuscation.setSelected(deobfuscationModeOldToggleButton, true);
- break;
- case 1:
- grpDeobfuscation.setSelected(deobfuscationModeNewToggleButton, true);
- break;
- }
-
- deobfuscationBand.addCommandButton(deobfuscationModeOldToggleButton, RibbonElementPriority.MEDIUM);
- deobfuscationBand.addCommandButton(deobfuscationModeNewToggleButton, RibbonElementPriority.MEDIUM);
-
- return new RibbonTask(translate("menu.settings"), settingsBand, languageBand, advancedSettingsBand, deobfuscationBand);
- }
-
- private RibbonTask createHelpRibbonTask() {
- // ----------------------------------------- HELP -----------------------------------
-
- JRibbonBand helpBand = new JRibbonBand(translate("menu.help"), null);
- helpBand.setResizePolicies(getResizePolicies(helpBand));
-
- JCommandButton checkForUpdatesCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.checkupdates")), View.getResizableIcon("update16"));
- checkForUpdatesCommandButton.addActionListener(this::checkUpdates);
- JCommandButton helpUsUpdatesCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.helpus")), View.getResizableIcon("donate32"));
- helpUsUpdatesCommandButton.addActionListener(this::helpUs);
- JCommandButton homepageCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.homepage")), View.getResizableIcon("homepage16"));
- homepageCommandButton.addActionListener(this::homePage);
- JCommandButton aboutCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.about")), View.getResizableIcon("about32"));
- aboutCommandButton.addActionListener(this::about);
-
- helpBand.addCommandButton(aboutCommandButton, RibbonElementPriority.TOP);
- helpBand.addCommandButton(checkForUpdatesCommandButton, RibbonElementPriority.MEDIUM);
- helpBand.addCommandButton(homepageCommandButton, RibbonElementPriority.MEDIUM);
- helpBand.addCommandButton(helpUsUpdatesCommandButton, RibbonElementPriority.TOP);
- return new RibbonTask(translate("menu.help"), helpBand);
- }
-
- private RibbonTask createDebugRibbonTask() {
- // ----------------------------------------- DEBUG -----------------------------------
-
- ResizableIcon icon = View.getResizableIcon("update16");
- JRibbonBand debugBand = new JRibbonBand("Debug", null);
- debugBand.setResizePolicies(getResizePolicies(debugBand));
-
- JCommandButton removeNonScriptsCommandButton = new JCommandButton(fixCommandTitle("Remove non scripts"), icon);
- removeNonScriptsCommandButton.addActionListener(e -> removeNonScripts());
-
- JCommandButton refreshDecompiledCommandButton = new JCommandButton(fixCommandTitle("Refresh decompiled script"), icon);
- refreshDecompiledCommandButton.addActionListener(e -> refreshDecompiled());
-
- JCommandButton checkResourcesCommandButton = new JCommandButton(fixCommandTitle("Check resources"), icon);
- checkResourcesCommandButton.addActionListener(e -> checkResources());
-
- JCommandButton callGcCommandButton = new JCommandButton(fixCommandTitle("Call System.gc()"), icon);
- callGcCommandButton.addActionListener(e -> System.gc());
-
- JCommandButton emptyCacheCommandButton = new JCommandButton(fixCommandTitle("Empty cache"), icon);
- emptyCacheCommandButton.addActionListener(e -> {
- SWF swf = mainFrame.getPanel().getCurrentSwf();
- if (swf != null) {
- swf.clearAllCache();
- }
- });
-
- JCommandButton memoryInformationCommandButton = new JCommandButton(fixCommandTitle("Memory information"), icon);
- memoryInformationCommandButton.addActionListener(e -> {
- String architecture = System.getProperty("sun.arch.data.model");
- Runtime runtime = Runtime.getRuntime();
- String info = "Architecture: " + architecture + Helper.newLine
- + "Max: " + (runtime.maxMemory() / 1024 / 1024) + "MB" + Helper.newLine
- + "Used: " + (runtime.totalMemory() / 1024 / 1024) + "MB" + Helper.newLine
- + "Free: " + (runtime.freeMemory() / 1024 / 1024) + "MB";
- View.showMessageDialog(null, info);
- SWF swf = mainFrame.getPanel().getCurrentSwf();
- if (swf != null) {
- swf.clearAllCache();
- }
- });
-
- JCommandButton fixAs3CodeCommandButton = new JCommandButton(fixCommandTitle("Fix AS3 code"), icon);
- fixAs3CodeCommandButton.addActionListener(e -> {
- SWF swf = mainFrame.getPanel().getCurrentSwf();
- if (swf != null) {
- swf.fixAS3Code();
- }
- });
-
- debugBand.addCommandButton(removeNonScriptsCommandButton, RibbonElementPriority.MEDIUM);
- debugBand.addCommandButton(refreshDecompiledCommandButton, RibbonElementPriority.MEDIUM);
- debugBand.addCommandButton(checkResourcesCommandButton, RibbonElementPriority.MEDIUM);
- debugBand.addCommandButton(callGcCommandButton, RibbonElementPriority.MEDIUM);
- debugBand.addCommandButton(emptyCacheCommandButton, RibbonElementPriority.MEDIUM);
- debugBand.addCommandButton(memoryInformationCommandButton, RibbonElementPriority.MEDIUM);
- debugBand.addCommandButton(fixAs3CodeCommandButton, RibbonElementPriority.MEDIUM);
- return new RibbonTask("Debug", debugBand);
- }
-
- @Override
- public void updateComponents(SWF swf) {
- super.updateComponents(swf);
- boolean swfLoaded = swf != null;
- List abcList = swfLoaded ? swf.getAbcList() : null;
- boolean hasAbc = swfLoaded && abcList != null && !abcList.isEmpty();
- boolean hasDebugger = hasAbc && DebuggerTools.hasDebugger(swf);
-
- exportAllMenu.setEnabled(swfLoaded);
- exportFlaMenu.setEnabled(swfLoaded);
- exportSelMenu.setEnabled(swfLoaded);
- saveFileMenu.setEnabled(swfLoaded);
- saveAsFileMenu.setEnabled(swfLoaded);
- closeFileMenu.setEnabled(swfLoaded);
- closeAllFilesMenu.setEnabled(swfLoaded);
-
- boolean isBundle = swfLoaded && (swf.swfList != null) && (swf.swfList.isBundle());
- saveCommandButton.setEnabled(swfLoaded && ((!isBundle) || (!swf.swfList.bundle.isReadOnly())));
- saveasCommandButton.setEnabled(swfLoaded);
- saveasexeCommandButton.setEnabled(swfLoaded);
- exportAllCommandButton.setEnabled(swfLoaded);
- exportFlaCommandButton.setEnabled(swfLoaded);
- exportXmlCommandButton.setEnabled(swfLoaded);
- exportSelectionCommandButton.setEnabled(swfLoaded);
- importTextCommandButton.setEnabled(swfLoaded);
- importScriptCommandButton.setEnabled(swfLoaded);
- importSymbolClassCommandButton.setEnabled(swfLoaded);
- importXmlCommandButton.setEnabled(swfLoaded);
- reloadCommandButton.setEnabled(swfLoaded);
-
- renameInvalidCommandButton.setEnabled(swfLoaded);
- globalRenameCommandButton.setEnabled(swfLoaded);
- deobfuscationCommandButton.setEnabled(swfLoaded);
- searchCommandButton.setEnabled(swfLoaded);
- replaceCommandButton.setEnabled(swfLoaded);
- timeLineToggleButton.setEnabled(swfLoaded);
-
- gotoDocumentClassCommandButton.setEnabled(hasAbc);
- deobfuscationCommandButton.setEnabled(hasAbc);
- debuggerSwitchCommandButton.setEnabled(hasAbc);
- debuggerSwitchGroup.setSelected(debuggerSwitchCommandButton, hasDebugger);
- //debuggerSwitchCommandButton.
- //debuggerDetachCommandButton.setEnabled(hasDebugger);
- debuggerReplaceTraceCommandButton.setEnabled(hasAbc && hasDebugger);
- }
-
- private void debuggerSwitchButtonActionPerformed(ActionEvent evt) {
- if (debuggerSwitchGroup.getSelected() == null || View.showConfirmDialog(mainFrame, translate("message.debugger"), translate("dialog.message.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, Configuration.displayDebuggerInfo, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
- switchDebugger();
- mainFrame.getPanel().refreshDecompiled();
- } else {
- if (debuggerSwitchGroup.getSelected() == debuggerSwitchCommandButton) {
- debuggerSwitchGroup.setSelected(debuggerSwitchCommandButton, false);
- }
- }
- debuggerReplaceTraceCommandButton.setEnabled(debuggerSwitchGroup.getSelected() == debuggerSwitchCommandButton);
- }
-
- private void viewModeResouresButtonActionPerformed(ActionEvent evt) {
- Configuration.dumpView.set(false);
- mainFrame.getPanel().showView(MainPanel.VIEW_RESOURCES);
- timeLineToggleGroup.setSelected(timeLineToggleButton, false);
- viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, true);
- }
-
- private void viewModeHexDumpButtonActionPerformed(ActionEvent evt) {
- Configuration.dumpView.set(true);
- mainFrame.getPanel().showView(MainPanel.VIEW_DUMP);
- timeLineToggleGroup.setSelected(timeLineToggleButton, false);
- viewModeToggleGroup.setSelected(viewModeHexToggleButton, true);
- }
-
- private void timelineButtonActionPerformed(ActionEvent evt) {
- timeLineToggleGroup.setSelected(timeLineToggleButton, timeLineToggleGroup.getSelected() == timeLineToggleButton);
- if (timeLineToggleGroup.getSelected() == timeLineToggleButton) {
- if (!mainFrame.getPanel().showView(MainPanel.VIEW_TIMELINE)) {
- timeLineToggleGroup.setSelected(timeLineToggleButton, false);
- } else {
- viewModeToggleGroup.setSelected(viewModeHexToggleButton, false);
- viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, false);
- }
- } else {
- if (Configuration.dumpView.get()) {
- viewModeToggleGroup.setSelected(viewModeHexToggleButton, true);
- mainFrame.getPanel().showView(MainPanel.VIEW_DUMP);
- } else {
- viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, true);
- mainFrame.getPanel().showView(MainPanel.VIEW_RESOURCES);
- }
- }
- }
-}
+/*
+ * 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 .
+ */
+package com.jpexs.decompiler.flash.gui;
+
+import com.jpexs.decompiler.flash.SWF;
+import com.jpexs.decompiler.flash.configuration.Configuration;
+import com.jpexs.decompiler.flash.console.ContextMenuTools;
+import com.jpexs.decompiler.flash.gui.debugger.DebuggerTools;
+import com.jpexs.decompiler.flash.tags.ABCContainerTag;
+import com.jpexs.helpers.Helper;
+import com.jpexs.process.ProcessTools;
+import com.sun.jna.Platform;
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.JCheckBox;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import org.pushingpixels.flamingo.api.common.CommandButtonDisplayState;
+import org.pushingpixels.flamingo.api.common.CommandToggleButtonGroup;
+import org.pushingpixels.flamingo.api.common.JCommandButton;
+import org.pushingpixels.flamingo.api.common.JCommandButtonPanel;
+import org.pushingpixels.flamingo.api.common.JCommandToggleButton;
+import org.pushingpixels.flamingo.api.common.icon.ResizableIcon;
+import org.pushingpixels.flamingo.api.ribbon.JRibbon;
+import org.pushingpixels.flamingo.api.ribbon.JRibbonBand;
+import org.pushingpixels.flamingo.api.ribbon.JRibbonComponent;
+import org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenu;
+import org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryFooter;
+import org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryPrimary;
+import org.pushingpixels.flamingo.api.ribbon.RibbonElementPriority;
+import org.pushingpixels.flamingo.api.ribbon.RibbonTask;
+import org.pushingpixels.flamingo.api.ribbon.resize.BaseRibbonBandResizePolicy;
+import org.pushingpixels.flamingo.api.ribbon.resize.CoreRibbonResizePolicies;
+import org.pushingpixels.flamingo.api.ribbon.resize.IconRibbonBandResizePolicy;
+import org.pushingpixels.flamingo.api.ribbon.resize.RibbonBandResizePolicy;
+import org.pushingpixels.flamingo.internal.ui.ribbon.AbstractBandControlPanel;
+
+/**
+ *
+ * @author JPEXS
+ */
+public class MainFrameRibbonMenu extends MainFrameMenu {
+
+ private final MainFrameRibbon mainFrame;
+
+ private JCheckBox miAutoDeobfuscation;
+
+ private JCheckBox miInternalViewer;
+
+ private JCheckBox miParallelSpeedUp;
+
+ private JCheckBox miAssociate;
+
+ private JCheckBox miDecompile;
+
+ private JCheckBox miCacheDisk;
+
+ private JCheckBox miGotoMainClassOnStartup;
+
+ private JCheckBox miAutoRenameIdentifiers;
+
+ private JCommandButton saveCommandButton;
+
+ private JCommandButton saveasCommandButton;
+
+ private JCommandButton saveasexeCommandButton;
+
+ private JCommandButton exportAllCommandButton;
+
+ private JCommandButton exportFlaCommandButton;
+
+ private JCommandButton exportSelectionCommandButton;
+
+ private JCommandButton importTextCommandButton;
+
+ private JCommandButton importScriptCommandButton;
+
+ private JCommandButton importSymbolClassCommandButton;
+
+ private JCommandButton importXmlCommandButton;
+
+ private JCommandButton exportXmlCommandButton;
+
+ private JCommandToggleButton viewModeResourcesToggleButton;
+
+ private JCommandToggleButton viewModeHexToggleButton;
+
+ private JCommandToggleButton deobfuscationModeOldToggleButton;
+
+ private JCommandToggleButton deobfuscationModeNewToggleButton;
+
+ private JCommandButton reloadCommandButton;
+
+ private JCommandButton renameInvalidCommandButton;
+
+ private JCommandButton globalRenameCommandButton;
+
+ private JCommandButton deobfuscationCommandButton;
+
+ private JCommandButton searchCommandButton;
+
+ private JCommandButton replaceCommandButton;
+
+ private JCommandToggleButton timeLineToggleButton;
+
+ private CommandToggleButtonGroup timeLineToggleGroup;
+
+ private JCommandButton gotoDocumentClassCommandButton;
+
+ private JCommandButton clearRecentFilesCommandButton;
+
+ private JCommandToggleButton debuggerSwitchCommandButton;
+
+ private CommandToggleButtonGroup debuggerSwitchGroup;
+
+ private JCommandButton debuggerReplaceTraceCommandButton;
+
+ private JCommandButton debuggerLogCommandButton;
+
+ private CommandToggleButtonGroup viewModeToggleGroup;
+
+ RibbonApplicationMenuEntryPrimary exportFlaMenu;
+
+ RibbonApplicationMenuEntryPrimary exportAllMenu;
+
+ RibbonApplicationMenuEntryPrimary exportSelMenu;
+
+ RibbonApplicationMenuEntryPrimary saveFileMenu;
+
+ RibbonApplicationMenuEntryPrimary saveAsFileMenu;
+
+ RibbonApplicationMenuEntryPrimary closeFileMenu;
+
+ RibbonApplicationMenuEntryPrimary closeAllFilesMenu;
+
+ public MainFrameRibbonMenu(MainFrameRibbon mainFrame, JRibbon ribbon, boolean externalFlashPlayerUnavailable) {
+ super(mainFrame);
+ this.mainFrame = mainFrame;
+
+ ribbon.addTask(createFileRibbonTask());
+ ribbon.addTask(createToolsRibbonTask());
+ ribbon.addTask(createSettingsRibbonTask(externalFlashPlayerUnavailable));
+ ribbon.addTask(createHelpRibbonTask());
+
+ if (Configuration.showDebugMenu.get() || Configuration.debugMode.get()) {
+ ribbon.addTask(createDebugRibbonTask());
+ }
+
+ ribbon.setApplicationMenu(createMainMenu());
+ }
+
+ @Override
+ public boolean isInternalFlashViewerSelected() {
+ return miInternalViewer.isSelected();
+ }
+
+ private String fixCommandTitle(String title) {
+ if (title.length() > 2) {
+ if (title.charAt(1) == ' ') {
+ title = title.charAt(0) + "\u00A0" + title.substring(2);
+ }
+ }
+ return title;
+ }
+
+ private RibbonApplicationMenu createMainMenu() {
+ RibbonApplicationMenu mainMenu = new RibbonApplicationMenu();
+ exportFlaMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("exportfla32"), translate("menu.file.export.fla"), this::exportFla, JCommandButton.CommandButtonKind.ACTION_ONLY);
+ exportAllMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("export32"), translate("menu.file.export.all"), this::exportAll, JCommandButton.CommandButtonKind.ACTION_ONLY);
+ exportSelMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("exportsel32"), translate("menu.file.export.selection"), this::exportSelected, JCommandButton.CommandButtonKind.ACTION_ONLY);
+ RibbonApplicationMenuEntryPrimary checkUpdatesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("update32"), translate("menu.help.checkupdates"), this::checkUpdates, JCommandButton.CommandButtonKind.ACTION_ONLY);
+ RibbonApplicationMenuEntryPrimary aboutMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("about32"), translate("menu.help.about"), this::about, JCommandButton.CommandButtonKind.ACTION_ONLY);
+ RibbonApplicationMenuEntryPrimary openFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("open32"), translate("menu.file.open"), this::open, JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION);
+ saveFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("save32"), translate("menu.file.save"), this::save, JCommandButton.CommandButtonKind.ACTION_ONLY);
+ saveAsFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("saveas32"), translate("menu.file.saveas"), this::saveAs, JCommandButton.CommandButtonKind.ACTION_ONLY);
+ closeFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.close"), this::close, JCommandButton.CommandButtonKind.ACTION_ONLY);
+ closeAllFilesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.closeAll"), this::closeAll, JCommandButton.CommandButtonKind.ACTION_ONLY);
+ openFileMenu.setRolloverCallback(new RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback() {
+ @Override
+ public void menuEntryActivated(JPanel targetPanel) {
+ targetPanel.removeAll();
+ JCommandButtonPanel openHistoryPanel = new JCommandButtonPanel(CommandButtonDisplayState.MEDIUM);
+ String groupName = translate("menu.recentFiles");
+ openHistoryPanel.addButtonGroup(groupName);
+ List recentFiles = Configuration.getRecentFiles();
+ int j = 0;
+ for (int i = recentFiles.size() - 1; i >= 0; i--) {
+ String path = recentFiles.get(i);
+ RecentFilesButton historyButton = new RecentFilesButton(j + " " + path, null);
+ historyButton.fileName = path;
+ historyButton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent ae) {
+ RecentFilesButton source = (RecentFilesButton) ae.getSource();
+ if (Main.openFile(source.fileName, null) == OpenFileResult.NOT_FOUND) {
+ if (View.showConfirmDialog(null, translate("message.confirm.recentFileNotFound"), translate("message.confirm"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) {
+ Configuration.removeRecentFile(source.fileName);
+ }
+ }
+ }
+ });
+ j++;
+ historyButton.setHorizontalAlignment(SwingUtilities.LEFT);
+ openHistoryPanel.addButtonToLastGroup(historyButton);
+ }
+ openHistoryPanel.setMaxButtonColumns(1);
+ targetPanel.setLayout(new BorderLayout());
+ targetPanel.add(openHistoryPanel, BorderLayout.CENTER);
+ }
+ });
+
+ RibbonApplicationMenuEntryFooter exitMenu = new RibbonApplicationMenuEntryFooter(View.getResizableIcon("exit32"), translate("menu.file.exit"), this::exit);
+
+ mainMenu.addMenuEntry(openFileMenu);
+ mainMenu.addMenuEntry(saveFileMenu);
+ mainMenu.addMenuEntry(saveAsFileMenu);
+ mainMenu.addMenuEntry(closeFileMenu);
+ mainMenu.addMenuEntry(closeAllFilesMenu);
+ mainMenu.addMenuSeparator();
+ mainMenu.addMenuEntry(exportFlaMenu);
+ mainMenu.addMenuEntry(exportAllMenu);
+ mainMenu.addMenuEntry(exportSelMenu);
+ mainMenu.addMenuSeparator();
+ mainMenu.addMenuEntry(checkUpdatesMenu);
+ mainMenu.addMenuEntry(aboutMenu);
+ mainMenu.addFooterEntry(exitMenu);
+ mainMenu.addMenuSeparator();
+
+ return mainMenu;
+ }
+
+ private List titleResizePolicies(final JRibbonBand ribbonBand) {
+ List resizePolicies = new ArrayList<>();
+ resizePolicies.add(new BaseRibbonBandResizePolicy(ribbonBand.getControlPanel()) {
+ @Override
+ public int getPreferredWidth(int i, int i1) {
+ return ribbonBand.getGraphics().getFontMetrics(ribbonBand.getFont()).stringWidth(ribbonBand.getTitle()) + 20;
+ }
+
+ @Override
+ public void install(int i, int i1) {
+ }
+ });
+ return resizePolicies;
+ }
+
+ private List getResizePolicies(JRibbonBand ribbonBand) {
+ List resizePolicies = new ArrayList<>();
+ resizePolicies.add(new CoreRibbonResizePolicies.Mirror(ribbonBand.getControlPanel()));
+ resizePolicies.add(new IconRibbonBandResizePolicy(ribbonBand.getControlPanel()));
+ return resizePolicies;
+ }
+
+ private List getIconBandResizePolicies(JRibbonBand ribbonBand) {
+ List resizePolicies = new ArrayList<>();
+ IconRibbonBandResizePolicy iconBandResizePolicy = new IconRibbonBandResizePolicy(ribbonBand.getControlPanel());
+ final int width = Math.max(105, iconBandResizePolicy.getPreferredWidth(0, 0));
+ resizePolicies.add(new BaseRibbonBandResizePolicy(ribbonBand.getControlPanel()) {
+ @Override
+ public int getPreferredWidth(int i, int i1) {
+ return width;
+ }
+
+ @Override
+ public void install(int i, int i1) {
+ }
+ });
+ resizePolicies.add(iconBandResizePolicy);
+ return resizePolicies;
+ }
+
+ private RibbonTask createFileRibbonTask() {
+ JRibbonBand editBand = new JRibbonBand(translate("menu.general"), null);
+ editBand.setResizePolicies(getResizePolicies(editBand));
+ JCommandButton openCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.open")), View.getResizableIcon("open32"));
+ openCommandButton.addActionListener(this::open);
+ saveCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.save")), View.getResizableIcon("save32"));
+ saveCommandButton.addActionListener(this::save);
+ saveasCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.saveas")), View.getResizableIcon("saveas16"));
+ saveasCommandButton.addActionListener(this::saveAs);
+
+ reloadCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.reload")), View.getResizableIcon("reload16"));
+ reloadCommandButton.addActionListener(this::reload);
+
+ saveasexeCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.saveasexe")), View.getResizableIcon("saveasexe16"));
+ saveasexeCommandButton.addActionListener(this::saveAsExe);;
+
+ editBand.addCommandButton(openCommandButton, RibbonElementPriority.TOP);
+ editBand.addCommandButton(saveCommandButton, RibbonElementPriority.TOP);
+ editBand.addCommandButton(saveasCommandButton, RibbonElementPriority.MEDIUM);
+ editBand.addCommandButton(saveasexeCommandButton, RibbonElementPriority.MEDIUM);
+ editBand.addCommandButton(reloadCommandButton, RibbonElementPriority.MEDIUM);
+
+ JRibbonBand exportBand = new JRibbonBand(translate("menu.export"), null);
+ exportBand.setResizePolicies(getResizePolicies(exportBand));
+ exportFlaCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.fla")), View.getResizableIcon("exportfla32"));
+ exportFlaCommandButton.addActionListener(this::exportFla);
+ exportAllCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.all")), View.getResizableIcon("export16"));
+ exportAllCommandButton.addActionListener(this::exportAll);
+ exportSelectionCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.selection")), View.getResizableIcon("exportsel16"));
+ exportSelectionCommandButton.addActionListener(this::exportSelected);
+
+ exportXmlCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.export.xml")), View.getResizableIcon("exportxml32"));
+ exportXmlCommandButton.addActionListener(this::exportSwfXml);
+
+ exportBand.addCommandButton(exportFlaCommandButton, RibbonElementPriority.TOP);
+ 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"));
+ importTextCommandButton.addActionListener(this::importText);
+
+ // todo: icon
+ importScriptCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.script")), View.getResizableIcon("importtext32"));
+ importScriptCommandButton.addActionListener(this::importScript);
+
+ importSymbolClassCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.symbolClass")), View.getResizableIcon("importsymbolclass32"));
+ importSymbolClassCommandButton.addActionListener(this::importSymbolClass);
+
+ importXmlCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.import.xml")), View.getResizableIcon("importxml32"));
+ importXmlCommandButton.addActionListener(this::importSwfXml);
+
+ importBand.addCommandButton(importXmlCommandButton, RibbonElementPriority.TOP);
+ importBand.addCommandButton(importTextCommandButton, RibbonElementPriority.MEDIUM);
+ importBand.addCommandButton(importScriptCommandButton, RibbonElementPriority.MEDIUM);
+ importBand.addCommandButton(importSymbolClassCommandButton, RibbonElementPriority.MEDIUM);
+
+ JRibbonBand viewBand = new JRibbonBand(translate("menu.view"), null);
+ viewBand.setResizePolicies(getResizePolicies(viewBand));
+
+ viewModeToggleGroup = new CommandToggleButtonGroup();
+
+ viewModeResourcesToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.view.resources")), View.getResizableIcon("viewresources16"));
+ viewModeResourcesToggleButton.addActionListener(this::viewModeResouresButtonActionPerformed);
+
+ viewModeHexToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.view.hex")), View.getResizableIcon("viewhex16"));
+ viewModeHexToggleButton.addActionListener(this::viewModeHexDumpButtonActionPerformed);
+
+ viewModeToggleGroup.add(viewModeResourcesToggleButton);
+ viewModeToggleGroup.add(viewModeHexToggleButton);
+
+ if (Configuration.dumpView.get()) {
+ viewModeToggleGroup.setSelected(viewModeHexToggleButton, true);
+ } else {
+ viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, true);
+ }
+
+ viewBand.addCommandButton(viewModeResourcesToggleButton, RibbonElementPriority.MEDIUM);
+ viewBand.addCommandButton(viewModeHexToggleButton, RibbonElementPriority.MEDIUM);
+
+ return new RibbonTask(translate("menu.file"), editBand, exportBand, importBand, viewBand);
+ }
+
+ private RibbonTask createToolsRibbonTask() {
+
+ JRibbonBand debuggerBand = new JRibbonBand(translate("menu.debugger"), null);
+ debuggerBand.setResizePolicies(getResizePolicies(debuggerBand));
+
+ debuggerSwitchCommandButton = new JCommandToggleButton(translate("menu.debugger.switch"), View.getResizableIcon("debugger32"));
+ debuggerSwitchCommandButton.addActionListener(this::debuggerSwitchButtonActionPerformed);
+
+ debuggerReplaceTraceCommandButton = new JCommandButton(translate("menu.debugger.replacetrace"), View.getResizableIcon("debuggerreplace16"));
+ debuggerReplaceTraceCommandButton.addActionListener(this::debuggerReplaceTraceCalls);
+
+ debuggerLogCommandButton = new JCommandButton(translate("menu.debugger.showlog"), View.getResizableIcon("debuggerlog16"));
+ debuggerLogCommandButton.addActionListener(this::debuggerShowLog);
+
+ debuggerSwitchGroup = new CommandToggleButtonGroup();
+ debuggerSwitchGroup.add(debuggerSwitchCommandButton);
+
+ debuggerSwitchCommandButton.setEnabled(false);
+
+ debuggerReplaceTraceCommandButton.setEnabled(false);
+
+ debuggerBand.addCommandButton(debuggerSwitchCommandButton, RibbonElementPriority.TOP);
+ debuggerBand.addCommandButton(debuggerReplaceTraceCommandButton, RibbonElementPriority.MEDIUM);
+ debuggerBand.addCommandButton(debuggerLogCommandButton, RibbonElementPriority.MEDIUM);
+
+ // ----------------------------------------- TOOLS -----------------------------------
+ JRibbonBand toolsBand = new JRibbonBand(translate("menu.tools"), null);
+ toolsBand.setResizePolicies(getResizePolicies(toolsBand));
+
+ searchCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.search")), View.getResizableIcon("search32"));
+ searchCommandButton.addActionListener((ActionEvent e) -> {
+ search(e, null);
+ });
+
+ replaceCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.replace")), View.getResizableIcon("replace32"));
+ replaceCommandButton.addActionListener(this::replace);
+
+ timeLineToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.tools.timeline")), View.getResizableIcon("timeline32"));
+ timeLineToggleButton.addActionListener(this::timelineButtonActionPerformed);
+
+ timeLineToggleGroup = new CommandToggleButtonGroup();
+ timeLineToggleGroup.add(timeLineToggleButton);
+
+ gotoDocumentClassCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.gotodocumentclass")), View.getResizableIcon("gotomainclass32"));
+ gotoDocumentClassCommandButton.addActionListener(this::gotoDucumentClass);
+
+ JCommandButton proxyCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.proxy")), View.getResizableIcon("proxy16"));
+ proxyCommandButton.addActionListener(this::showProxy);
+
+ JCommandButton loadMemoryCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.searchmemory")), View.getResizableIcon("loadmemory16"));
+ loadMemoryCommandButton.addActionListener(this::loadFromMemory);
+
+ JCommandButton loadCacheCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.searchcache")), View.getResizableIcon("loadcache16"));
+ loadCacheCommandButton.addActionListener(this::loadFromCache);
+
+ toolsBand.addCommandButton(searchCommandButton, RibbonElementPriority.TOP);
+ toolsBand.addCommandButton(replaceCommandButton, RibbonElementPriority.TOP);
+ toolsBand.addCommandButton(timeLineToggleButton, RibbonElementPriority.TOP);
+ toolsBand.addCommandButton(gotoDocumentClassCommandButton, RibbonElementPriority.TOP);
+ toolsBand.addCommandButton(proxyCommandButton, RibbonElementPriority.MEDIUM);
+ toolsBand.addCommandButton(loadMemoryCommandButton, RibbonElementPriority.MEDIUM);
+ toolsBand.addCommandButton(loadCacheCommandButton, RibbonElementPriority.MEDIUM);
+ if (!ProcessTools.toolsAvailable()) {
+ loadMemoryCommandButton.setEnabled(false);
+ }
+ JRibbonBand deobfuscationBand = new JRibbonBand(translate("menu.tools.deobfuscation"), null);
+ deobfuscationBand.setResizePolicies(getResizePolicies(deobfuscationBand));
+
+ deobfuscationCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.deobfuscation.pcode")), View.getResizableIcon("deobfuscate32"));
+ deobfuscationCommandButton.addActionListener(this::deobfuscate);
+ globalRenameCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.deobfuscation.globalrename")), View.getResizableIcon("rename16"));
+ globalRenameCommandButton.addActionListener(this::renameOneIdentifier);
+ renameInvalidCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.deobfuscation.renameinvalid")), View.getResizableIcon("renameall16"));
+ renameInvalidCommandButton.addActionListener(this::renameIdentifiers);
+
+ deobfuscationBand.addCommandButton(deobfuscationCommandButton, RibbonElementPriority.TOP);
+ deobfuscationBand.addCommandButton(globalRenameCommandButton, RibbonElementPriority.MEDIUM);
+ deobfuscationBand.addCommandButton(renameInvalidCommandButton, RibbonElementPriority.MEDIUM);
+
+ //JRibbonBand otherToolsBand = new JRibbonBand(translate("menu.tools.otherTools"), null);
+ //otherToolsBand.setResizePolicies(getResizePolicies(otherToolsBand));
+ return new RibbonTask(translate("menu.tools"), toolsBand, deobfuscationBand, debuggerBand /*, otherToolsBand*/);
+ }
+
+ private RibbonTask createSettingsRibbonTask(boolean externalFlashPlayerUnavailable) {
+ // ----------------------------------------- SETTINGS -----------------------------------
+
+ JRibbonBand settingsBand = new JRibbonBand(translate("menu.settings"), null);
+ settingsBand.setResizePolicies(getResizePolicies(settingsBand));
+
+ miAutoDeobfuscation = new JCheckBox(translate("menu.settings.autodeobfuscation"));
+ miAutoDeobfuscation.setSelected(Configuration.autoDeobfuscate.get());
+ miAutoDeobfuscation.addActionListener(this::autoDeobfuscate);
+
+ miInternalViewer = new JCheckBox(translate("menu.settings.internalflashviewer"));
+ miInternalViewer.setSelected(Configuration.internalFlashViewer.get() || externalFlashPlayerUnavailable);
+ if (externalFlashPlayerUnavailable) {
+ miInternalViewer.setEnabled(false);
+ }
+ miInternalViewer.addActionListener(this::internalViewerSwitch);
+
+ miParallelSpeedUp = new JCheckBox(translate("menu.settings.parallelspeedup"));
+ miParallelSpeedUp.setSelected(Configuration.parallelSpeedUp.get());
+ miParallelSpeedUp.addActionListener(this::parallelSpeedUp);
+
+ miDecompile = new JCheckBox(translate("menu.settings.disabledecompilation"));
+ miDecompile.setSelected(!Configuration.decompile.get());
+ miDecompile.addActionListener(this::disableDecompilation);
+
+ miAssociate = new JCheckBox(translate("menu.settings.addtocontextmenu"));
+ miAssociate.addActionListener(this::associate);
+ miAssociate.setSelected(ContextMenuTools.isAddedToContextMenu());
+
+ miCacheDisk = new JCheckBox(translate("menu.settings.cacheOnDisk"));
+ miCacheDisk.setSelected(Configuration.cacheOnDisk.get());
+ miCacheDisk.addActionListener(this::cacheOnDisk);
+
+ miGotoMainClassOnStartup = new JCheckBox(translate("menu.settings.gotoMainClassOnStartup"));
+ miGotoMainClassOnStartup.setSelected(Configuration.gotoMainClassOnStartup.get());
+ miGotoMainClassOnStartup.addActionListener(this::gotoDucumentClassOnStartup);
+
+ miAutoRenameIdentifiers = new JCheckBox(translate("menu.settings.autoRenameIdentifiers"));
+ miAutoRenameIdentifiers.setSelected(Configuration.autoRenameIdentifiers.get());
+ miAutoRenameIdentifiers.addActionListener(this::autoRenameIdentifiers);
+
+ settingsBand.addRibbonComponent(new JRibbonComponent(miAutoDeobfuscation));
+ settingsBand.addRibbonComponent(new JRibbonComponent(miInternalViewer));
+ settingsBand.addRibbonComponent(new JRibbonComponent(miParallelSpeedUp));
+ settingsBand.addRibbonComponent(new JRibbonComponent(miDecompile));
+ if (Platform.isWindows()) {
+ settingsBand.addRibbonComponent(new JRibbonComponent(miAssociate));
+ }
+ settingsBand.addRibbonComponent(new JRibbonComponent(miCacheDisk));
+ settingsBand.addRibbonComponent(new JRibbonComponent(miGotoMainClassOnStartup));
+ settingsBand.addRibbonComponent(new JRibbonComponent(miAutoRenameIdentifiers));
+
+ JRibbonBand languageBand = new JRibbonBand(translate("menu.language"), null);
+ List languageBandResizePolicies = getIconBandResizePolicies(languageBand);
+ languageBand.setResizePolicies(languageBandResizePolicies);
+ JCommandButton setLanguageCommandButton = new JCommandButton(fixCommandTitle(translate("menu.settings.language")), View.getResizableIcon("setlanguage32"));
+ setLanguageCommandButton.addActionListener(this::setLanguage);
+ languageBand.addCommandButton(setLanguageCommandButton, RibbonElementPriority.TOP);
+
+ JRibbonBand advancedSettingsBand = new JRibbonBand(translate("menu.advancedsettings.advancedsettings"), null);
+ advancedSettingsBand.setResizePolicies(getResizePolicies(advancedSettingsBand));
+ JCommandButton advancedSettingsCommandButton = new JCommandButton(fixCommandTitle(translate("menu.advancedsettings.advancedsettings")), View.getResizableIcon("settings32"));
+ advancedSettingsCommandButton.addActionListener(this::advancedSettings);
+ advancedSettingsBand.addCommandButton(advancedSettingsCommandButton, RibbonElementPriority.TOP);
+
+ clearRecentFilesCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.otherTools.clearRecentFiles")), View.getResizableIcon("clearrecent16"));
+ clearRecentFilesCommandButton.addActionListener(this::clearRecentFiles);
+ advancedSettingsBand.addCommandButton(clearRecentFilesCommandButton, RibbonElementPriority.MEDIUM);
+
+ JRibbonBand deobfuscationBand = new JRibbonBand(translate("menu.deobfuscation"), null);
+ deobfuscationBand.setResizePolicies(titleResizePolicies(deobfuscationBand));
+
+ CommandToggleButtonGroup grpDeobfuscation = new CommandToggleButtonGroup();
+
+ deobfuscationModeOldToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.deobfuscation.old")), View.getResizableIcon("deobfuscateold16"));
+ deobfuscationModeOldToggleButton.addActionListener((ActionEvent e) -> {
+ deobfuscationMode(e, 0);
+ });
+
+ deobfuscationModeNewToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.deobfuscation.new")), View.getResizableIcon("deobfuscatenew16"));
+ deobfuscationModeNewToggleButton.addActionListener((ActionEvent e) -> {
+ deobfuscationMode(e, 1);
+ });
+
+ grpDeobfuscation.add(deobfuscationModeOldToggleButton);
+ grpDeobfuscation.add(deobfuscationModeNewToggleButton);
+
+ int deobfuscationMode = Configuration.deobfuscationMode.get();
+ switch (deobfuscationMode) {
+ case 0:
+ grpDeobfuscation.setSelected(deobfuscationModeOldToggleButton, true);
+ break;
+ case 1:
+ grpDeobfuscation.setSelected(deobfuscationModeNewToggleButton, true);
+ break;
+ }
+
+ deobfuscationBand.addCommandButton(deobfuscationModeOldToggleButton, RibbonElementPriority.MEDIUM);
+ deobfuscationBand.addCommandButton(deobfuscationModeNewToggleButton, RibbonElementPriority.MEDIUM);
+
+ return new RibbonTask(translate("menu.settings"), settingsBand, languageBand, advancedSettingsBand, deobfuscationBand);
+ }
+
+ private RibbonTask createHelpRibbonTask() {
+ // ----------------------------------------- HELP -----------------------------------
+
+ JRibbonBand helpBand = new JRibbonBand(translate("menu.help"), null);
+ helpBand.setResizePolicies(getResizePolicies(helpBand));
+
+ JCommandButton checkForUpdatesCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.checkupdates")), View.getResizableIcon("update16"));
+ checkForUpdatesCommandButton.addActionListener(this::checkUpdates);
+ JCommandButton helpUsUpdatesCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.helpus")), View.getResizableIcon("donate32"));
+ helpUsUpdatesCommandButton.addActionListener(this::helpUs);
+ JCommandButton homepageCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.homepage")), View.getResizableIcon("homepage16"));
+ homepageCommandButton.addActionListener(this::homePage);
+ JCommandButton aboutCommandButton = new JCommandButton(fixCommandTitle(translate("menu.help.about")), View.getResizableIcon("about32"));
+ aboutCommandButton.addActionListener(this::about);
+
+ helpBand.addCommandButton(aboutCommandButton, RibbonElementPriority.TOP);
+ helpBand.addCommandButton(checkForUpdatesCommandButton, RibbonElementPriority.MEDIUM);
+ helpBand.addCommandButton(homepageCommandButton, RibbonElementPriority.MEDIUM);
+ helpBand.addCommandButton(helpUsUpdatesCommandButton, RibbonElementPriority.TOP);
+ return new RibbonTask(translate("menu.help"), helpBand);
+ }
+
+ private RibbonTask createDebugRibbonTask() {
+ // ----------------------------------------- DEBUG -----------------------------------
+
+ ResizableIcon icon = View.getResizableIcon("update16");
+ JRibbonBand debugBand = new JRibbonBand("Debug", null);
+ debugBand.setResizePolicies(getResizePolicies(debugBand));
+
+ JCommandButton removeNonScriptsCommandButton = new JCommandButton(fixCommandTitle("Remove non scripts"), icon);
+ removeNonScriptsCommandButton.addActionListener(e -> removeNonScripts());
+
+ JCommandButton refreshDecompiledCommandButton = new JCommandButton(fixCommandTitle("Refresh decompiled script"), icon);
+ refreshDecompiledCommandButton.addActionListener(e -> refreshDecompiled());
+
+ JCommandButton checkResourcesCommandButton = new JCommandButton(fixCommandTitle("Check resources"), icon);
+ checkResourcesCommandButton.addActionListener(e -> checkResources());
+
+ JCommandButton callGcCommandButton = new JCommandButton(fixCommandTitle("Call System.gc()"), icon);
+ callGcCommandButton.addActionListener(e -> System.gc());
+
+ JCommandButton emptyCacheCommandButton = new JCommandButton(fixCommandTitle("Empty cache"), icon);
+ emptyCacheCommandButton.addActionListener(e -> {
+ SWF swf = mainFrame.getPanel().getCurrentSwf();
+ if (swf != null) {
+ swf.clearAllCache();
+ }
+ });
+
+ JCommandButton memoryInformationCommandButton = new JCommandButton(fixCommandTitle("Memory information"), icon);
+ memoryInformationCommandButton.addActionListener(e -> {
+ String architecture = System.getProperty("sun.arch.data.model");
+ Runtime runtime = Runtime.getRuntime();
+ String info = "Architecture: " + architecture + Helper.newLine
+ + "Max: " + (runtime.maxMemory() / 1024 / 1024) + "MB" + Helper.newLine
+ + "Used: " + (runtime.totalMemory() / 1024 / 1024) + "MB" + Helper.newLine
+ + "Free: " + (runtime.freeMemory() / 1024 / 1024) + "MB";
+ View.showMessageDialog(null, info);
+ SWF swf = mainFrame.getPanel().getCurrentSwf();
+ if (swf != null) {
+ swf.clearAllCache();
+ }
+ });
+
+ JCommandButton fixAs3CodeCommandButton = new JCommandButton(fixCommandTitle("Fix AS3 code"), icon);
+ fixAs3CodeCommandButton.addActionListener(e -> {
+ SWF swf = mainFrame.getPanel().getCurrentSwf();
+ if (swf != null) {
+ swf.fixAS3Code();
+ }
+ });
+
+ debugBand.addCommandButton(removeNonScriptsCommandButton, RibbonElementPriority.MEDIUM);
+ debugBand.addCommandButton(refreshDecompiledCommandButton, RibbonElementPriority.MEDIUM);
+ debugBand.addCommandButton(checkResourcesCommandButton, RibbonElementPriority.MEDIUM);
+ debugBand.addCommandButton(callGcCommandButton, RibbonElementPriority.MEDIUM);
+ debugBand.addCommandButton(emptyCacheCommandButton, RibbonElementPriority.MEDIUM);
+ debugBand.addCommandButton(memoryInformationCommandButton, RibbonElementPriority.MEDIUM);
+ debugBand.addCommandButton(fixAs3CodeCommandButton, RibbonElementPriority.MEDIUM);
+ return new RibbonTask("Debug", debugBand);
+ }
+
+ @Override
+ public void updateComponents(SWF swf) {
+ super.updateComponents(swf);
+ boolean swfLoaded = swf != null;
+ List abcList = swfLoaded ? swf.getAbcList() : null;
+ boolean hasAbc = swfLoaded && abcList != null && !abcList.isEmpty();
+ boolean hasDebugger = hasAbc && DebuggerTools.hasDebugger(swf);
+
+ exportAllMenu.setEnabled(swfLoaded);
+ exportFlaMenu.setEnabled(swfLoaded);
+ exportSelMenu.setEnabled(swfLoaded);
+ saveFileMenu.setEnabled(swfLoaded);
+ saveAsFileMenu.setEnabled(swfLoaded);
+ closeFileMenu.setEnabled(swfLoaded);
+ closeAllFilesMenu.setEnabled(swfLoaded);
+
+ boolean isBundle = swfLoaded && (swf.swfList != null) && (swf.swfList.isBundle());
+ saveCommandButton.setEnabled(swfLoaded && ((!isBundle) || (!swf.swfList.bundle.isReadOnly())));
+ saveasCommandButton.setEnabled(swfLoaded);
+ saveasexeCommandButton.setEnabled(swfLoaded);
+ exportAllCommandButton.setEnabled(swfLoaded);
+ exportFlaCommandButton.setEnabled(swfLoaded);
+ exportXmlCommandButton.setEnabled(swfLoaded);
+ exportSelectionCommandButton.setEnabled(swfLoaded);
+ importTextCommandButton.setEnabled(swfLoaded);
+ importScriptCommandButton.setEnabled(swfLoaded);
+ importSymbolClassCommandButton.setEnabled(swfLoaded);
+ importXmlCommandButton.setEnabled(swfLoaded);
+ reloadCommandButton.setEnabled(swfLoaded);
+
+ renameInvalidCommandButton.setEnabled(swfLoaded);
+ globalRenameCommandButton.setEnabled(swfLoaded);
+ deobfuscationCommandButton.setEnabled(swfLoaded);
+ searchCommandButton.setEnabled(swfLoaded);
+ replaceCommandButton.setEnabled(swfLoaded);
+ timeLineToggleButton.setEnabled(swfLoaded);
+
+ gotoDocumentClassCommandButton.setEnabled(hasAbc);
+ deobfuscationCommandButton.setEnabled(hasAbc);
+ debuggerSwitchCommandButton.setEnabled(hasAbc);
+ debuggerSwitchGroup.setSelected(debuggerSwitchCommandButton, hasDebugger);
+ debuggerReplaceTraceCommandButton.setEnabled(hasAbc && hasDebugger);
+ }
+
+ private void debuggerSwitchButtonActionPerformed(ActionEvent evt) {
+ if (debuggerSwitchGroup.getSelected() == null || View.showConfirmDialog(mainFrame, translate("message.debugger"), translate("dialog.message.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, Configuration.displayDebuggerInfo, JOptionPane.OK_OPTION) == JOptionPane.OK_OPTION) {
+ switchDebugger();
+ mainFrame.getPanel().refreshDecompiled();
+ } else {
+ if (debuggerSwitchGroup.getSelected() == debuggerSwitchCommandButton) {
+ debuggerSwitchGroup.setSelected(debuggerSwitchCommandButton, false);
+ }
+ }
+ debuggerReplaceTraceCommandButton.setEnabled(debuggerSwitchGroup.getSelected() == debuggerSwitchCommandButton);
+ }
+
+ private void viewModeResouresButtonActionPerformed(ActionEvent evt) {
+ Configuration.dumpView.set(false);
+ mainFrame.getPanel().showView(MainPanel.VIEW_RESOURCES);
+ timeLineToggleGroup.setSelected(timeLineToggleButton, false);
+ viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, true);
+ }
+
+ private void viewModeHexDumpButtonActionPerformed(ActionEvent evt) {
+ Configuration.dumpView.set(true);
+ mainFrame.getPanel().showView(MainPanel.VIEW_DUMP);
+ timeLineToggleGroup.setSelected(timeLineToggleButton, false);
+ viewModeToggleGroup.setSelected(viewModeHexToggleButton, true);
+ }
+
+ private void timelineButtonActionPerformed(ActionEvent evt) {
+ timeLineToggleGroup.setSelected(timeLineToggleButton, timeLineToggleGroup.getSelected() == timeLineToggleButton);
+ if (timeLineToggleGroup.getSelected() == timeLineToggleButton) {
+ if (!mainFrame.getPanel().showView(MainPanel.VIEW_TIMELINE)) {
+ timeLineToggleGroup.setSelected(timeLineToggleButton, false);
+ } else {
+ viewModeToggleGroup.setSelected(viewModeHexToggleButton, false);
+ viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, false);
+ }
+ } else {
+ if (Configuration.dumpView.get()) {
+ viewModeToggleGroup.setSelected(viewModeHexToggleButton, true);
+ mainFrame.getPanel().showView(MainPanel.VIEW_DUMP);
+ } else {
+ viewModeToggleGroup.setSelected(viewModeResourcesToggleButton, true);
+ mainFrame.getPanel().showView(MainPanel.VIEW_RESOURCES);
+ }
+ }
+ }
+}
diff --git a/src/com/jpexs/decompiler/flash/gui/View.java b/src/com/jpexs/decompiler/flash/gui/View.java
index 3444fa4ee..ff9a99087 100644
--- a/src/com/jpexs/decompiler/flash/gui/View.java
+++ b/src/com/jpexs/decompiler/flash/gui/View.java
@@ -29,6 +29,7 @@ import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.Rectangle;
+import java.awt.SystemColor;
import java.awt.TexturePaint;
import java.awt.Window;
import java.awt.event.ActionEvent;
@@ -100,13 +101,11 @@ import org.pushingpixels.substance.internal.utils.SubstanceColorSchemeUtilities;
*/
public class View {
- private static final Color DEFAULT_BACKGROUND_COLOR = new Color(217, 231, 250);
-
public static Color getDefaultBackgroundColor() {
if (Configuration.useRibbonInterface.get()) {
return SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getBackgroundFillColor();
} else {
- return DEFAULT_BACKGROUND_COLOR;
+ return SystemColor.control;
}
}
@@ -345,6 +344,14 @@ public class View {
f.setLocation(windowPosX, windowPosY);
}
+ public static ImageIcon getIcon(String name, int size) {
+ ImageIcon icon = getIcon(name);
+ icon.getImage();
+ BufferedImage bi = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);
+ bi.createGraphics().drawImage(icon.getImage(), 0, 0, size, size, null, null);
+ return new ImageIcon(bi);
+ }
+
public static ImageIcon getIcon(String name) {
return new ImageIcon(View.class.getClassLoader().getResource("com/jpexs/decompiler/flash/gui/graphics/" + name + ".png"));
}
diff --git a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java
index af102a6aa..fc70ef31c 100644
--- a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineBodyPanel.java
@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.gui.timeline;
+import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
import com.jpexs.decompiler.flash.timeline.DepthState;
@@ -27,6 +28,7 @@ import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
+import java.awt.SystemColor;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
@@ -34,6 +36,11 @@ import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
+import org.pushingpixels.substance.api.ColorSchemeAssociationKind;
+import org.pushingpixels.substance.api.ComponentState;
+import org.pushingpixels.substance.api.DecorationAreaType;
+import org.pushingpixels.substance.api.SubstanceLookAndFeel;
+import org.pushingpixels.substance.internal.utils.SubstanceColorUtilities;
/**
*
@@ -47,12 +54,9 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
public static final Color shapeTweenColor = new Color(0xd1, 0xac, 0xf1);
- public static final Color frameColor = new Color(0xbd, 0xd8, 0xfc);
-
- public static final Color emptyFrameColor = Color.white;
-
- public static final Color emptyFrameSecondColor = new Color(0xea, 0xf2, 0xfc);
-
+ //public static final Color frameColor = new Color(0xbd, 0xd8, 0xfc);
+ //public static final Color emptyFrameColor = Color.white;
+ //public static final Color emptyFrameSecondColor = new Color(0xea, 0xf2, 0xfc);
public static final Color borderColor = Color.black;
public static final Color emptyBorderColor = new Color(0xbd, 0xd8, 0xfc);
@@ -67,8 +71,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
public static final Color borderLinesColor = new Color(0xde, 0xde, 0xde);
- public static final Color selectedColor = new Color(113, 174, 235);
-
+ //public static final Color selectedColor = new Color(113, 174, 235);
public static final int borderLinesLength = 2;
public static final float fontSize = 10.0f;
@@ -77,6 +80,34 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
public Point cursor = null;
+ public static Color getEmptyFrameColor() {
+ return SubstanceColorUtilities.getLighterColor(getControlColor(), 0.7);
+ }
+
+ public static Color getEmptyFrameSecondColor() {
+ return SubstanceColorUtilities.getLighterColor(getControlColor(), 0.9);
+ }
+
+ public static Color getSelectedColor() {
+ if (Configuration.useRibbonInterface.get()) {
+ return SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).getBackgroundFillColor();
+ } else {
+ return SystemColor.textHighlight;
+ }
+ }
+
+ private static Color getControlColor() {
+ if (Configuration.useRibbonInterface.get()) {
+ return SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getBackgroundFillColor();
+ } else {
+ return SystemColor.control;
+ }
+ }
+
+ public static Color getFrameColor() {
+ return SubstanceColorUtilities.getDarkerColor(getControlColor(), 0.1);
+ }
+
public void addFrameSelectionListener(FrameSelectionListener l) {
listeners.add(l);
}
@@ -103,7 +134,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g.setColor(TimelinePanel.backgroundColor);
+ g.setColor(TimelinePanel.getBackgroundColor());
g.fillRect(0, 0, getWidth(), getHeight());
Rectangle clip = g.getClipBounds();
int start_f = clip.x / TimelinePanel.FRAME_WIDTH;
@@ -131,9 +162,9 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
DepthState fl = timeline.getFrame(f).layers.get(d);
if (fl == null) {
if ((f + 1) % 5 == 0) {
- g.setColor(emptyFrameSecondColor);
+ g.setColor(getEmptyFrameSecondColor());
} else {
- g.setColor(emptyFrameColor);
+ g.setColor(getEmptyFrameColor());
}
g.fillRect(f * TimelinePanel.FRAME_WIDTH, d * TimelinePanel.FRAME_HEIGHT, TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT);
g.setColor(emptyBorderColor);
@@ -173,7 +204,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
}
if (selected) {
//if (!(fl != null && (flNext == null || flNext.key))) {
- g.setColor(selectedColor);
+ g.setColor(getSelectedColor());
g.fillRect(f * TimelinePanel.FRAME_WIDTH + 1, d * TimelinePanel.FRAME_HEIGHT + 1, TimelinePanel.FRAME_WIDTH - 1, TimelinePanel.FRAME_HEIGHT - 1);
//}
}
@@ -208,13 +239,13 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
}
num_frames++;
}
- g.setColor(emptyFrameColor);
+ g.setColor(getEmptyFrameColor());
g.fillRect(draw_f * TimelinePanel.FRAME_WIDTH, d * TimelinePanel.FRAME_HEIGHT, num_frames * TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT);
g.setColor(borderColor);
g.drawRect(draw_f * TimelinePanel.FRAME_WIDTH, d * TimelinePanel.FRAME_HEIGHT, num_frames * TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT);
if (selected) {
- g.setColor(selectedColor);
+ g.setColor(getSelectedColor());
g.fillRect(draw_f * TimelinePanel.FRAME_WIDTH, d * TimelinePanel.FRAME_HEIGHT, TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT);
}
@@ -223,7 +254,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
if (num_frames > 1) {
if (cursor != null && cursor.y == d && cursor.x == f + num_frames - 1) {
- g.setColor(selectedColor);
+ g.setColor(getSelectedColor());
g.fillRect((f + num_frames - 1) * TimelinePanel.FRAME_WIDTH + 1, d * TimelinePanel.FRAME_HEIGHT + 1, TimelinePanel.FRAME_WIDTH - 1, TimelinePanel.FRAME_HEIGHT - 1);
}
@@ -281,7 +312,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
}
num_frames++;
}
- g.setColor(frameColor);
+ g.setColor(getFrameColor());
g.fillRect(draw_f * TimelinePanel.FRAME_WIDTH, d * TimelinePanel.FRAME_HEIGHT, num_frames * TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT);
if (motionTween) {
@@ -294,7 +325,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
}
if (selected) {
- g.setColor(selectedColor);
+ g.setColor(getSelectedColor());
g.fillRect(draw_f * TimelinePanel.FRAME_WIDTH, d * TimelinePanel.FRAME_HEIGHT, TimelinePanel.FRAME_WIDTH, TimelinePanel.FRAME_HEIGHT);
}
@@ -314,7 +345,7 @@ public class TimelineBodyPanel extends JPanel implements MouseListener, KeyListe
if (num_frames > 1) {
if (cursor != null && cursor.y == d && cursor.x == f + num_frames - 1) {
- g.setColor(selectedColor);
+ g.setColor(getSelectedColor());
g.fillRect((f + num_frames - 1) * TimelinePanel.FRAME_WIDTH + 1, d * TimelinePanel.FRAME_HEIGHT + 1, TimelinePanel.FRAME_WIDTH - 1, TimelinePanel.FRAME_HEIGHT - 1);
}
diff --git a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineDepthPanel.java b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineDepthPanel.java
index f24e196d2..d3768f11c 100644
--- a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineDepthPanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineDepthPanel.java
@@ -63,7 +63,7 @@ public class TimelineDepthPanel extends JPanel {
int start_d = (scrollOffset + clip.y) / TimelinePanel.FRAME_HEIGHT;
int end_d = (scrollOffset + clip.y + clip.height) / TimelinePanel.FRAME_HEIGHT;
int d_count = end_d - start_d;
- g.setColor(TimelinePanel.backgroundColor);
+ g.setColor(TimelinePanel.getBackgroundColor());
g.fillRect(0, 0, getWidth(), getHeight());
for (int d = 0; d < d_count; d++) {
g.setColor(borderColor);
diff --git a/src/com/jpexs/decompiler/flash/gui/timeline/TimelinePanel.java b/src/com/jpexs/decompiler/flash/gui/timeline/TimelinePanel.java
index 5348cb883..97ffcb616 100644
--- a/src/com/jpexs/decompiler/flash/gui/timeline/TimelinePanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/timeline/TimelinePanel.java
@@ -16,15 +16,21 @@
*/
package com.jpexs.decompiler.flash.gui.timeline;
+import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.timeline.Timeline;
import com.jpexs.decompiler.flash.timeline.Timelined;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
+import java.awt.SystemColor;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
+import org.pushingpixels.substance.api.ColorSchemeAssociationKind;
+import org.pushingpixels.substance.api.ComponentState;
+import org.pushingpixels.substance.api.DecorationAreaType;
+import org.pushingpixels.substance.api.SubstanceLookAndFeel;
/**
*
@@ -48,7 +54,14 @@ public class TimelinePanel extends JPanel {
public static final Color selectedBorderColor = new Color(0xcc, 0, 0);
- public static final Color backgroundColor = new Color(0xd9, 0xe7, 0xfa);
+ //public static final Color backgroundColor = new Color(0xd9, 0xe7, 0xfa);
+ public static Color getBackgroundColor() {
+ if (Configuration.useRibbonInterface.get()) {
+ return SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.GENERAL, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getBackgroundFillColor();
+ } else {
+ return SystemColor.control;
+ }
+ }
public Timeline getTimeline() {
return timeline;
@@ -81,7 +94,7 @@ public class TimelinePanel extends JPanel {
JPanel row1Panel = new JPanel();
row1Panel.setLayout(new BorderLayout());
JPanel sepPanel = new JPanel();
- sepPanel.setBackground(TimelinePanel.backgroundColor);
+ sepPanel.setBackground(getBackgroundColor());
sepPanel.setPreferredSize(new Dimension(depthPanel.getWidth(), timePanel.getHeight()));
row1Panel.add(sepPanel, BorderLayout.WEST);
row1Panel.add(timePanel, BorderLayout.CENTER);
diff --git a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineTimePanel.java b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineTimePanel.java
index 9582b7ad2..5b733099c 100644
--- a/src/com/jpexs/decompiler/flash/gui/timeline/TimelineTimePanel.java
+++ b/src/com/jpexs/decompiler/flash/gui/timeline/TimelineTimePanel.java
@@ -84,7 +84,7 @@ public class TimelineTimePanel extends JPanel implements MouseListener {
Rectangle clip = g.getClipBounds();
int start_f = (scrollOffset + clip.x) / TimelinePanel.FRAME_WIDTH;
int end_f = (scrollOffset + clip.x + clip.width) / TimelinePanel.FRAME_WIDTH;
- g.setColor(TimelinePanel.backgroundColor);
+ g.setColor(TimelinePanel.getBackgroundColor());
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(borderColor);
int xofs = TimelinePanel.FRAME_WIDTH - scrollOffset % TimelinePanel.FRAME_WIDTH - 1;