diff --git a/CHANGELOG.md b/CHANGELOG.md index bbd75c6e1..541949db0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. ## [Unreleased] ### Added - SoundStreamHead has associated sprite id in its name in the tagtree +- [#1485] Improved skins support, night mode ## [14.4.0] - 2021-04-05 ### Added @@ -2074,7 +2075,8 @@ All notable changes to this project will be documented in this file. ### Added - Initial public release -[Unreleased]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.3.1...dev +[Unreleased]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.4.0...dev +[14.4.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.3.1...version14.4.0 [14.3.1]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.3.0...version14.3.1 [14.3.0]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.2.1...version14.3.0 [14.2.1]: https://github.com/jindrapetrik/jpexs-decompiler/compare/version14.2.0...version14.2.1 @@ -2187,6 +2189,7 @@ All notable changes to this project will be documented in this file. [alpha 9]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha8...alpha9 [alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8 [alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7 +[#1485]: https://www.free-decompiler.com/flash/issues/1485 [#1015]: https://www.free-decompiler.com/flash/issues/1015 [#1466]: https://www.free-decompiler.com/flash/issues/1466 [#1513]: https://www.free-decompiler.com/flash/issues/1513 diff --git a/lib/jsyntaxpane-0.9.5.jar b/lib/jsyntaxpane-0.9.5.jar index c36c619ec..22bf52a48 100644 Binary files a/lib/jsyntaxpane-0.9.5.jar and b/lib/jsyntaxpane-0.9.5.jar differ diff --git a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/DarkModeAwareSyntaxKit.java b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/DarkModeAwareSyntaxKit.java new file mode 100644 index 000000000..be1b0d5da --- /dev/null +++ b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/DarkModeAwareSyntaxKit.java @@ -0,0 +1,59 @@ +/* + * Copyright 2008 Ayman Al-Sairafi ayman.alsairafi@gmail.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License + * at http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package jsyntaxpane; + +import java.awt.Color; +import javax.swing.UIManager; +import jsyntaxpane.util.Configuration; + +public class DarkModeAwareSyntaxKit extends DefaultSyntaxKit { + + public DarkModeAwareSyntaxKit(Lexer lexer) { + super(lexer); + } + + private int cut(double val) { + int ival = (int) Math.round(val); + if (ival < 0) { + return 0; + } + if (ival > 255) { + ival = 255; + } + return ival; + } + @Override + public Configuration getConfig() { + Configuration cnf = super.getConfig(); + Color editorBackground = UIManager.getColor("EditorPane.background"); + int light = (editorBackground.getRed() + editorBackground.getGreen() + editorBackground.getBlue()) / 3; + if (light < 128) { + cnf.put("Style.DEFAULT", "0xffffff, 0"); + cnf.put("Style.IDENTIFIER", "0xffffff, 0"); + cnf.put("Style.TYPE", "0xffffff, 2"); + cnf.put("Style.TYPE2", "0xffffff, 1"); + cnf.put("Style.TYPE3", "0xffffff, 3"); + cnf.put("Style.OPERATOR", "0xffffff, 0"); + cnf.put("Style.DELIMITER", "0xffffff, 1"); + cnf.put("Style.KEYWORD", "0x8888ff, 0"); + cnf.put("Style.KEYWORD2", "0x448888, 3"); + cnf.put("Style.COMMENT", "0x88ff88, 3"); + cnf.put("Style.COMMENT2", "0x88ff88, 3"); + + cnf.put("CaretColor", "0xffffff"); + } + return cnf; + } + +} diff --git a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersRuler.java b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersRuler.java index 5c57438b3..9b7d98e0c 100644 --- a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersRuler.java +++ b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/components/LineNumbersRuler.java @@ -32,6 +32,7 @@ import javax.swing.JEditorPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.SwingUtilities; +import javax.swing.UIManager; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; import javax.swing.event.DocumentEvent; @@ -87,7 +88,8 @@ public class LineNumbersRuler extends JPanel // The formatting to use for displaying numbers. Use in String.format(numbersFormat, line) private String numbersFormat = "%3d"; - private Color currentLineColor; + protected Color currentLineColor; + protected Color currentLineForegroundColor; /** * Get the JscrollPane that contains this EditorPane, or null if no @@ -112,11 +114,13 @@ public class LineNumbersRuler extends JPanel int right = config.getInteger(PROPERTY_RIGHT_MARGIN, DEFAULT_R_MARGIN); int left = config.getInteger(PROPERTY_LEFT_MARGIN, DEFAULT_L_MARGIN); Color foreground = config.getColor(PROPERTY_FOREGROUND, Color.BLACK); - setForeground(foreground); + setForeground(UIManager.getColor("Panel.foreground")); Color back = config.getColor(PROPERTY_BACKGROUND, Color.WHITE); - setBackground(back); + setBackground(UIManager.getColor("Panel.background")); setBorder(BorderFactory.createEmptyBorder(0, left, 0, right)); - currentLineColor = config.getColor(PROPERTY_CURRENT_BACK, back); + //currentLineColor = config.getColor(PROPERTY_CURRENT_BACK, back); + currentLineColor = UIManager.getColor("List.selectionBackground"); + currentLineForegroundColor = UIManager.getColor("List.selectionForeground"); } @Override @@ -237,9 +241,10 @@ public class LineNumbersRuler extends JPanel if (line == currentLine) { g.setColor(currentLineColor); g.fillRect(0, y - lh + fontMetrics.getDescent() - 1, getWidth(), lh); - g.setColor(getForeground()); + g.setColor(currentLineForegroundColor); g.drawString(lineNumber, insets.left, y); } else { + g.setColor(getForeground()); g.drawString(lineNumber, insets.left, y); } } diff --git a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/ActionScript3SyntaxKit.java b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/ActionScript3SyntaxKit.java index c89039dc2..981532ed1 100644 --- a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/ActionScript3SyntaxKit.java +++ b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/ActionScript3SyntaxKit.java @@ -13,7 +13,7 @@ */ package jsyntaxpane.syntaxkits; -import jsyntaxpane.DefaultSyntaxKit; +import jsyntaxpane.DarkModeAwareSyntaxKit; import jsyntaxpane.Lexer; import jsyntaxpane.lexers.ActionScript3Lexer; @@ -21,7 +21,7 @@ import jsyntaxpane.lexers.ActionScript3Lexer; * * @author JPEXS */ -public class ActionScript3SyntaxKit extends DefaultSyntaxKit { +public class ActionScript3SyntaxKit extends DarkModeAwareSyntaxKit { public ActionScript3SyntaxKit() { super(new ActionScript3Lexer()); diff --git a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/ActionScriptSyntaxKit.java b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/ActionScriptSyntaxKit.java index bb94d9778..3988b6b0c 100644 --- a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/ActionScriptSyntaxKit.java +++ b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/ActionScriptSyntaxKit.java @@ -13,7 +13,7 @@ */ package jsyntaxpane.syntaxkits; -import jsyntaxpane.DefaultSyntaxKit; +import jsyntaxpane.DarkModeAwareSyntaxKit; import jsyntaxpane.Lexer; import jsyntaxpane.lexers.ActionScriptLexer; @@ -21,7 +21,7 @@ import jsyntaxpane.lexers.ActionScriptLexer; * * @author JPEXS */ -public class ActionScriptSyntaxKit extends DefaultSyntaxKit { +public class ActionScriptSyntaxKit extends DarkModeAwareSyntaxKit { public ActionScriptSyntaxKit() { super(new ActionScriptLexer()); diff --git a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/Flasm3MethodInfoSyntaxKit.java b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/Flasm3MethodInfoSyntaxKit.java index d4c534ad3..587bbb6ea 100644 --- a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/Flasm3MethodInfoSyntaxKit.java +++ b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/Flasm3MethodInfoSyntaxKit.java @@ -13,14 +13,14 @@ */ package jsyntaxpane.syntaxkits; -import jsyntaxpane.DefaultSyntaxKit; +import jsyntaxpane.DarkModeAwareSyntaxKit; import jsyntaxpane.Lexer; import jsyntaxpane.lexers.Flasm3MethodInfoLexer; /** * @author JPEXS */ -public class Flasm3MethodInfoSyntaxKit extends DefaultSyntaxKit { +public class Flasm3MethodInfoSyntaxKit extends DarkModeAwareSyntaxKit { public Flasm3MethodInfoSyntaxKit() { super(new Flasm3MethodInfoLexer()); diff --git a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/Flasm3SyntaxKit.java b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/Flasm3SyntaxKit.java index 19fe5a092..040740a8f 100644 --- a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/Flasm3SyntaxKit.java +++ b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/Flasm3SyntaxKit.java @@ -13,14 +13,14 @@ */ package jsyntaxpane.syntaxkits; -import jsyntaxpane.DefaultSyntaxKit; +import jsyntaxpane.DarkModeAwareSyntaxKit; import jsyntaxpane.Lexer; import jsyntaxpane.lexers.Flasm3Lexer; /** * @author JPEXS */ -public class Flasm3SyntaxKit extends DefaultSyntaxKit { +public class Flasm3SyntaxKit extends DarkModeAwareSyntaxKit { public Flasm3SyntaxKit() { super(new Flasm3Lexer()); diff --git a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/FlasmSyntaxKit.java b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/FlasmSyntaxKit.java index b27e06df9..9ef1bec48 100644 --- a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/FlasmSyntaxKit.java +++ b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/FlasmSyntaxKit.java @@ -13,14 +13,14 @@ */ package jsyntaxpane.syntaxkits; -import jsyntaxpane.DefaultSyntaxKit; +import jsyntaxpane.DarkModeAwareSyntaxKit; import jsyntaxpane.Lexer; import jsyntaxpane.lexers.FlasmLexer; /** * @author JPEXS */ -public class FlasmSyntaxKit extends DefaultSyntaxKit { +public class FlasmSyntaxKit extends DarkModeAwareSyntaxKit { public FlasmSyntaxKit() { super(new FlasmLexer()); diff --git a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/SWFTextSyntaxKit.java b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/SWFTextSyntaxKit.java index b043ea558..d72c4043c 100644 --- a/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/SWFTextSyntaxKit.java +++ b/libsrc/jsyntaxpane/jsyntaxpane/src/main/java/jsyntaxpane/syntaxkits/SWFTextSyntaxKit.java @@ -13,14 +13,14 @@ */ package jsyntaxpane.syntaxkits; -import jsyntaxpane.DefaultSyntaxKit; +import jsyntaxpane.DarkModeAwareSyntaxKit; import jsyntaxpane.Lexer; import jsyntaxpane.lexers.SWFTextLexer; /** * @author JPEXS */ -public class SWFTextSyntaxKit extends DefaultSyntaxKit { +public class SWFTextSyntaxKit extends DarkModeAwareSyntaxKit { public SWFTextSyntaxKit() { super(new SWFTextLexer()); diff --git a/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java b/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java index 6eb103fa3..d2337dc2a 100644 --- a/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java +++ b/src/com/jpexs/decompiler/flash/gui/HeaderLabel.java @@ -17,12 +17,14 @@ 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 javax.swing.UIManager; import org.pushingpixels.substance.api.ColorSchemeAssociationKind; import org.pushingpixels.substance.api.ComponentState; import org.pushingpixels.substance.api.DecorationAreaType; diff --git a/src/com/jpexs/decompiler/flash/gui/HtmlLabel.java b/src/com/jpexs/decompiler/flash/gui/HtmlLabel.java index 62b94e515..a5ffeefc1 100644 --- a/src/com/jpexs/decompiler/flash/gui/HtmlLabel.java +++ b/src/com/jpexs/decompiler/flash/gui/HtmlLabel.java @@ -19,7 +19,9 @@ package com.jpexs.decompiler.flash.gui; import java.awt.Color; import javax.swing.JEditorPane; import javax.swing.JLabel; +import javax.swing.UIManager; import javax.swing.event.HyperlinkEvent; +import javax.swing.text.html.HTMLDocument; public class HtmlLabel extends JEditorPane { @@ -53,6 +55,10 @@ public class HtmlLabel extends JEditorPane { } this.rawText = t; super.setText(modText); + + String aRule = "a {color: " + getUIColorToHex("List.selectionBackground") + "}"; + + ((HTMLDocument) getDocument()).getStyleSheet().addRule(aRule); } @Override @@ -60,4 +66,9 @@ public class HtmlLabel extends JEditorPane { return rawText; } + private static String getUIColorToHex(String name) { + Color c = UIManager.getColor(name); + return String.format("#%02x%02x%02x", c.getRed(), c.getGreen(), c.getBlue()); + } + } diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index c0d2100b5..ba4877ffd 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -63,6 +63,7 @@ import com.sun.jna.platform.win32.Advapi32Util; import com.sun.jna.platform.win32.Kernel32; import com.sun.jna.platform.win32.WinReg; import java.awt.AWTException; +import java.awt.Color; import java.awt.Component; import java.awt.Frame; import java.awt.GraphicsEnvironment; @@ -125,6 +126,9 @@ import javax.swing.SwingWorker; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.filechooser.FileFilter; +import jsyntaxpane.SyntaxStyle; +import jsyntaxpane.SyntaxStyles; +import jsyntaxpane.TokenType; import org.pushingpixels.substance.api.SubstanceLookAndFeel; /** diff --git a/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java b/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java index c54b98959..c0e86fdc1 100644 --- a/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java @@ -177,7 +177,8 @@ public class TagInfoPanel extends JPanel { + "padding:1px;" + "}" + "td { border: 1px solid " + getUIColorToHex("Table.gridColor") + "; }" - + "html { border: 1px solid " + getUIColorToHex("Table.gridColor") + "; }";; + + "html { border: 1px solid " + getUIColorToHex("Table.gridColor") + "; }" + + "a {color: " + getUIColorToHex("List.selectionBackground") + "}"; } ((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule); diff --git a/src/com/jpexs/decompiler/flash/gui/editor/DebuggableEditorPane.java b/src/com/jpexs/decompiler/flash/gui/editor/DebuggableEditorPane.java index 35e545222..b4bd04f63 100644 --- a/src/com/jpexs/decompiler/flash/gui/editor/DebuggableEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/editor/DebuggableEditorPane.java @@ -24,6 +24,7 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.util.Set; +import javax.swing.UIManager; import jsyntaxpane.components.BreakPointListener; import jsyntaxpane.components.LineMarkerPainter; import jsyntaxpane.components.LineNumbersBreakpointsRuler; @@ -38,7 +39,7 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP private static final Color BG_RULER_COLOR = new Color(0xe9, 0xe8, 0xe2); - private static final Color BG_BREAKPOINT_COLOR = new Color(0xfc, 0x9d, 0x9f); + private static Color BG_BREAKPOINT_COLOR = new Color(0xfc, 0x9d, 0x9f); private static final Color FG_BREAKPOINT_COLOR = null; @@ -56,7 +57,7 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP private static final int PRIORITY_INVALID_BREAKPOINT = 10; - public static final LineMarker BREAKPOINT_MARKER = new LineMarker(FG_BREAKPOINT_COLOR, BG_BREAKPOINT_COLOR, PRIORITY_BREAKPOINT); + public static LineMarker BREAKPOINT_MARKER = new LineMarker(FG_BREAKPOINT_COLOR, BG_BREAKPOINT_COLOR, PRIORITY_BREAKPOINT); public static final LineMarker IP_MARKER = new LineMarker(FG_IP_COLOR, BG_IP_COLOR, PRIORITY_IP); @@ -66,6 +67,16 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP private LineNumbersBreakpointsRuler ruler; + public DebuggableEditorPane() { + + Color editorBackground = UIManager.getColor("EditorPane.background"); + int light = (editorBackground.getRed() + editorBackground.getGreen() + editorBackground.getBlue()) / 3; + if (light < 128) { + BG_BREAKPOINT_COLOR = new Color(0x88, 0x00, 0x00); + BREAKPOINT_MARKER = new LineMarker(FG_BREAKPOINT_COLOR, BG_BREAKPOINT_COLOR, PRIORITY_BREAKPOINT); + } + } + public synchronized void setScriptName(String scriptName) { this.scriptName = scriptName; } @@ -128,19 +139,25 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP public void paintLineMarker(Graphics g, int line, int x, int lineY, int textY, int lineHeight, boolean currentLine, int maxLines) { if (currentLine) { - g.setColor(BG_CURRENT_COLOR); + g.setColor(UIManager.getColor("List.selectionBackground")); } else { - g.setColor(View.getDefaultBackgroundColor()); + g.setColor(UIManager.getColor("Panel.background")); } int h = lineHeight; if (line == 1) { h += lineY; } - if (line == maxLines) { + /*if (line == maxLines) { h = getHeight() - lineY; - } + }*/ g.fillRect(0, line == 1 ? 0 : lineY, getWidth(), h); + if (line == maxLines) { + g.setColor(UIManager.getColor("Panel.background")); + g.fillRect(0, line == 1 ? 0 : lineY + h, getWidth(), getHeight() - lineY - lineHeight); + } + + ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); ((Graphics2D) g).setStroke(new BasicStroke(0.5f)); @@ -168,7 +185,11 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP drawText = false; } if (drawText) { - g.setColor(getForeground()); + if (currentLine) { + g.setColor(UIManager.getColor("List.selectionForeground")); + } else { + g.setColor(UIManager.getColor("Panel.foreground")); + } g.drawString("" + line, x, textY); } diff --git a/src/com/jpexs/decompiler/flash/gui/editor/LineMarkedEditorPane.java b/src/com/jpexs/decompiler/flash/gui/editor/LineMarkedEditorPane.java index 13d94cc39..e3bdbfd3b 100644 --- a/src/com/jpexs/decompiler/flash/gui/editor/LineMarkedEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/editor/LineMarkedEditorPane.java @@ -39,6 +39,7 @@ import java.util.Map; import java.util.Objects; import java.util.SortedSet; import java.util.TreeSet; +import javax.swing.UIManager; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; import javax.swing.plaf.TextUI; @@ -642,19 +643,49 @@ public class LineMarkedEditorPane extends UndoFixedEditorPane implements LinkHan } } + private int cut(double val) { + int ival = (int) Math.round(val); + if (ival < 0) { + return 0; + } + if (ival > 255) { + ival = 255; + } + return ival; + } + @Override public void paint(Graphics g) { - g.setColor(Color.white); //FIXME + Color c; + Color selColor; + if (com.jpexs.decompiler.flash.gui.View.isOceanic()) { + c = Color.white; + g.setColor(c); + selColor = BG_SELECTED_LINE; + } else { + c = UIManager.getColor("EditorPane.background"); + g.setColor(c); + int light = (c.getRed() + c.getGreen() + c.getBlue()) / 3; + + if (light > 128) { + selColor = new Color(cut(c.getRed() * 0.9), cut(c.getGreen() * 0.9), cut(c.getBlue() * 0.9)); + } else { + selColor = new Color(cut(c.getRed() * 1.1), cut(c.getGreen() * 1.1), cut(c.getBlue() * 1.1)); + } + } + + + g.fillRect(0, 0, getWidth(), getHeight()); FontMetrics fontMetrics = g.getFontMetrics(); int lh = fontMetrics.getHeight(); int d = fontMetrics.getDescent(); - if (lastLine > 0) { + if (lastLine > -1) { if (error) { g.setColor(BG_ERROR_LINE); } else { - g.setColor(BG_SELECTED_LINE); + g.setColor(selColor); } g.fillRect(0, d + lh * lastLine - 1, getWidth(), lh); } diff --git a/src/com/jpexs/decompiler/flash/gui/editor/UndoFixedEditorPane.java b/src/com/jpexs/decompiler/flash/gui/editor/UndoFixedEditorPane.java index db8b3e641..b37103dbe 100644 --- a/src/com/jpexs/decompiler/flash/gui/editor/UndoFixedEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/editor/UndoFixedEditorPane.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.gui.editor; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.gui.View; import com.jpexs.helpers.Stopwatch; +import java.awt.Color; import java.awt.Font; import java.awt.event.KeyEvent; import java.io.IOException; @@ -37,6 +38,9 @@ import javax.swing.text.Document; import javax.swing.text.EditorKit; import javax.swing.text.JTextComponent; import jsyntaxpane.SyntaxDocument; +import jsyntaxpane.SyntaxStyle; +import jsyntaxpane.SyntaxStyles; +import jsyntaxpane.TokenType; /** *