format source files

This commit is contained in:
honfika@gmail.com
2015-01-13 21:19:10 +01:00
parent 8ff2925335
commit 26dd283d3f
14 changed files with 100 additions and 100 deletions

View File

@@ -312,7 +312,7 @@ public class AdvancedSettingsDialog extends AppDialog implements ActionListener
}
value = cal;
}
if (itemType.isEnum()) {
String stringValue = (String) ((JComboBox<String>) c).getSelectedItem();
value = Enum.valueOf(itemType, stringValue);

View File

@@ -155,7 +155,7 @@ public class ErrorLogFrame extends AppFrame {
};
handler.setLevel(Level.WARNING);
}
public void clearLog() {
logViewInner.removeAll();
Main.clearLogFile();

View File

@@ -170,7 +170,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
w = w2;
}
}
rect = new Rectangle(getWidth() / 2 - w / 2, getHeight() / 2 - h / 2, w, h);
} else {
rect = null;
@@ -238,7 +238,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
Matrix m = new Matrix();
m.translate(-rect.Xmin, -rect.Ymin);
m.scale(scale);
Point p = lastMouseEvent == null ? null : lastMouseEvent.getPoint();
List<DepthState> objs = new ArrayList<>();
String ret = "";
@@ -276,7 +276,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
if (first) {
ret += " - ";
}
synchronized (ImagePanel.class) {
if (counter == this.counter) {
debugLabel.setText(ret);
@@ -455,11 +455,11 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
} else {
w = w2;
}
if (w1 <= Double.MIN_NORMAL) {
return 1.0;
}
return (double) w / (double) w1;
}
@@ -510,8 +510,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
shouldDraw.set(true);
play();
}
synchronized (delayObject) {
try {
delayObject.wait(drawWaitLimit);
@@ -530,7 +529,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
public synchronized void setImage(SerializableImage image) {
setBackground(View.swfBackgroundColor);
clear();
timelined = null;
loaded = true;
stillFrame = true;
@@ -543,7 +542,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
public synchronized void setText(TextTag textTag, TextTag newTextTag) {
setBackground(View.swfBackgroundColor);
clear();
timelined = null;
loaded = true;
stillFrame = true;
@@ -551,9 +550,9 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
this.textTag = textTag;
this.newTextTag = newTextTag;
double zoomDouble = zoom.fit ? getZoomToFit() : zoom.value;
RECT rect = textTag.getRect(new HashSet<BoundedTag>());
int width = (int) (rect.getWidth() * zoomDouble);
int height = (int) (rect.getHeight() * zoomDouble);
@@ -564,11 +563,11 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
m.translate(-rect.Xmin * zoomDouble, -rect.Ymin * zoomDouble);
m.scale(zoomDouble);
textTag.toImage(0, 0, 0, null, 0, image, m, new ConstantColorColorTransform(0xFFC0C0C0));
if (newTextTag != null) {
newTextTag.toImage(0, 0, 0, null, 0, image, m, new ConstantColorColorTransform(0xFF000000));
}
iconPanel.setImg(image);
iconPanel.setOutlines(new ArrayList<DepthState>(), new ArrayList<Shape>());
drawReady = true;
@@ -578,7 +577,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
iconPanel.setImg(null);
iconPanel.setOutlines(new ArrayList<DepthState>(), new ArrayList<Shape>());
}
@Override
public synchronized int getCurrentFrame() {
return frame;
@@ -607,13 +606,13 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
}
soundPlayers.clear();
}
private void clear() {
if (timer != null) {
timer.cancel();
timer = null;
}
textTag = null;
newTextTag = null;
}
@@ -712,12 +711,12 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
int selectedDepth;
Zoom zoom;
SWF swf;
synchronized (ImagePanel.class) {
timelined = this.timelined;
lastMouseEvent = this.lastMouseEvent;
}
updatePos(timelined, lastMouseEvent, counter);
synchronized (ImagePanel.class) {
@@ -729,7 +728,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
zoom = this.zoom;
swf = this.swf;
}
if (timelined == null) {
return;
}
@@ -813,7 +812,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
for (int i = 0; i < outlines.size(); i++) {
outlines.set(i, SHAPERECORD.twipToPixelShape(outlines.get(i)));
}
synchronized (ImagePanel.class) {
if (counter == this.counter) {
iconPanel.setOutlines(objs, outlines);
@@ -833,7 +832,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
timer = new Timer();
int frameRate = timelined.getTimeline().frameRate;
int msPerFrame = frameRate == 0 ? 1000 : 1000 / frameRate;
final int cnt = counter;
shouldDraw.set(true);
TimerTask task = new TimerTask() {
@@ -851,7 +850,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
timeline = timelined.getTimeline();
}
if (timeline.getFrameCount() <= 1 && timeline.isSingleFrame()) {
if (first.getAndSet(false)) {
drawFrame(counter);
@@ -864,7 +863,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
}
}
};
timer.schedule(task, 0, msPerFrame);
}
}

View File

@@ -47,14 +47,14 @@ public abstract class MainFrameMenu {
private final MainFrame mainFrame;
private SWF swf;
public abstract boolean isInternalFlashViewerSelected();
public MainFrameMenu(MainFrame mainFrame) {
registerHotKeys();
this.mainFrame = mainFrame;
}
protected String translate(String key) {
return mainFrame.translate(key);
}
@@ -63,7 +63,7 @@ public abstract class MainFrameMenu {
Main.openFileDialog();
return true;
}
protected boolean save() {
if (swf != null) {
boolean saved = false;
@@ -91,25 +91,25 @@ public abstract class MainFrameMenu {
if (saved) {
swf.clearModified();
}
return true;
}
return false;
}
protected boolean saveAs() {
if (swf != null) {
if (saveAs(swf, SaveFileMode.SAVEAS)) {
swf.clearModified();
}
return true;
}
return false;
}
private boolean saveAs(SWF swf, SaveFileMode mode) {
if (Main.saveFileDialog(swf, mode)) {
mainFrame.setTitle(ApplicationInfo.applicationVerName + (Configuration.displayFileName.get() ? " - " + swf.getFileTitle() : ""));
@@ -124,24 +124,24 @@ public abstract class MainFrameMenu {
saveAs(swf, SaveFileMode.EXE);
}
}
protected void close() {
Main.closeFile(mainFrame.getPanel().getCurrentSwfList());
}
protected boolean closeAll() {
if (swf != null) {
Main.closeAll();
return true;
}
return false;
}
protected void importText() {
mainFrame.getPanel().importText(swf);
}
protected boolean export(boolean onlySelected) {
if (swf != null) {
mainFrame.getPanel().export(onlySelected);
@@ -150,66 +150,66 @@ public abstract class MainFrameMenu {
return false;
}
protected void exportFla() {
mainFrame.getPanel().exportFla(swf);
}
protected boolean search(boolean searchInText) {
if (swf != null) {
mainFrame.getPanel().searchInActionScriptOrText(searchInText);
return true;
}
return false;
}
protected boolean replace() {
if (swf != null) {
mainFrame.getPanel().replaceText();
return true;
}
return false;
}
protected void restoreControlFlow(boolean all) {
mainFrame.getPanel().restoreControlFlow(all);
}
protected void showProxy() {
Main.showProxy();
}
protected boolean clearLog() {
ErrorLogFrame.getInstance().clearLog();
return true;
}
protected void renameOneIdentifier() {
mainFrame.getPanel().renameOneIdentifier(swf);
}
protected void renameIdentifiers() {
mainFrame.getPanel().renameIdentifiers(swf);
}
protected void deobfuscate() {
mainFrame.getPanel().deobfuscate();
}
protected void setSubLimiter(boolean value) {
Main.setSubLimiter(value);
}
protected void removeNonScripts() {
mainFrame.getPanel().removeNonScripts(swf);
}
protected void refreshDecompiled() {
mainFrame.getPanel().refreshDecompiled();
}
protected void checkResources() {
ByteArrayOutputStream os = new ByteArrayOutputStream();
PrintStream stream = new PrintStream(os);
@@ -235,59 +235,59 @@ public abstract class MainFrameMenu {
};
dialog.setVisible(true);
}
protected void checkUpdates() {
if (!Main.checkForUpdates()) {
View.showMessageDialog(null, translate("update.check.nonewversion"), translate("update.check.title"), JOptionPane.INFORMATION_MESSAGE);
}
}
protected void helpUs() {
String helpUsURL = ApplicationInfo.PROJECT_PAGE + "/help_us.html";
if (!View.navigateUrl(helpUsURL)) {
View.showMessageDialog(null, translate("message.helpus").replace("%url%", helpUsURL));
}
}
protected void homePage() {
String homePageURL = ApplicationInfo.PROJECT_PAGE;
if (!View.navigateUrl(homePageURL)) {
View.showMessageDialog(null, translate("message.homepage").replace("%url%", homePageURL));
}
}
protected void about() {
Main.about();
}
protected boolean reload() {
if (swf != null) {
if (View.showConfirmDialog(null, translate("message.confirm.reload"), translate("message.warning"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
Main.reloadApp();
}
return true;
}
return false;
}
protected void advancedSettings() {
Main.advancedSettings();
}
protected void loadFromMemory() {
Main.loadFromMemory();
}
protected void loadFromCache() {
Main.loadFromCache();
}
protected void setLanguage() {
new SelectLanguageDialog().display();
}
protected void exit() {
mainFrame.getPanel().setVisible(false);
if (Main.proxyFrame != null) {
@@ -297,13 +297,13 @@ public abstract class MainFrameMenu {
}
Main.exit();
}
public void updateComponents(SWF swf) {
this.swf = swf;
}
private void registerHotKeys() {
KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
manager.addKeyEventDispatcher(new KeyEventDispatcher() {

View File

@@ -565,7 +565,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
//Opening files with drag&drop to main window
enableDrop(true);
}
public void load(SWFList newSwfs, boolean first) {
previewPanel.clear();
@@ -658,20 +658,20 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
public void closeAll() {
boolean modified = false;
for (SWFList swfList: swfs) {
for (SWFList swfList : swfs) {
for (SWF swf : swfList) {
if (swf.isModified()) {
modified = true;
}
}
}
if (modified) {
if (View.showConfirmDialog(this, translate("message.confirm.closeAll"), translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, Configuration.showCloseConfirmation, JOptionPane.OK_OPTION) == JOptionPane.CANCEL_OPTION) {
return;
}
}
swfs.clear();
oldItem = null;
previewPanel.clear();
@@ -693,7 +693,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
modified = true;
}
}
if (modified) {
if (View.showConfirmDialog(this, translate("message.confirm.close").replace("{swfName}", swfList.toString()), translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, Configuration.showCloseConfirmation, JOptionPane.OK_OPTION) == JOptionPane.CANCEL_OPTION) {
return;
@@ -922,7 +922,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
if (selectedNodeSwf != swf) {
continue;
}
if (d instanceof Tag || d instanceof ASMSource) {
TreeNodeType nodeType = TagTree.getTreeNodeType(d);
if (nodeType == TreeNodeType.IMAGE) {
@@ -1139,7 +1139,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
} else {
searchDialog.searchInASRadioButton.setSelected(true);
}
searchDialog.setVisible(true);
if (searchDialog.result) {
final String txt = searchDialog.searchField.getText();
@@ -1857,7 +1857,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
font.addCharacter(character, f);
}
});
return true;
}
};
@@ -2324,7 +2324,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
}
previewPanel.setImageReplaceButtonVisible(false);
boolean internalViewer = isInternalFlashViewerSelected();
if (treeItem instanceof HeaderItem) {

View File

@@ -388,7 +388,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
imagePlayControls.setMedia(imagePanel);
imagePanel.setImage(image);
}
public void showTextComparePanel(TextTag textTag, TextTag newTextTag) {
imagePanel.setText(textTag, newTextTag);
}
@@ -448,7 +448,7 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
if (media != null) {
media.pause();
}
binaryPanel.setBinaryData(null);
genericTagPanel.clear();
fontPanel.clear();

View File

@@ -77,7 +77,7 @@ public class SearchDialog extends AppDialog implements ActionListener {
panField.add(new JLabel(translate("label.searchtext")));
panField.add(searchField);
cnt.add(panField);
if (replace) {
panField = new JPanel(new FlowLayout());
replaceField.setPreferredSize(new Dimension(250, replaceField.getPreferredSize().height));
@@ -92,7 +92,7 @@ public class SearchDialog extends AppDialog implements ActionListener {
if (replace) {
checkPanel.add(replaceInParametersCheckBox);
}
cnt.add(checkPanel);
if (!replace) {

View File

@@ -82,7 +82,7 @@ public class SoundTagPlayer implements MediaDisplay {
synchronized (playLock) {
if (!paused) {
decreaseLoopCount();
if (loopCount > 0) {
clip.setFramePosition(0);
clip.start();
@@ -135,7 +135,7 @@ public class SoundTagPlayer implements MediaDisplay {
clip.open(AudioSystem.getAudioInputStream(new ByteArrayInputStream(wavData)));
}
}
@Override
public int getCurrentFrame() {
@@ -170,12 +170,12 @@ public class SoundTagPlayer implements MediaDisplay {
decreaseLoopCount();
clip.setFramePosition(0);
}
clip.start();
}
}
}
@Override
public void rewind() {
gotoFrame(0);
@@ -220,7 +220,7 @@ public class SoundTagPlayer implements MediaDisplay {
clip.stop();
}
clip.setMicrosecondPosition(frame * FRAME_DIVISOR);
if (active) {
clip.start();
}
@@ -257,7 +257,7 @@ public class SoundTagPlayer implements MediaDisplay {
super.finalize();
}
}
private void decreaseLoopCount() {
// this method should be called from synchronized (playLock) block
if (loopCount > 0 && loopCount != Integer.MAX_VALUE) {

View File

@@ -168,7 +168,7 @@ public class TextPanel extends JPanel implements ActionListener {
if (!Configuration.showOldTextDuringTextEditing.get()) {
return;
}
if (textValue.isEditable()) {
TreeItem item = mainPanel.tagTree.getCurrentTreeItem();
if (item instanceof TextTag) {
@@ -189,7 +189,7 @@ public class TextPanel extends JPanel implements ActionListener {
}
} catch (TextParseException | InterruptedException | IOException ex) {
}
if (!ok) {
mainPanel.showTextTagWithNewValue(textTag, null);
}

View File

@@ -139,13 +139,13 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
if (!Platform.isWindows()) {
throw new FlashUnsupportedException();
}
try {
flash = ActiveX.createObject(ShockwaveFlash.class, this);
} catch (ActiveXException ex) {
throw new FlashUnsupportedException();
}
flash.setAllowScriptAccess("always");
flash.setAllowNetworking("all");
flash.addFlashCallListener(new ActiveXEventListener() {

View File

@@ -392,15 +392,15 @@ public class PlayerControls extends JPanel implements ActionListener {
if (r.endsWith(".0")) {
r = r.substring(0, r.length() - 2);
}
r += "%";
if (zoomToFit) {
percentLabel.setText(AppStrings.translate("fit") + " (" + r + ")");
} else {
percentLabel.setText(r);
}
Zoom zoomObj = new Zoom();
zoomObj.value = zoom;
zoomObj.fit = zoomToFit;
@@ -517,10 +517,10 @@ public class PlayerControls extends JPanel implements ActionListener {
if (zoomToFit) {
return display.getZoomToFit();
}
return realZoom;
}
private class TransferableImage implements Transferable {
Image img;

View File

@@ -23,10 +23,10 @@ package com.jpexs.decompiler.flash.gui.player;
public class Zoom {
public double value = 1.0;
public boolean fit = false;
public Zoom() {
}
}

View File

@@ -223,7 +223,7 @@ public class TagTree extends JTree {
setHashColor(Color.gray);
}
};
setUI(treeUI);
}

View File

@@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package sample;
import org.testng.annotations.Test;
/**