mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 01:41:17 +00:00
java code format
This commit is contained in:
@@ -60,8 +60,7 @@ public class HeaderInfoPanel extends JPanel {
|
||||
add(displayRectTwipsLabel);
|
||||
add(new JLabel(""));
|
||||
add(displayRectPixelsLabel);
|
||||
|
||||
|
||||
|
||||
SpringUtilities.makeCompactGrid(this,
|
||||
9, 2, //rows, cols
|
||||
6, 6, //initX, initY
|
||||
@@ -87,22 +86,23 @@ public class HeaderInfoPanel extends JPanel {
|
||||
frameRateLabel.setText("" + swf.frameRate);
|
||||
frameCountLabel.setText("" + swf.frameCount);
|
||||
displayRectTwipsLabel.setText(AppStrings.translate("header.displayrect.value.twips")
|
||||
.replace("%xmin%", ""+swf.displayRect.Xmin)
|
||||
.replace("%ymin%", ""+swf.displayRect.Ymin)
|
||||
.replace("%xmax%", ""+swf.displayRect.Xmax)
|
||||
.replace("%ymax%", ""+swf.displayRect.Ymax));
|
||||
.replace("%xmin%", "" + swf.displayRect.Xmin)
|
||||
.replace("%ymin%", "" + swf.displayRect.Ymin)
|
||||
.replace("%xmax%", "" + swf.displayRect.Xmax)
|
||||
.replace("%ymax%", "" + swf.displayRect.Ymax));
|
||||
displayRectPixelsLabel.setText(AppStrings.translate("header.displayrect.value.pixels")
|
||||
.replace("%xmin%", ""+fmtDouble(swf.displayRect.Xmin/SWF.unitDivisor))
|
||||
.replace("%ymin%", ""+fmtDouble(swf.displayRect.Ymin/SWF.unitDivisor))
|
||||
.replace("%xmax%", ""+fmtDouble(swf.displayRect.Xmax/SWF.unitDivisor))
|
||||
.replace("%ymax%", ""+fmtDouble(swf.displayRect.Ymax/SWF.unitDivisor)));
|
||||
.replace("%xmin%", "" + fmtDouble(swf.displayRect.Xmin / SWF.unitDivisor))
|
||||
.replace("%ymin%", "" + fmtDouble(swf.displayRect.Ymin / SWF.unitDivisor))
|
||||
.replace("%xmax%", "" + fmtDouble(swf.displayRect.Xmax / SWF.unitDivisor))
|
||||
.replace("%ymax%", "" + fmtDouble(swf.displayRect.Ymax / SWF.unitDivisor)));
|
||||
}
|
||||
private String fmtDouble(double d){
|
||||
String r = ""+d;
|
||||
if(r.endsWith(".0")){
|
||||
r = r.substring(0,r.length()-2);
|
||||
|
||||
private String fmtDouble(double d) {
|
||||
String r = "" + d;
|
||||
if (r.endsWith(".0")) {
|
||||
r = r.substring(0, r.length() - 2);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import javax.swing.table.TableColumn;
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class HexView extends JTable {
|
||||
|
||||
|
||||
private final int bytesInRow = 16;
|
||||
private long[] highlightStarts;
|
||||
private long[] highlightEnds;
|
||||
@@ -51,7 +51,7 @@ public class HexView extends JTable {
|
||||
JLabel l = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
|
||||
int level = -1;
|
||||
if (col > 0 && highlightStarts != null) {
|
||||
if(col!=bytesInRow+1){
|
||||
if (col != bytesInRow + 1) {
|
||||
int idx = row * bytesInRow + ((col > bytesInRow + 1) ? (col - bytesInRow - 2) : (col - 1));
|
||||
for (int i = 0; i < highlightStarts.length; i++) {
|
||||
if (highlightStarts[i] <= idx && highlightEnds[i] >= idx) {
|
||||
@@ -73,14 +73,14 @@ public class HexView extends JTable {
|
||||
|
||||
return l;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HexView() {
|
||||
highlightColors = new Color[highlightColorsStr.length];
|
||||
for (int i = 0; i < highlightColors.length; i++) {
|
||||
highlightColors[i] = Color.decode("#" + highlightColorsStr[i]);
|
||||
}
|
||||
|
||||
|
||||
setModel(new AbstractTableModel() {
|
||||
|
||||
@Override
|
||||
@@ -137,7 +137,7 @@ public class HexView extends JTable {
|
||||
setFont(new Font("Monospaced", Font.PLAIN, 12));
|
||||
setTableHeader(new JTableHeader());
|
||||
setMaximumSize(new Dimension(200, 200));
|
||||
|
||||
|
||||
setShowHorizontalLines(false);
|
||||
setShowVerticalLines(false);
|
||||
setRowSelectionAllowed(false);
|
||||
@@ -152,10 +152,10 @@ public class HexView extends JTable {
|
||||
column.setMaxWidth(25);
|
||||
column.setCellRenderer(cellRenderer);
|
||||
}
|
||||
|
||||
|
||||
column = columnModel.getColumn(bytesInRow + 1);
|
||||
column.setMaxWidth(10);
|
||||
|
||||
|
||||
for (int i = 0; i < bytesInRow; i++) {
|
||||
column = columnModel.getColumn(i + bytesInRow + 1 + 1);
|
||||
column.setMaxWidth(10);
|
||||
@@ -164,28 +164,28 @@ public class HexView extends JTable {
|
||||
}
|
||||
|
||||
public void setData(byte[] data, long[] highlightStarts, long[] highlightEnds) {
|
||||
|
||||
|
||||
if ((highlightStarts == null) ^ (highlightEnds == null)) {
|
||||
throw new Error("highlightStarts and highlightEnds should be both null or not null.");
|
||||
}
|
||||
|
||||
|
||||
if (highlightStarts != null && highlightStarts.length != highlightEnds.length) {
|
||||
throw new Error("highlightStarts and highlightEnds should have the same number of elements.");
|
||||
}
|
||||
|
||||
|
||||
this.data = data;
|
||||
this.highlightStarts = highlightStarts;
|
||||
this.highlightEnds = highlightEnds;
|
||||
}
|
||||
|
||||
|
||||
public void scrollToByte(long byteNum) {
|
||||
int row = (int) (byteNum / bytesInRow);
|
||||
|
||||
//final int pageSize = (int) (getParent().getSize().getHeight() / getRowHeight());
|
||||
getSelectionModel().setSelectionInterval(row, row);
|
||||
scrollRectToVisible(new Rectangle(getCellRect(row, 0, true)));
|
||||
scrollRectToVisible(new Rectangle(getCellRect(row, 0, true)));
|
||||
}
|
||||
|
||||
|
||||
public void scrollToByte(long[] byteNumStarts, long[] byteNumEnds) {
|
||||
for (int i = 0; i < byteNumStarts.length; i++) {
|
||||
scrollToByte(byteNumStarts[i]);
|
||||
|
||||
@@ -329,29 +329,27 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
assignListener(importTextCommandButton, ACTION_IMPORT_TEXT);
|
||||
|
||||
importBand.addCommandButton(importTextCommandButton, RibbonElementPriority.TOP);
|
||||
|
||||
|
||||
|
||||
JRibbonBand viewBand = new JRibbonBand(translate("menu.view"), null);
|
||||
viewBand.setResizePolicies(getResizePolicies(viewBand));
|
||||
|
||||
CommandToggleButtonGroup grp=new CommandToggleButtonGroup();
|
||||
|
||||
|
||||
CommandToggleButtonGroup grp = new CommandToggleButtonGroup();
|
||||
|
||||
viewModeResourcesToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.view.resources")), View.getResizableIcon("viewresources16"));
|
||||
assignListener(viewModeResourcesToggleButton, ACTION_VIEWMODE_RESOURCES);
|
||||
|
||||
assignListener(viewModeResourcesToggleButton, ACTION_VIEWMODE_RESOURCES);
|
||||
|
||||
viewModeHexToggleButton = new JCommandToggleButton(fixCommandTitle(translate("menu.file.view.hex")), View.getResizableIcon("viewhex16"));
|
||||
assignListener(viewModeHexToggleButton, ACTION_VIEWMODE_HEX);
|
||||
|
||||
|
||||
grp.add(viewModeResourcesToggleButton);
|
||||
grp.add(viewModeHexToggleButton);
|
||||
|
||||
if(Configuration.dumpView.get()){
|
||||
|
||||
if (Configuration.dumpView.get()) {
|
||||
grp.setSelected(viewModeHexToggleButton, true);
|
||||
}else{
|
||||
} else {
|
||||
grp.setSelected(viewModeResourcesToggleButton, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
viewBand.addCommandButton(viewModeResourcesToggleButton, RibbonElementPriority.MEDIUM);
|
||||
viewBand.addCommandButton(viewModeHexToggleButton, RibbonElementPriority.MEDIUM);
|
||||
|
||||
@@ -460,10 +458,9 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
miAutoRenameIdentifiers.addActionListener(this);
|
||||
|
||||
/*miDumpView = new JCheckBox(translate("menu.settings.dumpView"));
|
||||
miDumpView.setSelected(Configuration.dumpView.get());
|
||||
miDumpView.setActionCommand(ACTION_DUMP_VIEW_SWITCH);
|
||||
miDumpView.addActionListener(this);*/
|
||||
|
||||
miDumpView.setSelected(Configuration.dumpView.get());
|
||||
miDumpView.setActionCommand(ACTION_DUMP_VIEW_SWITCH);
|
||||
miDumpView.addActionListener(this);*/
|
||||
settingsBand.addRibbonComponent(new JRibbonComponent(miAutoDeobfuscation));
|
||||
settingsBand.addRibbonComponent(new JRibbonComponent(miInternalViewer));
|
||||
settingsBand.addRibbonComponent(new JRibbonComponent(miParallelSpeedUp));
|
||||
@@ -652,7 +649,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener {
|
||||
Configuration.internalFlashViewer.set(miInternalViewer.isSelected());
|
||||
mainFrame.panel.reload(true);
|
||||
break;
|
||||
|
||||
|
||||
case ACTION_VIEWMODE_RESOURCES:
|
||||
Configuration.dumpView.set(false);
|
||||
mainFrame.panel.showDumpView(false);
|
||||
|
||||
@@ -485,10 +485,10 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
displayPanel.add(previewPanel, CARDPREVIEWPANEL);
|
||||
displayPanel.add(createFolderPreviewCard(), CARDFOLDERPREVIEWPANEL);
|
||||
displayPanel.add(createDumpPreviewCard(), CARDDUMPVIEW);
|
||||
|
||||
headerPanel = new HeaderInfoPanel();
|
||||
displayPanel.add(headerPanel,CARDHEADER);
|
||||
|
||||
|
||||
headerPanel = new HeaderInfoPanel();
|
||||
displayPanel.add(headerPanel, CARDHEADER);
|
||||
|
||||
displayPanel.add(new JPanel(), CARDEMPTYPANEL);
|
||||
showCard(CARDEMPTYPANEL);
|
||||
|
||||
@@ -1133,7 +1133,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
|
||||
return DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf();
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1859,7 +1859,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
setDumpTreeSelectedNode(dumpInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void refreshDecompiled() {
|
||||
clearCache();
|
||||
if (abcPanel != null) {
|
||||
@@ -2153,18 +2153,18 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
showCard(CARDEMPTYPANEL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
dumpViewPanel.setData(DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf().uncompressedData, dumpInfo);
|
||||
dumpViewPanel.revalidate();
|
||||
showCard(CARDDUMPVIEW);
|
||||
}
|
||||
|
||||
|
||||
public void reload(boolean forceReload) {
|
||||
if (Configuration.dumpView.get()) {
|
||||
dumpViewReload(forceReload);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
TreeNode treeNode = (TreeNode) tagTree.getLastSelectedPathComponent();
|
||||
if (treeNode == null) {
|
||||
return;
|
||||
@@ -2249,9 +2249,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
|
||||
previewPanel.setImageReplaceButtonVisible(false);
|
||||
|
||||
if(treeNode instanceof HeaderNode) {
|
||||
if (treeNode instanceof HeaderNode) {
|
||||
showCard(CARDHEADER);
|
||||
headerPanel.load(((HeaderNode)treeNode).getItem().getSwf());
|
||||
headerPanel.load(((HeaderNode) treeNode).getItem().getSwf());
|
||||
} else if (treeNode instanceof StringNode) {
|
||||
showCard(CARDFOLDERPREVIEWPANEL);
|
||||
showFolderPreview(treeNode);
|
||||
@@ -2543,7 +2543,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
ds.matrix = new MATRIX();
|
||||
f.layers.put(1, ds);
|
||||
tim.frames.add(f);
|
||||
}
|
||||
}
|
||||
tim.displayRect = getRect(new HashSet<BoundedTag>());
|
||||
return tim;
|
||||
}
|
||||
|
||||
@@ -187,11 +187,11 @@ public class TagTree extends JTree implements ActionListener {
|
||||
}
|
||||
|
||||
public static TreeNodeType getTreeNodeType(TreeItem t) {
|
||||
|
||||
if(t instanceof HeaderItem){
|
||||
|
||||
if (t instanceof HeaderItem) {
|
||||
return TreeNodeType.HEADER;
|
||||
}
|
||||
|
||||
|
||||
if ((t instanceof DefineFontTag)
|
||||
|| (t instanceof DefineFont2Tag)
|
||||
|| (t instanceof DefineFont3Tag)
|
||||
@@ -498,7 +498,7 @@ public class TagTree extends JTree implements ActionListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean hasExportableNodes() {
|
||||
return !getSelection(mainPanel.getCurrentSwf()).isEmpty();
|
||||
}
|
||||
|
||||
@@ -244,9 +244,8 @@ public class TagTreeModel implements TreeModel {
|
||||
}
|
||||
swfNode.scriptsNode = actionScriptNode;
|
||||
|
||||
|
||||
ret.add(new HeaderNode(new HeaderItem(swf)));
|
||||
|
||||
|
||||
if (!shapesNode.subNodes.isEmpty()) {
|
||||
ret.add(shapesNode);
|
||||
}
|
||||
@@ -341,7 +340,7 @@ public class TagTreeModel implements TreeModel {
|
||||
return newPath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (obj instanceof StringItem && n.getItem() instanceof StringItem) {
|
||||
// StringItems are always recreated, so compare them by name
|
||||
StringItem nds = (StringItem) n.getItem();
|
||||
|
||||
@@ -156,7 +156,7 @@ public class DumpTree extends JTree implements ActionListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setModel(TreeModel tm) {
|
||||
super.setModel(tm);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class DumpViewPanel extends JPanel {
|
||||
}
|
||||
return end - 1;
|
||||
}
|
||||
|
||||
|
||||
public void setData(byte[] data, DumpInfo dumpInfo) {
|
||||
List<DumpInfo> dumpInfos = new ArrayList<>();
|
||||
DumpInfo di = dumpInfo;
|
||||
@@ -81,7 +81,7 @@ public class DumpViewPanel extends JPanel {
|
||||
int selectionEnd = getEndIndex(dumpInfo);
|
||||
|
||||
dumpViewHexTable.scrollToByte(highlightStarts, highlightEnds);
|
||||
|
||||
|
||||
setLabelText("startByte: " + dumpInfo.startByte
|
||||
+ " startBit: " + dumpInfo.startBit
|
||||
+ " lengthBytes: " + dumpInfo.lengthBytes
|
||||
@@ -89,7 +89,7 @@ public class DumpViewPanel extends JPanel {
|
||||
+ " selectionStart: " + selectionStart
|
||||
+ " selectionEnd: " + selectionEnd);
|
||||
}
|
||||
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user