GP-1981 - Checkpoint - Initial Theming

This commit is contained in:
ghidragon 2022-04-09 20:24:28 +08:00
parent 38292de02c
commit f808431251
108 changed files with 4355 additions and 738 deletions

View file

@ -23,6 +23,7 @@ import javax.swing.*;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import docking.theme.GColor;
import docking.widgets.label.GDHtmlLabel;
import ghidra.util.HTMLUtilities;
@ -118,7 +119,7 @@ public abstract class AbstractDetailsPanel extends JPanel {
textLabel.setVerticalAlignment(SwingConstants.TOP);
textLabel.setOpaque(true);
textLabel.setBackground(Color.WHITE);
textLabel.setBackground(new GColor("color.bg.panel.details"));
sp = new JScrollPane(textLabel);
sp.getVerticalScrollBar().setUnitIncrement(10);
sp.setPreferredSize(new Dimension(MIN_WIDTH, 200));

View file

@ -15,7 +15,6 @@
*/
package ghidra.framework.plugintool.dialog;
import java.awt.Color;
import java.awt.Point;
import java.util.*;
@ -26,6 +25,7 @@ import javax.swing.text.StyleConstants;
import docking.action.DockingActionIf;
import docking.action.MenuData;
import docking.actions.KeyBindingUtils;
import docking.theme.GColor;
import ghidra.framework.plugintool.PluginConfigurationModel;
import ghidra.framework.plugintool.PluginTool;
import ghidra.framework.plugintool.util.PluginDescription;
@ -241,64 +241,75 @@ class PluginDetailsPanel extends AbstractDetailsPanel {
@Override
protected void createFieldAttributes() {
titleAttrSet = new SimpleAttributeSet();
titleAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
titleAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
titleAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
titleAttrSet.addAttribute(StyleConstants.Foreground, new Color(140, 0, 0));
titleAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.title"));
nameAttrSet = new SimpleAttributeSet();
nameAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
nameAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
nameAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
nameAttrSet.addAttribute(StyleConstants.Foreground, new Color(0, 204, 51));
nameAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.name.no-dependents"));
depNameAttrSet = new SimpleAttributeSet();
depNameAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
depNameAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
depNameAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
depNameAttrSet.addAttribute(StyleConstants.Foreground, Color.RED);
depNameAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.name.has-dependents"));
descrAttrSet = new SimpleAttributeSet();
descrAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
descrAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
descrAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
descrAttrSet.addAttribute(StyleConstants.Foreground, Color.BLUE);
descrAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.description"));
categoriesAttrSet = new SimpleAttributeSet();
categoriesAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
categoriesAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
categoriesAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
categoriesAttrSet.addAttribute(StyleConstants.Foreground, new Color(204, 0, 204));
categoriesAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.category"));
classAttrSet = new SimpleAttributeSet();
classAttrSet.addAttribute(StyleConstants.FontFamily, "monospaced");
classAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
classAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
classAttrSet.addAttribute(StyleConstants.Foreground, Color.BLACK);
classAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.class"));
locAttrSet = new SimpleAttributeSet();
locAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
locAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
locAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
locAttrSet.addAttribute(StyleConstants.Foreground, Color.DARK_GRAY);
locAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.loc"));
developerAttrSet = new SimpleAttributeSet();
developerAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
developerAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
developerAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
developerAttrSet.addAttribute(StyleConstants.Foreground, new Color(230, 15, 85));
developerAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.developer"));
dependencyAttrSet = new SimpleAttributeSet();
dependencyAttrSet.addAttribute(StyleConstants.FontFamily, "monospaced");
dependencyAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
dependencyAttrSet.addAttribute(StyleConstants.Bold, Boolean.TRUE);
dependencyAttrSet.addAttribute(StyleConstants.Foreground, new Color(23, 100, 30));
dependencyAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.dependency"));
noValueAttrSet = new SimpleAttributeSet();
noValueAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
noValueAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
noValueAttrSet.addAttribute(StyleConstants.Italic, Boolean.TRUE);
noValueAttrSet.addAttribute(StyleConstants.Foreground, new Color(192, 192, 192));
noValueAttrSet.addAttribute(StyleConstants.Foreground,
new GColor("color.fg.pluginpanel.details.novalue"));
}
}

View file

@ -23,6 +23,8 @@ import javax.swing.*;
import javax.swing.event.HyperlinkEvent.EventType;
import docking.EmptyBorderToggleButton;
import docking.theme.GColor;
import docking.theme.GThemeDefaults;
import docking.widgets.HyperlinkComponent;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.*;
@ -45,7 +47,7 @@ public class PluginManagerComponent extends JPanel implements Scrollable {
PluginManagerComponent(PluginTool tool, PluginConfigurationModel model) {
super(new VerticalLayout(2));
setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
setBackground(Color.WHITE);
setBackground(new GColor("color.bg"));
this.tool = tool;
this.model = model;
model.setChangeCallback(this::updateCheckboxes);
@ -114,7 +116,7 @@ public class PluginManagerComponent extends JPanel implements Scrollable {
//=================================================================================================
private class PluginPackageComponent extends JPanel {
private final Color BG = Color.white;
private Color BG = new GColor("color.bg");
private final PluginPackage pluginPackage;
private final GCheckBox checkBox;
@ -129,7 +131,7 @@ public class PluginManagerComponent extends JPanel implements Scrollable {
initializeLabelSection();
initializeDescriptionSection();
setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
setBorder(BorderFactory.createLineBorder(GThemeDefaults.Colors.Java.BORDER));
updateCheckBoxState();
}
@ -152,8 +154,7 @@ public class PluginManagerComponent extends JPanel implements Scrollable {
if (icon == null) {
icon = DEFAULT_ICON;
}
JLabel iconLabel =
new GIconLabel(ResourceManager.getScaledIcon(icon, 32, 32, 32));
JLabel iconLabel = new GIconLabel(ResourceManager.getScaledIcon(icon, 32, 32, 32));
iconLabel.setBackground(BG);
checkboxPanel.add(iconLabel);
@ -176,7 +177,7 @@ public class PluginManagerComponent extends JPanel implements Scrollable {
GLabel nameLabel = new GLabel(pluginPackage.getName());
nameLabel.setFont(nameLabel.getFont().deriveFont(18f));
nameLabel.setForeground(Color.BLACK);
nameLabel.setForeground(new GColor("color.fg.pluginpanel.name"));
labelPanel.add(nameLabel);
HyperlinkComponent configureHyperlink = createConfigureHyperlink();
@ -207,7 +208,7 @@ public class PluginManagerComponent extends JPanel implements Scrollable {
String htmlDescription = enchanceDescription(pluginPackage.getDescription());
JLabel descriptionlabel = new GHtmlLabel(htmlDescription);
descriptionlabel.setForeground(Color.GRAY);
descriptionlabel.setForeground(new GColor("color.fg.pluginpanel.description"));
descriptionlabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
descriptionlabel.setVerticalAlignment(SwingConstants.TOP);
descriptionlabel.setToolTipText(