mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 08:00:46 +00:00
format code
This commit is contained in:
@@ -400,7 +400,7 @@ public class CommandLineArgumentParser {
|
||||
} else if (nextParam.equals("-replace")) {
|
||||
parseReplace(args);
|
||||
} else if (nextParam.equals("-as3compiler")) {
|
||||
ActionScriptParser.compile(null /*?*/, args.remove(), args.remove(),0);
|
||||
ActionScriptParser.compile(null /*?*/, args.remove(), args.remove(), 0);
|
||||
} else if (nextParam.equals("-help") || nextParam.equals("--help") || nextParam.equals("/?") || nextParam.equals("\\_") /* /? translates as this on windows */) {
|
||||
printHeader();
|
||||
printCmdLineUsage();
|
||||
@@ -890,9 +890,9 @@ public class CommandLineArgumentParser {
|
||||
System.out.println("Exporting images...");
|
||||
new ImageExporter().exportImages(handler, outDir.getAbsolutePath() + File.separator + "images", extags, new ImageExportSettings(ImageExportMode.PNG_JPEG));
|
||||
System.out.println("Exporting shapes...");
|
||||
new ShapeExporter().exportShapes(handler, outDir.getAbsolutePath() + File.separator + "shapes", extags, new ShapeExportSettings(ShapeExportMode.SVG,zoom));
|
||||
new ShapeExporter().exportShapes(handler, outDir.getAbsolutePath() + File.separator + "shapes", extags, new ShapeExportSettings(ShapeExportMode.SVG, zoom));
|
||||
System.out.println("Exporting morphshapes...");
|
||||
new MorphShapeExporter().exportMorphShapes(handler, outDir.getAbsolutePath() + File.separator + "morphshapes", extags, new MorphShapeExportSettings(MorphShapeExportMode.SVG,zoom));
|
||||
new MorphShapeExporter().exportMorphShapes(handler, outDir.getAbsolutePath() + File.separator + "morphshapes", extags, new MorphShapeExportSettings(MorphShapeExportMode.SVG, zoom));
|
||||
System.out.println("Exporting scripts...");
|
||||
exfile.exportActionScript(handler, outDir.getAbsolutePath() + File.separator + "scripts", allExportMode, Configuration.parallelSpeedUp.get());
|
||||
System.out.println("Exporting movies...");
|
||||
@@ -921,12 +921,12 @@ public class CommandLineArgumentParser {
|
||||
break;
|
||||
case "shape": {
|
||||
System.out.println("Exporting shapes...");
|
||||
new ShapeExporter().exportShapes(handler, outDir.getAbsolutePath() + (exportFormats.length > 1 ? File.separator + "shapes" : ""), extags, new ShapeExportSettings(enumFromStr(formats.get("shape"), ShapeExportMode.class),zoom));
|
||||
new ShapeExporter().exportShapes(handler, outDir.getAbsolutePath() + (exportFormats.length > 1 ? File.separator + "shapes" : ""), extags, new ShapeExportSettings(enumFromStr(formats.get("shape"), ShapeExportMode.class), zoom));
|
||||
}
|
||||
break;
|
||||
case "morphshape": {
|
||||
System.out.println("Exporting morphshapes...");
|
||||
new MorphShapeExporter().exportMorphShapes(handler, outDir.getAbsolutePath() + (exportFormats.length > 1 ? File.separator + "morphshapes" : ""), extags, new MorphShapeExportSettings(enumFromStr(formats.get("morphshape"), MorphShapeExportMode.class),zoom));
|
||||
new MorphShapeExporter().exportMorphShapes(handler, outDir.getAbsolutePath() + (exportFormats.length > 1 ? File.separator + "morphshapes" : ""), extags, new MorphShapeExportSettings(enumFromStr(formats.get("morphshape"), MorphShapeExportMode.class), zoom));
|
||||
}
|
||||
break;
|
||||
case "script": {
|
||||
@@ -965,7 +965,7 @@ public class CommandLineArgumentParser {
|
||||
}
|
||||
}
|
||||
exfile.exportFrames(handler, outDir.getAbsolutePath() + (exportFormats.length > 1 ? File.separator + "frames" : ""), 0, frames,
|
||||
new FramesExportSettings(enumFromStr(formats.get("frame"), FramesExportMode.class),zoom));
|
||||
new FramesExportSettings(enumFromStr(formats.get("frame"), FramesExportMode.class), zoom));
|
||||
}
|
||||
break;
|
||||
case "sound": {
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ExportDialog extends AppDialog {
|
||||
FontExportMode.class,
|
||||
MorphShapeExportMode.class
|
||||
};
|
||||
|
||||
|
||||
Class[] zoomClasses = {
|
||||
ShapeExportMode.class,
|
||||
TextExportMode.class,
|
||||
@@ -123,11 +123,10 @@ public class ExportDialog extends AppDialog {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public double getZoom(){
|
||||
return Double.parseDouble(zoomTextField.getText())/100;
|
||||
|
||||
public double getZoom() {
|
||||
return Double.parseDouble(zoomTextField.getText()) / 100;
|
||||
}
|
||||
|
||||
|
||||
private void saveConfig() {
|
||||
String cfg = "";
|
||||
@@ -141,8 +140,8 @@ public class ExportDialog extends AppDialog {
|
||||
}
|
||||
cfg += key;
|
||||
}
|
||||
Configuration.lastSelectedExportZoom.set(Double.parseDouble(zoomTextField.getText())/100);
|
||||
Configuration.lastSelectedExportFormats.set(cfg);
|
||||
Configuration.lastSelectedExportZoom.set(Double.parseDouble(zoomTextField.getText()) / 100);
|
||||
Configuration.lastSelectedExportFormats.set(cfg);
|
||||
}
|
||||
|
||||
public ExportDialog(List<Object> exportables) {
|
||||
@@ -217,7 +216,7 @@ public class ExportDialog extends AppDialog {
|
||||
if (!exportableExists) {
|
||||
continue;
|
||||
}
|
||||
if(Arrays.asList(zoomClasses).contains(c)){
|
||||
if (Arrays.asList(zoomClasses).contains(c)) {
|
||||
zoomable = true;
|
||||
}
|
||||
JLabel lab = new JLabel(translate(optionNames[i]));
|
||||
@@ -227,20 +226,20 @@ public class ExportDialog extends AppDialog {
|
||||
top += combos[i].getHeight();
|
||||
}
|
||||
int zoomWidth = 50;
|
||||
if(zoomable){
|
||||
top+=2;
|
||||
if (zoomable) {
|
||||
top += 2;
|
||||
JLabel zlab = new JLabel(translate("zoom"));
|
||||
zlab.setBounds(10, top+4, zlab.getPreferredSize().width, zlab.getPreferredSize().height);
|
||||
zlab.setBounds(10, top + 4, zlab.getPreferredSize().width, zlab.getPreferredSize().height);
|
||||
zoomTextField.setBounds(10 + labWidth + 10, top, zoomWidth, zoomTextField.getPreferredSize().height);
|
||||
JLabel pctLabel = new JLabel(translate("zoom.percent"));
|
||||
pctLabel.setBounds(10 + labWidth + 10 + zoomWidth + 5, top+4, 20, pctLabel.getPreferredSize().height);
|
||||
|
||||
pctLabel.setBounds(10 + labWidth + 10 + zoomWidth + 5, top + 4, 20, pctLabel.getPreferredSize().height);
|
||||
|
||||
comboPanel.add(zlab);
|
||||
comboPanel.add(zoomTextField);
|
||||
comboPanel.add(pctLabel);
|
||||
top+=zoomTextField.getHeight();
|
||||
top += zoomTextField.getHeight();
|
||||
}
|
||||
|
||||
|
||||
Dimension dim = new Dimension(10 + labWidth + 10 + comboWidth + 10, top + 10);
|
||||
comboPanel.setMinimumSize(dim);
|
||||
comboPanel.setPreferredSize(dim);
|
||||
@@ -251,10 +250,10 @@ public class ExportDialog extends AppDialog {
|
||||
okButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try{
|
||||
try {
|
||||
saveConfig();
|
||||
}catch(NumberFormatException nfe){
|
||||
JOptionPane.showMessageDialog(ExportDialog.this, translate("zoom.invalid"),AppStrings.translate("error"),JOptionPane.ERROR_MESSAGE);
|
||||
} catch (NumberFormatException nfe) {
|
||||
JOptionPane.showMessageDialog(ExportDialog.this, translate("zoom.invalid"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
zoomTextField.requestFocusInWindow();
|
||||
return;
|
||||
}
|
||||
@@ -280,9 +279,9 @@ public class ExportDialog extends AppDialog {
|
||||
View.setWindowIcon(this);
|
||||
getRootPane().setDefaultButton(okButton);
|
||||
setModal(true);
|
||||
String pct = ""+Configuration.lastSelectedExportZoom.get()*100;
|
||||
if(pct.endsWith(".0")){
|
||||
pct = pct.substring(0,pct.length()-2);
|
||||
String pct = "" + Configuration.lastSelectedExportZoom.get() * 100;
|
||||
if (pct.endsWith(".0")) {
|
||||
pct = pct.substring(0, pct.length() - 2);
|
||||
}
|
||||
zoomTextField.setText(pct);
|
||||
}
|
||||
|
||||
@@ -68,8 +68,6 @@ import javax.swing.JPanel;
|
||||
|
||||
public final class ImagePanel extends JPanel implements ActionListener, MediaDisplay {
|
||||
|
||||
|
||||
|
||||
private Timelined timelined;
|
||||
private boolean stillFrame = false;
|
||||
private Timer timer;
|
||||
@@ -85,7 +83,6 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
private int time = 0;
|
||||
private int selectedDepth = -1;
|
||||
private double zoom = 1.0;
|
||||
|
||||
|
||||
public void selectDepth(int depth) {
|
||||
if (depth != selectedDepth) {
|
||||
@@ -311,7 +308,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
|
||||
iconPanel = new IconPanel();
|
||||
//labelPan.add(label, new GridBagConstraints());
|
||||
add(iconPanel, BorderLayout.CENTER);
|
||||
add(iconPanel, BorderLayout.CENTER);
|
||||
add(debugLabel, BorderLayout.NORTH);
|
||||
iconPanel.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@@ -393,16 +390,14 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
}
|
||||
|
||||
@Override
|
||||
public void zoom(double zoom){
|
||||
public void zoom(double zoom) {
|
||||
this.zoom = zoom;
|
||||
drawFrame();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -410,8 +405,6 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
return iconPanel.getLastImage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void zoomToFit() {
|
||||
if (timelined instanceof BoundedTag) {
|
||||
@@ -432,7 +425,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
w = w2;
|
||||
}
|
||||
zoom = (double) w / (double) w1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setImage(byte[] data) {
|
||||
@@ -452,10 +445,8 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
|
||||
@Override
|
||||
public boolean zoomAvailable() {
|
||||
return timelined!=null;
|
||||
return timelined != null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public synchronized void setTimelined(final Timelined drawable, final SWF swf, int frame) {
|
||||
pause();
|
||||
@@ -764,6 +755,5 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
public double getZoom() {
|
||||
return zoom;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1090,9 +1090,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
ret.addAll(new ImageExporter().exportImages(handler, selFile + File.separator + "images", images,
|
||||
new ImageExportSettings(export.getValue(ImageExportMode.class))));
|
||||
ret.addAll(new ShapeExporter().exportShapes(handler, selFile + File.separator + "shapes", shapes,
|
||||
new ShapeExportSettings(export.getValue(ShapeExportMode.class),export.getZoom())));
|
||||
new ShapeExportSettings(export.getValue(ShapeExportMode.class), export.getZoom())));
|
||||
ret.addAll(new MorphShapeExporter().exportMorphShapes(handler, selFile + File.separator + "morphshapes", morphshapes,
|
||||
new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class),export.getZoom())));
|
||||
new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class), export.getZoom())));
|
||||
ret.addAll(new TextExporter().exportTexts(handler, selFile + File.separator + "texts", texts,
|
||||
new TextExportSettings(export.getValue(TextExportMode.class), Configuration.textExportSingleFile.get(), export.getZoom())));
|
||||
ret.addAll(new MovieExporter().exportMovies(handler, selFile + File.separator + "movies", movies,
|
||||
@@ -1106,7 +1106,7 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
|
||||
for (Entry<Integer, List<Integer>> entry : frames.entrySet()) {
|
||||
ret.addAll(swf.exportFrames(handler, selFile + File.separator + "frames", entry.getKey(), entry.getValue(),
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class),export.getZoom())));
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class), export.getZoom())));
|
||||
}
|
||||
List<ABCContainerTag> abcList = swf.abcList;
|
||||
if (abcPanel != null) {
|
||||
@@ -1675,11 +1675,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
swf.exportImages(errorHandler, selFile + File.separator + "images",
|
||||
new ImageExportSettings(export.getValue(ImageExportMode.class)));
|
||||
swf.exportShapes(errorHandler, selFile + File.separator + "shapes",
|
||||
new ShapeExportSettings(export.getValue(ShapeExportMode.class),export.getZoom()));
|
||||
new ShapeExportSettings(export.getValue(ShapeExportMode.class), export.getZoom()));
|
||||
swf.exportMorphShapes(errorHandler, selFile + File.separator + "morphshapes",
|
||||
new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class),export.getZoom()));
|
||||
new MorphShapeExportSettings(export.getValue(MorphShapeExportMode.class), export.getZoom()));
|
||||
swf.exportTexts(errorHandler, selFile + File.separator + "texts",
|
||||
new TextExportSettings(export.getValue(TextExportMode.class), Configuration.textExportSingleFile.get(),export.getZoom()));
|
||||
new TextExportSettings(export.getValue(TextExportMode.class), Configuration.textExportSingleFile.get(), export.getZoom()));
|
||||
swf.exportMovies(errorHandler, selFile + File.separator + "movies",
|
||||
new MovieExportSettings(export.getValue(MovieExportMode.class)));
|
||||
swf.exportSounds(errorHandler, selFile + File.separator + "sounds",
|
||||
@@ -1689,11 +1689,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
swf.exportFonts(errorHandler, selFile + File.separator + "fonts",
|
||||
new FontExportSettings(export.getValue(FontExportMode.class)));
|
||||
swf.exportFrames(errorHandler, selFile + File.separator + "frames", 0, null,
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class),export.getZoom()));
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class), export.getZoom()));
|
||||
for (CharacterTag c : swf.characters.values()) {
|
||||
if (c instanceof DefineSpriteTag) {
|
||||
swf.exportFrames(errorHandler, selFile + File.separator + "frames", c.getCharacterId(), null,
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class),export.getZoom()));
|
||||
new FramesExportSettings(export.getValue(FramesExportMode.class), export.getZoom()));
|
||||
}
|
||||
}
|
||||
swf.exportActionScript(errorHandler, selFile, exportMode, Configuration.parallelSpeedUp.get());
|
||||
|
||||
@@ -176,7 +176,7 @@ public class PreviewImage extends JPanel {
|
||||
if (treeItem instanceof FrameNodeItem) {
|
||||
FrameNodeItem fn = (FrameNodeItem) treeItem;
|
||||
RECT rect = swf.displayRect;
|
||||
imgSrc = SWF.frameToImageGet(swf.getTimeline(), fn.getFrame() - 1, 0, null, 0, rect, new Matrix(), new ColorTransform(), null, true,1.0);
|
||||
imgSrc = SWF.frameToImageGet(swf.getTimeline(), fn.getFrame() - 1, 0, null, 0, rect, new Matrix(), new ColorTransform(), null, true, 1.0);
|
||||
width = (imgSrc.getWidth());
|
||||
height = (imgSrc.getHeight());
|
||||
} else if (treeItem instanceof ImageTag) {
|
||||
|
||||
@@ -269,16 +269,15 @@ public class PreviewPanel extends JSplitPane implements ActionListener {
|
||||
flashPlayPanel.add(flashPanel, BorderLayout.CENTER);
|
||||
|
||||
/*JPanel bottomPanel = new JPanel(new BorderLayout());
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
JButton selectColorButton = new JButton(View.getIcon("color16"));
|
||||
selectColorButton.addActionListener(mainPanel);
|
||||
selectColorButton.setActionCommand(MainPanel.ACTION_SELECT_BKCOLOR);
|
||||
selectColorButton.setToolTipText(AppStrings.translate("button.selectbkcolor.hint"));
|
||||
buttonsPanel.add(selectColorButton);
|
||||
bottomPanel.add(buttonsPanel, BorderLayout.EAST);
|
||||
|
||||
flashPlayPanel.add(bottomPanel, BorderLayout.SOUTH);*/
|
||||
JPanel buttonsPanel = new JPanel(new FlowLayout());
|
||||
JButton selectColorButton = new JButton(View.getIcon("color16"));
|
||||
selectColorButton.addActionListener(mainPanel);
|
||||
selectColorButton.setActionCommand(MainPanel.ACTION_SELECT_BKCOLOR);
|
||||
selectColorButton.setToolTipText(AppStrings.translate("button.selectbkcolor.hint"));
|
||||
buttonsPanel.add(selectColorButton);
|
||||
bottomPanel.add(buttonsPanel, BorderLayout.EAST);
|
||||
|
||||
flashPlayPanel.add(bottomPanel, BorderLayout.SOUTH);*/
|
||||
JPanel flashPlayPanel2 = new JPanel(new BorderLayout());
|
||||
flashPlayPanel2.add(flashPlayPanel, BorderLayout.CENTER);
|
||||
flashPlayPanel2.add(new PlayerControls(flashPanel), BorderLayout.SOUTH);
|
||||
|
||||
@@ -198,7 +198,7 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
|
||||
@Override
|
||||
public void zoom(double zoom) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -214,11 +214,7 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
public double getZoom() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void gotoFrame(int frame) {
|
||||
pause();
|
||||
@@ -249,7 +245,5 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
public BufferedImage printScreen() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -84,13 +84,13 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
|
||||
private static final int CMD_SETVARIABLE = 13;
|
||||
private static final int CMD_CHECKCLICK = 14;
|
||||
private static final int CMD_ZOOM = 15;
|
||||
|
||||
|
||||
private static final int PIPE_TIMEOUT_MS = 1000;
|
||||
private int frameRate;
|
||||
public boolean specialPlayback = false;
|
||||
private boolean specialPlaying = false;
|
||||
private JPopupMenu rightClickMenu = null;
|
||||
|
||||
|
||||
private Timer rightClickTimer;
|
||||
|
||||
@Override
|
||||
@@ -102,8 +102,6 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
|
||||
public boolean zoomAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void zoomToFit() {
|
||||
@@ -115,37 +113,31 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private synchronized int checkClick(Point ret) throws IOException{
|
||||
if(pipe!=null){
|
||||
private synchronized int checkClick(Point ret) throws IOException {
|
||||
if (pipe != null) {
|
||||
writeToPipe(new byte[]{CMD_CHECKCLICK});
|
||||
byte res[] = new byte[1];
|
||||
readFromPipe(res);
|
||||
int button = res[0];
|
||||
if(button>0){
|
||||
if (button > 0) {
|
||||
res = new byte[4];
|
||||
readFromPipe(res);
|
||||
ret.x = ((res[0] & 0xff) << 8) + (res[1] & 0xff);
|
||||
ret.y = ((res[2] & 0xff) << 8) + (res[3] & 0xff);
|
||||
ret.y = ((res[2] & 0xff) << 8) + (res[3] & 0xff);
|
||||
}
|
||||
return button;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
private double zoom = 1.0;
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void zoom(double zoom){
|
||||
if(pipe!=null){
|
||||
public synchronized void zoom(double zoom) {
|
||||
if (pipe != null) {
|
||||
try {
|
||||
long zoomint = Math.round(100/(zoom/this.zoom));
|
||||
if(zoom==1.0){
|
||||
long zoomint = Math.round(100 / (zoom / this.zoom));
|
||||
if (zoom == 1.0) {
|
||||
zoomint = 0;
|
||||
}
|
||||
this.zoom = zoom;
|
||||
@@ -156,7 +148,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public synchronized String getVariable(String name) throws IOException {
|
||||
if (pipe != null) {
|
||||
writeToPipe(new byte[]{CMD_GETVARIABLE});
|
||||
@@ -261,21 +253,21 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
|
||||
public synchronized void setBackground(Color color) {
|
||||
try {
|
||||
writeToPipe(new byte[]{CMD_BGCOLOR});
|
||||
writeToPipe(new byte[]{(byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()});
|
||||
} catch (IOException ex) {
|
||||
writeToPipe(new byte[]{(byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()});
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void setRightClickMenu(JPopupMenu menu){
|
||||
public void setRightClickMenu(JPopupMenu menu) {
|
||||
rightClickMenu = menu;
|
||||
}
|
||||
|
||||
|
||||
public FlashPlayerPanel(Component frame) {
|
||||
if (!Platform.isWindows()) {
|
||||
throw new FlashUnsupportedException();
|
||||
}
|
||||
this.frame = frame;
|
||||
this.frame = frame;
|
||||
//this.add(rightClickMenu);
|
||||
addComponentListener(new ComponentListener() {
|
||||
@Override
|
||||
@@ -349,7 +341,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
|
||||
}
|
||||
|
||||
public synchronized void stopSWF() {
|
||||
if(rightClickTimer!=null){
|
||||
if (rightClickTimer != null) {
|
||||
rightClickTimer.cancel();
|
||||
rightClickTimer = null;
|
||||
}
|
||||
@@ -362,17 +354,15 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage printScreen() {
|
||||
public BufferedImage printScreen() {
|
||||
Point screenloc = getLocationOnScreen();
|
||||
try {
|
||||
try {
|
||||
return new Robot().createScreenCapture(new Rectangle(screenloc.x, screenloc.y, getWidth(), getHeight()));
|
||||
} catch (AWTException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public synchronized void displaySWF(String flash, Color bgColor, int frameRate) {
|
||||
try {
|
||||
zoom = 1.0;
|
||||
@@ -395,8 +385,8 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
|
||||
if (specialPlayback) {
|
||||
play();
|
||||
}
|
||||
if(rightClickTimer!=null){
|
||||
rightClickTimer.cancel();
|
||||
if (rightClickTimer != null) {
|
||||
rightClickTimer.cancel();
|
||||
}
|
||||
rightClickTimer = new Timer();
|
||||
rightClickTimer.schedule(new TimerTask() {
|
||||
@@ -410,30 +400,30 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(rightClickMenu!=null){
|
||||
if(button == 2){
|
||||
if (rightClickMenu != null) {
|
||||
if (button == 2) {
|
||||
ShadowPopupFactory.uninstall();
|
||||
rightClickMenu.show(FlashPlayerPanel.this, pt.x, pt.y);
|
||||
ShadowPopupFactory.install();
|
||||
}
|
||||
if(button == 1){
|
||||
if (button == 1) {
|
||||
rightClickMenu.setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (IOException ex) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}, 100,100);
|
||||
}, 100, 100);
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
if(rightClickTimer!=null){
|
||||
if (rightClickTimer != null) {
|
||||
rightClickTimer.cancel();
|
||||
rightClickTimer = null;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public interface MediaDisplay {
|
||||
public int getCurrentFrame();
|
||||
|
||||
public int getTotalFrames();
|
||||
|
||||
|
||||
public void zoom(double zoom);
|
||||
|
||||
public void pause();
|
||||
@@ -46,14 +46,14 @@ public interface MediaDisplay {
|
||||
public int getFrameRate();
|
||||
|
||||
public boolean isLoaded();
|
||||
|
||||
|
||||
public BufferedImage printScreen();
|
||||
|
||||
|
||||
public boolean screenAvailable();
|
||||
|
||||
|
||||
public boolean zoomAvailable();
|
||||
|
||||
|
||||
public void zoomToFit();
|
||||
|
||||
|
||||
public double getZoom();
|
||||
}
|
||||
|
||||
@@ -71,22 +71,22 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
private final JLabel totalTimeLabel;
|
||||
private static final Icon pauseIcon = View.getIcon("pause16");
|
||||
private static final Icon playIcon = View.getIcon("play16");
|
||||
|
||||
|
||||
private final JLabel percentLabel = new JLabel("100%");
|
||||
private final JPanel zoomPanel;
|
||||
private final JPanel zoomPanel;
|
||||
private final JPanel graphicControls;
|
||||
private final JPanel playbackControls;
|
||||
private final JPanel playbackControls;
|
||||
private double realZoom = 1.0;
|
||||
|
||||
|
||||
private final JButton zoomFitButton;
|
||||
|
||||
|
||||
public static final int ZOOM_DECADE_STEPS = 10;
|
||||
public static final double ZOOM_MULTIPLIER = Math.pow(10, 1.0 / ZOOM_DECADE_STEPS);
|
||||
|
||||
|
||||
public PlayerControls(MediaDisplay display) {
|
||||
|
||||
|
||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
|
||||
|
||||
graphicControls = new JPanel(new BorderLayout());
|
||||
JPanel graphicButtonsPanel = new JPanel(new FlowLayout());
|
||||
JButton selectColorButton = new JButton(View.getIcon("color16"));
|
||||
@@ -118,10 +118,10 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
snapshotButton.addActionListener(this);
|
||||
snapshotButton.setActionCommand(ACTION_SNAPSHOT);
|
||||
snapshotButton.setToolTipText(AppStrings.translate("button.snapshot.hint"));
|
||||
|
||||
|
||||
zoomPanel = new JPanel(new FlowLayout());
|
||||
//updateZoom();
|
||||
zoomPanel.add(percentLabel);
|
||||
zoomPanel.add(percentLabel);
|
||||
zoomPanel.add(zoomInButton);
|
||||
zoomPanel.add(zoomOutButton);
|
||||
zoomPanel.add(zoomNoneButton);
|
||||
@@ -129,12 +129,12 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
zoomPanel.add(selectColorButton);
|
||||
graphicButtonsPanel.add(zoomPanel);
|
||||
graphicButtonsPanel.add(snapshotButton);
|
||||
graphicControls.add(graphicButtonsPanel,BorderLayout.EAST);
|
||||
|
||||
graphicControls.add(graphicButtonsPanel, BorderLayout.EAST);
|
||||
|
||||
add(graphicControls);
|
||||
graphicControls.setVisible(display.screenAvailable());
|
||||
|
||||
playbackControls = new JPanel();
|
||||
|
||||
playbackControls = new JPanel();
|
||||
this.display = display;
|
||||
JPanel controlPanel = new JPanel(new BorderLayout());
|
||||
timeLabel = new JLabel("00:00.00");
|
||||
@@ -213,10 +213,10 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
|
||||
View.execInEventDispatch(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
public void run() {
|
||||
double zoom = display.getZoom();
|
||||
zoomFitButton.setVisible(zoom!=0.0);
|
||||
percentLabel.setVisible(zoom!=0.0);
|
||||
zoomFitButton.setVisible(zoom != 0.0);
|
||||
percentLabel.setVisible(zoom != 0.0);
|
||||
zoomPanel.setVisible(display.zoomAvailable());
|
||||
graphicControls.setVisible(display.screenAvailable());
|
||||
int totalFrames = display.getTotalFrames();
|
||||
@@ -265,7 +265,7 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
BigDecimal bd = new BigDecimal(String.valueOf(realZoom)).setScale(lg, BigDecimal.ROUND_HALF_UP);
|
||||
return bd.doubleValue();
|
||||
}
|
||||
|
||||
|
||||
private void updateZoom() {
|
||||
double pctzoom = roundZoom(realZoom * 100, 3);
|
||||
String r = "" + pctzoom;
|
||||
@@ -276,7 +276,7 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
percentLabel.setText("" + r + "%");
|
||||
display.zoom(zoom);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
@@ -291,14 +291,14 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
display.pause();
|
||||
display.rewind();
|
||||
break;
|
||||
case ACTION_SELECT_BKCOLOR:
|
||||
case ACTION_SELECT_BKCOLOR:
|
||||
View.execInEventDispatch(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Color newColor = JColorChooser.showDialog(null, AppStrings.translate("dialog.selectbkcolor.title"), View.swfBackgroundColor);
|
||||
if (newColor != null) {
|
||||
View.swfBackgroundColor = newColor;
|
||||
display.setBackground(newColor);
|
||||
display.setBackground(newColor);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -322,10 +322,9 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
case ACTION_SNAPSHOT:
|
||||
putImageToClipBoard(display.printScreen());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private class TransferableImage implements Transferable {
|
||||
|
||||
Image img;
|
||||
@@ -363,7 +362,7 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void putImageToClipBoard(BufferedImage img) {
|
||||
if (img == null) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user