diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 3f977d551..4a2e1d853 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -725,10 +725,6 @@ public final class Configuration { @ConfigurationInternal public static ConfigurationItem showDialogOnError = null; - @ConfigurationDefaultBoolean(false) - @ConfigurationCategory("ui") - public static ConfigurationItem setControlsBackgroundToWhite = null; - private enum OSId { WINDOWS, OSX, UNIX } diff --git a/src/com/jpexs/decompiler/flash/gui/DebugLogDialog.java b/src/com/jpexs/decompiler/flash/gui/DebugLogDialog.java index 12c311e8d..b8b828f18 100644 --- a/src/com/jpexs/decompiler/flash/gui/DebugLogDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/DebugLogDialog.java @@ -48,7 +48,7 @@ public class DebugLogDialog extends AppDialog { setSize(800, 600); this.debug = debug; setTitle(translate("dialog.title")); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { logTextArea.setBackground(Color.white); } logTextArea.setEditable(false); diff --git a/src/com/jpexs/decompiler/flash/gui/DebugPanel.java b/src/com/jpexs/decompiler/flash/gui/DebugPanel.java index 31cb7a110..7d805c832 100644 --- a/src/com/jpexs/decompiler/flash/gui/DebugPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/DebugPanel.java @@ -223,7 +223,7 @@ public class DebugPanel extends JPanel { traceLogTextarea.setEditable(false); traceLogTextarea.setOpaque(false); traceLogTextarea.setFont(new JLabel().getFont()); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { traceLogTextarea.setBackground(Color.white); } diff --git a/src/com/jpexs/decompiler/flash/gui/DocsPanel.java b/src/com/jpexs/decompiler/flash/gui/DocsPanel.java index 505a9d1df..98a64e817 100644 --- a/src/com/jpexs/decompiler/flash/gui/DocsPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/DocsPanel.java @@ -42,7 +42,7 @@ public class DocsPanel extends JPanel implements DocsListener { add(sp, BorderLayout.CENTER); textDisplay.setContentType("text/html"); textDisplay.setFocusable(false); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { textDisplay.setBackground(Color.white); } } diff --git a/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java b/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java index 6767104db..4eb6da2eb 100644 --- a/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/ErrorLogFrame.java @@ -113,7 +113,7 @@ public class ErrorLogFrame extends AppFrame { public ErrorLogFrame() { setTitle(translate("dialog.title")); setSize(700, 400); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { setBackground(Color.white); } View.centerScreen(this); @@ -121,11 +121,11 @@ public class ErrorLogFrame extends AppFrame { setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); Container cnt = getContentPane(); cnt.setLayout(new BorderLayout()); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { logView.setBackground(Color.white); } logView.setLayout(new BorderLayout()); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { cnt.setBackground(Color.white); } @@ -215,7 +215,7 @@ public class ErrorLogFrame extends AppFrame { notifyMainFrame(level); JPanel pan = new JPanel(); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { pan.setBackground(Color.white); } pan.setLayout(new BoxLayout(pan, BoxLayout.Y_AXIS)); @@ -228,14 +228,14 @@ public class ErrorLogFrame extends AppFrame { detailTextArea.setEditable(false); detailTextArea.setOpaque(false); detailTextArea.setFont(new JLabel().getFont()); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { detailTextArea.setBackground(Color.white); } detailComponent = detailTextArea; } JPanel header = new JPanel(); header.setLayout(new BoxLayout(header, BoxLayout.X_AXIS)); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { header.setBackground(Color.white); } SimpleDateFormat format = new SimpleDateFormat("dd/MM/YYYY HH:mm:ss"); diff --git a/src/com/jpexs/decompiler/flash/gui/FilesChangedDialog.java b/src/com/jpexs/decompiler/flash/gui/FilesChangedDialog.java index fed1595b2..a048ef8f0 100644 --- a/src/com/jpexs/decompiler/flash/gui/FilesChangedDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/FilesChangedDialog.java @@ -72,7 +72,7 @@ public class FilesChangedDialog extends AppDialog { label.setBorder(new EmptyBorder(10, 10, 10, 10)); cnt.add(label, BorderLayout.NORTH); filesList = new JList(listModel); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { filesList.setBackground(Color.white); } cnt.add(new FasterScrollPane(filesList), BorderLayout.CENTER); diff --git a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java index 6a68a2bd7..d0832cba8 100644 --- a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java @@ -113,7 +113,7 @@ public class GenericTagTreePanel extends GenericTagPanel { private class MyTree extends JTree { public MyTree() { - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { setBackground(Color.white); } setUI(new BasicTreeUI() { @@ -480,7 +480,7 @@ public class GenericTagTreePanel extends GenericTagPanel { public class MyTreeCellRenderer extends DefaultTreeCellRenderer { public MyTreeCellRenderer() { - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { setUI(new BasicLabelUI()); setOpaque(false); setBackgroundNonSelectionColor(Color.white); diff --git a/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java b/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java index d43d8e95f..04b216d3a 100644 --- a/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/LoadFromMemoryFrame.java @@ -308,7 +308,7 @@ public class LoadFromMemoryFrame extends AppFrame { } } if (!isSelected) { - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { label.setBackground(Color.white); } } diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index c8c6d84fb..4d293ddbb 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -469,7 +469,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se detailPanel.setLayout(new CardLayout()); JPanel whitePanel = new JPanel(); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { whitePanel.setBackground(Color.white); } detailPanel.add(whitePanel, DETAILCARDEMPTYPANEL); diff --git a/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java b/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java index bd51363b6..c54b98959 100644 --- a/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/TagInfoPanel.java @@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.tags.TagInfo; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Font; import java.util.ArrayList; import java.util.Collections; @@ -86,7 +87,11 @@ public class TagInfoPanel extends JPanel { List items = tagInfo.getInfos().get(categoryName); - result += ""; + if (View.isOceanic()) { + result += ""; + } else { + result += ""; + } result += ""; result += mainPanel.translate("tagInfo.header.name"); result += ""; @@ -100,7 +105,11 @@ public class TagInfoPanel extends JPanel { flipFlop = !flipFlop; - result += ""; + if (View.isOceanic()) { + result += ""; + } else { + result += ""; + } String name = item.getName(); String key = "tagInfo." + name; @@ -149,17 +158,27 @@ public class TagInfoPanel extends JPanel { editorPane.setText(result); - Font font = UIManager.getFont("Label.font"); + Font font = UIManager.getFont("Table.font"); String bodyRule = "body { font-family: " + font.getFamily() + ";" + " font-size: " + font.getSize() + "pt;" + "}" + " table {" - + " width:100%;" - + " color:#053E6A;" - + " padding:1px;" - + "}" - + "td { border: 1px solid #e4e4e4; }" - + "html { border: 1px solid #789AC4; }"; + + " width:100%;"; + + if (View.isOceanic()) { + bodyRule += "color:#053E6A;" + + "padding:1px;" + + "}" + + "td { border: 1px solid #e4e4e4; }" + + "html { border: 1px solid #789AC4; }"; + } else { + bodyRule += "background-color: " + getUIColorToHex("Table.background") + ";" + + "color:" + getUIColorToHex("Table.foreground") + ";" + + "padding:1px;" + + "}" + + "td { border: 1px solid " + getUIColorToHex("Table.gridColor") + "; }" + + "html { border: 1px solid " + getUIColorToHex("Table.gridColor") + "; }";; + } ((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule); @@ -167,4 +186,9 @@ public class TagInfoPanel extends JPanel { editorPane.setBorder(null); editorPane.setEditable(false); } + + 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/View.java b/src/com/jpexs/decompiler/flash/gui/View.java index 906a35232..6e2bb2005 100644 --- a/src/com/jpexs/decompiler/flash/gui/View.java +++ b/src/com/jpexs/decompiler/flash/gui/View.java @@ -185,15 +185,17 @@ public class View { } UIManager.put(SubstanceLookAndFeel.COLORIZATION_FACTOR, 0.999);//This works for not changing labels color and not changing Dialogs title - UIManager.put("Tree.expandedIcon", getIcon("expand16")); - UIManager.put("Tree.collapsedIcon", getIcon("collapse16")); + if (View.isOceanic()) { + UIManager.put("Tree.expandedIcon", getIcon("expand16")); + UIManager.put("Tree.collapsedIcon", getIcon("collapse16")); + } UIManager.put("ColorChooserUI", BasicColorChooserUI.class.getName()); UIManager.put("ColorChooser.swatchesRecentSwatchSize", new Dimension(20, 20)); UIManager.put("ColorChooser.swatchesSwatchSize", new Dimension(20, 20)); UIManager.put("RibbonApplicationMenuPopupPanelUI", MyRibbonApplicationMenuPopupPanelUI.class.getName()); UIManager.put("RibbonApplicationMenuButtonUI", MyRibbonApplicationMenuButtonUI.class.getName()); UIManager.put("ProgressBarUI", MyProgressBarUI.class.getName()); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { UIManager.put("TextField.background", Color.white); UIManager.put("FormattedTextField.background", Color.white); } @@ -696,4 +698,8 @@ public class View { return image; } + + public static boolean isOceanic() { + return SubstanceLookAndFeel.getCurrentSkin() instanceof OceanicSkin; + } } diff --git a/src/com/jpexs/decompiler/flash/gui/abc/TraitsList.java b/src/com/jpexs/decompiler/flash/gui/abc/TraitsList.java index 8a570f304..5d21ae781 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/TraitsList.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/TraitsList.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.gui.abc; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.configuration.Configuration; +import com.jpexs.decompiler.flash.gui.View; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import java.awt.AlphaComposite; import java.awt.Color; @@ -58,7 +59,7 @@ public class TraitsList extends JList implements ListSelectionListener { this.abcPanel = abcPanel; setCellRenderer(new IconListRenderer()); //setUI(new BasicListUI()); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { setBackground(Color.white); } } diff --git a/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java b/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java index 76367f049..0a3eeeb3e 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/UsageFrame.java @@ -78,7 +78,7 @@ public class UsageFrame extends AppDialog implements MouseListener { usageListModel.addElement(u); } usageList = new JList<>(usageListModel); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { usageList.setBackground(Color.white); } gotoButton.addActionListener(this::gotoButtonActionPerformed); diff --git a/src/com/jpexs/decompiler/flash/gui/action/AddScriptDialog.java b/src/com/jpexs/decompiler/flash/gui/action/AddScriptDialog.java index 059316b2a..2d19e04dd 100644 --- a/src/com/jpexs/decompiler/flash/gui/action/AddScriptDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/action/AddScriptDialog.java @@ -241,7 +241,7 @@ public class AddScriptDialog extends AppDialog { frameList = new JList<>(framesArr); final ImageIcon frameIcon = View.getIcon("frame16"); final ImageIcon frameInvalidIcon = View.getIcon("frameinvalid16"); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { frameList.setBackground(Color.white); } frameList.setCellRenderer(new DefaultListCellRenderer() { @@ -332,7 +332,7 @@ public class AddScriptDialog extends AppDialog { final ImageIcon spriteIcon = View.getIcon("sprite16"); final ImageIcon spriteInvalidIcon = View.getIcon("spriteinvalid16"); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { spriteInitList.setBackground(Color.white); } spriteInitList.setCellRenderer(new DefaultListCellRenderer() { @@ -387,7 +387,7 @@ public class AddScriptDialog extends AppDialog { spriteFrameTree.setCellRenderer(new DefaultTreeCellRenderer() { { - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { setUI(new BasicLabelUI()); setOpaque(false); setBackgroundNonSelectionColor(Color.white); @@ -417,7 +417,7 @@ public class AddScriptDialog extends AppDialog { } }); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { spriteFrameTree.setBackground(Color.white); } spriteFrameTree.setRootVisible(false); @@ -457,7 +457,7 @@ public class AddScriptDialog extends AppDialog { } buttonList = new JList<>(buttons.toArray(new DefineButton2Tag[buttons.size()])); final ImageIcon buttonIcon = View.getIcon("button16"); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { buttonList.setBackground(Color.white); } buttonList.setCellRenderer(new DefaultListCellRenderer() { @@ -629,7 +629,7 @@ public class AddScriptDialog extends AppDialog { instanceTree.setCellRenderer(new DefaultTreeCellRenderer() { { - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { setUI(new BasicLabelUI()); setOpaque(false); setBackgroundNonSelectionColor(Color.white); @@ -658,7 +658,7 @@ public class AddScriptDialog extends AppDialog { }); instanceTree.addTreeSelectionListener(this::instanceValueChanged); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { instanceTree.setBackground(Color.white); } diff --git a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java index ee289b0c3..bef86a99a 100644 --- a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java +++ b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpTree.java @@ -117,7 +117,7 @@ public class DumpTree extends JTree { public class DumpTreeCellRenderer extends DefaultTreeCellRenderer { public DumpTreeCellRenderer() { - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { setUI(new BasicLabelUI()); setOpaque(false); setBackgroundNonSelectionColor(Color.white); @@ -236,7 +236,7 @@ public class DumpTree extends JTree { this.mainPanel = mainPanel; setCellRenderer(new DumpTreeCellRenderer()); setRootVisible(false); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { setBackground(Color.white); setUI(new BasicTreeUI() { { diff --git a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpViewPanel.java b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpViewPanel.java index 48e80f6b0..c024d824d 100644 --- a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpViewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpViewPanel.java @@ -209,7 +209,7 @@ public class DumpViewPanel extends JPanel { } private void doSearch() { - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { filterField.setBackground(Color.white); } diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index 78fad0a5f..9fa73b999 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -540,7 +540,3 @@ config.description.autoCloseParenthesis = Automatically inserts closing parenthe config.name.showDialogOnError = Show error dialog on every error config.description.showDialogOnError = Automatically displays error dialog on every error occurrence - -config.name.setControlsBackgroundToWhite = Set background color of edit/treeview components to white -config.description.setControlsBackgroundToWhite = Override background color of edit/treeview components and set it to white - diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java index 69970789e..50e6d2639 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java @@ -172,9 +172,9 @@ public class TagTree extends JTree { private Font boldFont; public TagTreeCellRenderer() { - if (Configuration.setControlsBackgroundToWhite.get()) { - setUI(new BasicLabelUI()); - setOpaque(false); + setUI(new BasicLabelUI()); + setOpaque(false); + if (View.isOceanic()) { setBackgroundNonSelectionColor(Color.white); } } @@ -243,7 +243,7 @@ public class TagTree extends JTree { plainFont = font.deriveFont(Font.PLAIN); } setFont(isModified ? boldFont : plainFont); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { if (isReadOnly) { setForeground(new Color(0xcc, 0xcc, 0xcc)); } else { @@ -260,14 +260,14 @@ public class TagTree extends JTree { this.mainPanel = mainPanel; setCellRenderer(new TagTreeCellRenderer()); setRootVisible(false); - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { setBackground(Color.white); } setRowHeight(Math.max(getFont().getSize() + 5, 16)); setLargeModel(true); setUI(new BasicTreeUI() { { - if (Configuration.setControlsBackgroundToWhite.get()) { + if (View.isOceanic()) { setHashColor(Color.gray); } }