Improved nonribbon interface (menu, colors)

This commit is contained in:
Jindra Petřík
2015-05-23 10:26:04 +02:00
parent 3fdc0ec946
commit dd888dd326
9 changed files with 1500 additions and 1138 deletions

View File

@@ -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);
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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<SubstanceConstants.Side> 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 <http://www.gnu.org/licenses/>.
*/
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<SubstanceConstants.Side> 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);
}
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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<ABCContainerTag> 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 <http://www.gnu.org/licenses/>.
*/
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<String> 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<ABCContainerTag> 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);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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"));
}

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;