White background only on oceanic skin

This commit is contained in:
Jindra Petřík
2021-04-07 19:38:25 +02:00
parent 8890a327da
commit 211aa60011
18 changed files with 75 additions and 52 deletions

View File

@@ -725,10 +725,6 @@ public final class Configuration {
@ConfigurationInternal
public static ConfigurationItem<Boolean> showDialogOnError = null;
@ConfigurationDefaultBoolean(false)
@ConfigurationCategory("ui")
public static ConfigurationItem<Boolean> setControlsBackgroundToWhite = null;
private enum OSId {
WINDOWS, OSX, UNIX
}

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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");

View File

@@ -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<String>(listModel);
if (Configuration.setControlsBackgroundToWhite.get()) {
if (View.isOceanic()) {
filesList.setBackground(Color.white);
}
cnt.add(new FasterScrollPane(filesList), BorderLayout.CENTER);

View File

@@ -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);

View File

@@ -308,7 +308,7 @@ public class LoadFromMemoryFrame extends AppFrame {
}
}
if (!isSelected) {
if (Configuration.setControlsBackgroundToWhite.get()) {
if (View.isOceanic()) {
label.setBackground(Color.white);
}
}

View File

@@ -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);

View File

@@ -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<TagInfo.TagInfoItem> items = tagInfo.getInfos().get(categoryName);
result += "<tr bgcolor='#FDFDFD'>";
if (View.isOceanic()) {
result += "<tr bgcolor='#FDFDFD'>";
} else {
result += "</tr>";
}
result += "<td width='50%' style='text-align:center;'>";
result += mainPanel.translate("tagInfo.header.name");
result += "</td>";
@@ -100,7 +105,11 @@ public class TagInfoPanel extends JPanel {
flipFlop = !flipFlop;
result += "<tr bgcolor='" + (flipFlop ? "#FDFDFD" : "#F4F4F4") + "'>";
if (View.isOceanic()) {
result += "<tr bgcolor='" + (flipFlop ? "#FDFDFD" : "#F4F4F4") + "'>";
} else {
result += "<tr>";
}
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());
}
}

View File

@@ -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;
}
}

View File

@@ -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<Object> implements ListSelectionListener {
this.abcPanel = abcPanel;
setCellRenderer(new IconListRenderer());
//setUI(new BasicListUI());
if (Configuration.setControlsBackgroundToWhite.get()) {
if (View.isOceanic()) {
setBackground(Color.white);
}
}

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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() {
{

View File

@@ -209,7 +209,7 @@ public class DumpViewPanel extends JPanel {
}
private void doSearch() {
if (Configuration.setControlsBackgroundToWhite.get()) {
if (View.isOceanic()) {
filterField.setBackground(Color.white);
}

View File

@@ -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

View File

@@ -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);
}
}