diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/Filtering.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/Filtering.java index 1256ca105..c658888d8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/Filtering.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/Filtering.java @@ -16,7 +16,6 @@ */ package com.jpexs.decompiler.flash.types.filters; -import com.jpexs.decompiler.flash.types.RGBA; import com.jpexs.helpers.SerializableImage; import java.awt.AlphaComposite; import java.awt.Color; @@ -26,14 +25,11 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.geom.AffineTransform; -import java.awt.image.BandCombineOp; import java.awt.image.BufferedImage; import java.awt.image.BufferedImageOp; import java.awt.image.ConvolveOp; import java.awt.image.DataBufferInt; import java.awt.image.Kernel; -import java.awt.image.Raster; -import java.awt.image.WritableRaster; /** * diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index e008bda14..1107ae213 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -17,8 +17,6 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.SWF; -import com.jpexs.decompiler.flash.tags.ABCContainerTag; -import java.util.List; /** * diff --git a/src/com/jpexs/decompiler/flash/gui/TextPanel.java b/src/com/jpexs/decompiler/flash/gui/TextPanel.java index aa2cce00e..6452f5713 100644 --- a/src/com/jpexs/decompiler/flash/gui/TextPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/TextPanel.java @@ -21,12 +21,14 @@ import com.jpexs.decompiler.flash.tags.base.TextTag; import com.jpexs.decompiler.flash.treeitems.TreeItem; import java.awt.BorderLayout; import java.awt.FlowLayout; +import java.awt.Font; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JScrollPane; +import jsyntaxpane.DefaultSyntaxKit; /** * @@ -48,12 +50,15 @@ public class TextPanel extends JPanel implements ActionListener { public TextPanel(MainPanel mainPanel) { super(new BorderLayout()); + DefaultSyntaxKit.initKit(); this.mainPanel = mainPanel; textSearchPanel = new SearchPanel<>(new FlowLayout(), mainPanel); add(textSearchPanel, BorderLayout.NORTH); textValue = new LineMarkedEditorPane(); add(new JScrollPane(textValue), BorderLayout.CENTER); textValue.setEditable(false); + textValue.setFont(new Font("Monospaced", Font.PLAIN, textValue.getFont().getSize())); + textValue.setContentType("text/swftext"); JPanel textButtonsPanel = new JPanel(); textButtonsPanel.setLayout(new FlowLayout()); @@ -88,8 +93,6 @@ public class TextPanel extends JPanel implements ActionListener { } public void setText(String text) { - textValue.setContentType("text/swftext"); - // textValue.setFont(new Font("Monospaced", Font.PLAIN, 13)); textValue.setText(text); textValue.setCaretPosition(0); } diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 9aa3d9c92..460d69ea7 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -399,6 +399,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener, Se } } }); + decompiledTextArea.setContentType("text/actionscript"); decompiledTextArea.setFont(new Font("Monospaced", Font.PLAIN, decompiledTextArea.getFont().getSize())); diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index 3330478fa..cc154090a 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -657,7 +657,6 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL traitHighlights = cd.getTraitHighlights(); methodHighlights = cd.getMethodHighlights(); classHighlights = cd.getClassHighlights(); - setContentType("text/actionscript"); setText(hilightedCode); } fireScript(); diff --git a/src/com/jpexs/decompiler/flash/gui/abc/LineMarkedEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/LineMarkedEditorPane.java index 0c36d687e..7353445a8 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/LineMarkedEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/LineMarkedEditorPane.java @@ -275,14 +275,6 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan setCaretPosition(0); //scroll to top } - @Override - public void setText(String t, String contentType) { - lastLine = -1; - error = true; - super.setText(t, contentType); - setCaretPosition(0); //scroll to top - } - public static class UnderLinePainter extends DefaultHighlighter.DefaultHighlightPainter { public UnderLinePainter(Color color) { diff --git a/src/com/jpexs/decompiler/flash/gui/abc/UndoFixedEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/UndoFixedEditorPane.java index 4243cf7a6..6cb216cbb 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/UndoFixedEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/UndoFixedEditorPane.java @@ -24,7 +24,6 @@ import java.io.StringReader; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JEditorPane; -import static javax.swing.JEditorPane.createEditorKitForContentType; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.EditorKit; @@ -43,7 +42,7 @@ public class UndoFixedEditorPane extends JEditorPane { setText(t, getContentType()); } - public void setText(String t, String contentType) { + private void setText(String t, String contentType) { synchronized (setTextLock) { if (!t.equals(getText())) { boolean plain = t.length() > Configuration.syntaxHighlightLimit.get(); diff --git a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java index a9413172f..fad374874 100644 --- a/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/action/ActionPanel.java @@ -262,7 +262,7 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene @Override public void run() { ignoreCarret = true; - decompiledEditor.setText(text, "text/actionscript"); + decompiledEditor.setText(text); ignoreCarret = false; } }); @@ -274,7 +274,8 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene @Override public void run() { ignoreCarret = true; - editor.setText(text, contentType); + editor.setContentType(contentType); + editor.setText(text); ignoreCarret = false; } }); @@ -561,8 +562,10 @@ public class ActionPanel extends JPanel implements ActionListener, SearchListene Configuration.guiActionSplitPaneDividerLocation.set((int) pce.getNewValue()); } }); + editor.setFont(new Font("Monospaced", Font.PLAIN, editor.getFont().getSize())); decompiledEditor.setFont(new Font("Monospaced", Font.PLAIN, decompiledEditor.getFont().getSize())); + decompiledEditor.setContentType("text/actionscript"); //tagTree.addTreeSelectionListener(this); editor.addCaretListener(new CaretListener() { diff --git a/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java b/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java index 844ab8a92..cd0dab7e9 100644 --- a/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/player/FlashPlayerPanel.java @@ -107,9 +107,9 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { } try { return flash.getFrameNum(); - } catch (ActiveXException ex) { //Can be "Data not available yet exception" - return 0; + } catch (ActiveXException ex) { // Can be "Data not available yet exception" } + return 0; } @Override @@ -117,12 +117,11 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { if (flash == null) { return 0; } - if (flash.getReadyState() == 4) { - try { + try { + if (flash.getReadyState() == 4) { return flash.getTotalFrames(); - } catch (ActiveXException ex) { //Can be "Data not available yet exception" - return 0; } + } catch (ActiveXException ex) { // Can be "Data not available yet exception" } return 0; } @@ -131,8 +130,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { public synchronized void setBackground(Color color) { try { flash.setBackgroundColor((color.getRed() << 16) + (color.getGreen() << 8) + color.getBlue()); - } catch (ActiveXException ex) { - //ignore + } catch (ActiveXException ex) { // Can be "Data not available yet exception" } } @@ -207,8 +205,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { public void pause() { try { flash.Stop(); - } catch (ActiveXException ex) { - //ignore + } catch (ActiveXException ex) { // Can be "Data not available yet exception" } } @@ -216,8 +213,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { public void rewind() { try { flash.Rewind(); - } catch (ActiveXException ex) { - //ignore + } catch (ActiveXException ex) { // Can be "Data not available yet exception" } } @@ -225,8 +221,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { public void play() { try { flash.Play(); - } catch (ActiveXException ex) { - //ignore + } catch (ActiveXException ex) { // Can be "Data not available yet exception" } } @@ -234,7 +229,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { public boolean isPlaying() { try { return flash.IsPlaying(); - } catch (ActiveXException ex) { + } catch (ActiveXException ex) { // Can be "Data not available yet exception" return false; } } @@ -249,8 +244,7 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay { } try { flash.GotoFrame(frame); - } catch (ActiveXException ex) { - //ignore + } catch (ActiveXException ex) { // Can be "Data not available yet exception" } }