GP-2846 - Theming Documentation

This commit is contained in:
dragonmacher
2023-05-02 13:33:19 -04:00
parent 07fc63f99f
commit d4eae5ff3c
74 changed files with 903 additions and 598 deletions
@@ -20,7 +20,7 @@ import java.awt.Graphics;
import java.util.HashMap;
import java.util.Map;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.program.model.address.AddressRange;
import ghidra.trace.model.Lifespan;
@@ -137,7 +137,7 @@ public class MemoryBox {
int w = vertical ? getTimePixelWidth() : getAddressPixelWidth();
int y = vertical ? getAddressPixelStart() : getTimePixelStart();
int h = vertical ? getAddressPixelWidth() : getTimePixelWidth();
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.fillRect(x - 1, y - 1, w + 2, h + 2);
g.setColor(color);
g.fillRect(x, y, w, h);
@@ -148,7 +148,7 @@ public class MemoryBox {
int w = vertical ? sz : getAddressPixelWidth();
int y = vertical ? getAddressPixelStart() : 0;
int h = vertical ? getAddressPixelWidth() : sz;
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.fillRect(x - 1, y - 1, w + 2, h + 2);
g.setColor(color);
g.fillRect(x, y, w, h);
@@ -159,7 +159,7 @@ public class MemoryBox {
int w = vertical ? 1 : sz;
int y = vertical ? 0 : getTimePixelStart();
int h = vertical ? sz : 1;
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.fillRect(x - 1, y - 1, w + 2, h + 2);
g.setColor(color);
g.fillRect(x, y, w, h);
@@ -23,7 +23,7 @@ import java.util.List;
import javax.swing.*;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressRange;
@@ -64,7 +64,7 @@ public class MemviewPanel extends JPanel implements MouseListener, MouseMotionLi
this.provider = provider;
setPreferredSize(new Dimension(barWidth, barHeight));
setSize(getPreferredSize());
setBorder(BorderFactory.createLineBorder(Java.BORDER, 1));
setBorder(BorderFactory.createLineBorder(Colors.BORDER, 1));
setFocusable(true);
addMouseListener(this);
@@ -29,7 +29,7 @@ import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GDHtmlLabel;
import docking.widgets.label.GLabel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.merge.util.ConflictUtility;
import ghidra.util.HTMLUtilities;
import ghidra.util.layout.MaximizeSpecificColumnGridLayout;
@@ -46,7 +46,7 @@ public class VariousChoicesPanel extends ConflictPanel {
private final static long serialVersionUID = 1;
private static final Border UNDERLINE_BORDER =
BorderFactory.createMatteBorder(0, 0, 1, 0, Java.BORDER);
BorderFactory.createMatteBorder(0, 0, 1, 0, Colors.BORDER);
private JPanel rowPanel;
private GDHtmlLabel headerLabel;
@@ -29,7 +29,7 @@ import docking.widgets.button.GRadioButton;
import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GDHtmlLabel;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.merge.util.ConflictUtility;
import ghidra.util.HTMLUtilities;
import ghidra.util.datastruct.LongArrayList;
@@ -190,7 +190,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
headerComps[i] = new MyLabel(items[i]);
headerComps[i].setName(getComponentName(0, i));
setRowComponent(headerComps[i], 0, i, defaultInsets);
headerComps[i].setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Java.BORDER));
headerComps[i].setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Colors.BORDER));
}
}
rowPanel.validate();
@@ -21,7 +21,7 @@ import java.beans.PropertyEditorSupport;
import javax.swing.*;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.framework.options.CustomOptionsEditor;
import ghidra.util.layout.PairLayout;
@@ -116,7 +116,7 @@ public class StoredAnalyzerTimesPropertyEditor extends PropertyEditorSupport
new JTextField(StoredAnalyzerTimes.formatTimeMS(times.getTotalTime()));
valueField.setEditable(false);
valueField.setHorizontalAlignment(SwingConstants.RIGHT);
valueField.setBorder(BorderFactory.createLineBorder(Java.BORDER, 2));
valueField.setBorder(BorderFactory.createLineBorder(Colors.BORDER, 2));
panel.add(valueField);
return panel;
@@ -26,8 +26,6 @@ import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.TableModel;
import org.apache.commons.lang3.ObjectUtils;
import docking.*;
import docking.action.*;
import docking.widgets.OptionDialog;
@@ -41,11 +39,8 @@ import docking.widgets.pathmanager.PathnameTablePanel;
import docking.widgets.table.GTableCellRenderer;
import docking.widgets.table.GTableCellRenderingData;
import generic.jar.ResourceFile;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.app.plugin.core.processors.SetLanguageDialog;
import ghidra.app.util.Option;
import ghidra.app.util.cparser.C.CParserUtils;
import ghidra.app.util.exporter.Exporter;
import ghidra.framework.Application;
import ghidra.framework.options.SaveState;
import ghidra.framework.preferences.Preferences;
@@ -139,13 +134,15 @@ class ParseDialog extends ReusableDialogComponentProvider {
if (currentProfileName != null) {
for (int i = 0; i < itemList.size(); i++) {
ComboBoxItem item = itemList.get(i);
if (userDefined == item.isUserDefined && currentProfileName.equals(item.file.getName())) {
if (userDefined == item.isUserDefined &&
currentProfileName.equals(item.file.getName())) {
comboBox.setSelectedIndex(i);
break;
}
}
}
} else {
}
else {
toFront();
}
}
@@ -245,8 +242,7 @@ class ParseDialog extends ReusableDialogComponentProvider {
label.setText(pathName.toString());
if (!fileExists) {
label.setForeground(data.isSelected() ? Tables.FG_ERROR_SELECTED
: Tables.FG_ERROR_UNSELECTED);
label.setForeground(getErrorForegroundColor(data.isSelected()));
}
return label;
@@ -304,11 +300,11 @@ class ParseDialog extends ReusableDialogComponentProvider {
parseToFileButton.setToolTipText("Parse files and output to archive file");
addButton(parseToFileButton);
mainPanel.add(comboPanel, BorderLayout.NORTH);
includePathPanel.setPreferredSize(new Dimension(pathPanel.getPreferredSize().width, 200));
JSplitPane optionsPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, includePathPanel, optionsPanel);
JSplitPane optionsPane =
new JSplitPane(JSplitPane.VERTICAL_SPLIT, includePathPanel, optionsPanel);
optionsPane.setResizeWeight(0.50);
pathPanel.setPreferredSize(new Dimension(pathPanel.getPreferredSize().width, 200));
@@ -349,31 +345,31 @@ class ParseDialog extends ReusableDialogComponentProvider {
languageButton = new BrowseButton();
languageButton.addActionListener(e -> {
SetLanguageDialog dialog = new SetLanguageDialog(plugin.getTool(), languageIDString, compilerIDString,
"Select Program Architecture for File DataType Archive");
LanguageID languageId = dialog.getLanguageDescriptionID();
CompilerSpecID compilerSpecId = dialog.getCompilerSpecDescriptionID();
if ((languageId == null) || (compilerSpecId == null)) {
return;
}
SetLanguageDialog dialog = new SetLanguageDialog(plugin.getTool(), languageIDString,
compilerIDString, "Select Program Architecture for File DataType Archive");
LanguageID languageId = dialog.getLanguageDescriptionID();
CompilerSpecID compilerSpecId = dialog.getCompilerSpecDescriptionID();
if ((languageId == null) || (compilerSpecId == null)) {
return;
}
String newLanguageIDString = languageId.getIdAsString();
String newCompilerIDString = compilerSpecId.getIdAsString();
String newLanguageIDString = languageId.getIdAsString();
String newCompilerIDString = compilerSpecId.getIdAsString();
if (!Objects.equals(newLanguageIDString, languageIDString) ||
!Objects.equals(newCompilerIDString, compilerIDString)) {
itemChanged();
}
if (!Objects.equals(newLanguageIDString, languageIDString) ||
!Objects.equals(newCompilerIDString, compilerIDString)) {
itemChanged();
}
languageIDString = newLanguageIDString;
languageIDString = newLanguageIDString;
compilerIDString = newCompilerIDString;
updateArchitectureDescription();
updateArchitectureDescription();
});
updateArchitectureDescription();
updateArchitectureDescription();
languageButton.setName("Set Processor Architecture");
languageButton.setName("Set Processor Architecture");
Font font = languageButton.getFont();
languageButton.setFont(font.deriveFont(Font.BOLD));
@@ -387,11 +383,11 @@ class ParseDialog extends ReusableDialogComponentProvider {
String newProgramArchitectureSummary = "64/32 (primarily for backward compatibility)";
if (languageIDString != null) {
StringBuilder buf = new StringBuilder();
buf.append(languageIDString);
buf.append(" / ");
buf.append(compilerIDString != null ? compilerIDString : "none");
newProgramArchitectureSummary = buf.toString();
StringBuilder buf = new StringBuilder();
buf.append(languageIDString);
buf.append(" / ");
buf.append(compilerIDString != null ? compilerIDString : "none");
newProgramArchitectureSummary = buf.toString();
}
languageTextField.setText(newProgramArchitectureSummary);
@@ -691,7 +687,6 @@ class ParseDialog extends ReusableDialogComponentProvider {
}
}
String[] paths = new String[pathList.size()];
paths = pathList.toArray(paths);
pathPanel.setPaths(paths);
@@ -706,7 +701,7 @@ class ParseDialog extends ReusableDialogComponentProvider {
compilerIDString = compileString;
updateArchitectureDescription();
updateArchitectureDescription();
br.close();
}
@@ -749,7 +744,7 @@ class ParseDialog extends ReusableDialogComponentProvider {
writer.newLine();
// Write paths
String [] includePaths = includePathPanel.getPaths();
String[] includePaths = includePathPanel.getPaths();
for (String path : includePaths) {
writer.write(path.trim());
writer.newLine();
@@ -809,16 +804,17 @@ class ParseDialog extends ReusableDialogComponentProvider {
paths = expandPaths(paths);
pathPanel.setPaths(paths);
if (languageIDString == null || compilerIDString == null ) {
if (languageIDString == null || compilerIDString == null) {
Msg.showWarn(getClass(), rootPanel, "Program Architecture not Specified",
"A Program Architecture must be specified in order to parse to a file.");
return;
"A Program Architecture must be specified in order to parse to a file.");
return;
}
if (parseToFile) {
File file = getSaveFile();
if (file != null) {
plugin.parse(paths, includePaths, options, languageIDString, compilerIDString, file.getAbsolutePath());
plugin.parse(paths, includePaths, options, languageIDString, compilerIDString,
file.getAbsolutePath());
}
}
else {
@@ -996,11 +992,7 @@ class ParseDialog extends ReusableDialogComponentProvider {
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((file == null) ? 0 : file.hashCode());
result = prime * result + (isUserDefined ? 1231 : 1237);
return result;
return Objects.hash(file, isUserDefined);
}
}
@@ -1022,50 +1014,49 @@ class ParseDialog extends ReusableDialogComponentProvider {
// Methods for Testing
//==================================================================================================
GhidraComboBox<ParseDialog.ComboBoxItem> getParseComboBox() {
return comboBox;
}
GhidraComboBox<ParseDialog.ComboBoxItem> getParseComboBox() {
return comboBox;
}
PathnameTablePanel getSourceFiles() {
return this.pathPanel;
}
PathnameTablePanel getSourceFiles() {
return this.pathPanel;
}
PathnameTablePanel getIncludePaths() {
return this.includePathPanel;
}
PathnameTablePanel getIncludePaths() {
return this.includePathPanel;
}
JTextArea getParseOptionsTextField() {
return this.parseOptionsField;
}
JTextArea getParseOptionsTextField() {
return this.parseOptionsField;
}
JButton getLanguageButton() {
return this.languageButton;
}
JButton getLanguageButton() {
return this.languageButton;
}
JTextField getLanguageText() {
return this.languageTextField;
}
JTextField getLanguageText() {
return this.languageTextField;
}
JButton getParseButton() {
return this.parseButton;
}
JButton getParseButton() {
return this.parseButton;
}
JButton getParseToFileButton() {
return this.parseToFileButton;
}
JButton getParseToFileButton() {
return this.parseToFileButton;
}
ArrayList<ComboBoxItem> getProfiles() {
return this.itemList;
}
ArrayList<ComboBoxItem> getProfiles() {
return this.itemList;
}
ComboBoxItem getCurrentItem() {
ComboBoxItem item = (ComboBoxItem) comboBox.getSelectedItem();
ComboBoxItem getCurrentItem() {
ComboBoxItem item = (ComboBoxItem) comboBox.getSelectedItem();
return item;
}
return item;
}
ResourceFile getUserProfileParent() {
return parentUserFile;
}
ResourceFile getUserProfileParent() {
return parentUserFile;
}
}
@@ -25,7 +25,6 @@ import javax.swing.JTable;
import docking.widgets.table.*;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.app.util.ToolTipUtils;
import ghidra.docking.settings.FormatSettingsDefinition;
import ghidra.docking.settings.Settings;
@@ -156,8 +155,7 @@ class EquateTableModel extends GDynamicColumnTableModel<Equate, Object> {
JTable table = data.getTable();
if (!eq.isValidUUID()) { // Error equate
label.setForeground(
(isSelected) ? table.getSelectionForeground() : Tables.FG_ERROR_UNSELECTED);
label.setForeground(getErrorForegroundColor(isSelected));
}
else if (!eq.isEnumBased()) { // User label
label.setForeground(
@@ -39,7 +39,7 @@ import docking.widgets.label.GLabel;
import docking.widgets.table.*;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.*;
import generic.theme.GThemeDefaults.Colors.Palette;
import generic.util.WindowUtilities;
import ghidra.app.services.DataTypeManagerService;
import ghidra.app.util.ToolTipUtils;
@@ -213,7 +213,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
thunkedText.setEditable(false);
DockingUtils.setTransparent(thunkedText);
CompoundBorder border =
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Java.BORDER),
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Colors.BORDER),
BorderFactory.createEmptyBorder(0, 5, 0, 5));
thunkedText.setBorder(border);
thunkedText.setForeground(FunctionColors.THUNK);
@@ -652,13 +652,12 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
DataType dataType = (DataType) value;
Color color = isSelected ? table.getSelectionForeground() : table.getForeground();
if (!tableModel.isCellEditable(row, column)) {
color =
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED;
color = getUneditableForegroundColor(isSelected);
}
if (dataType != null) {
setText(dataType.getName());
if (dataType.isNotYetDefined()) {
color = isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED;
color = getErrorForegroundColor(isSelected);
}
String toolTipText = ToolTipUtils.getToolTipText(dataType);
String headerText = "<HTML><b>" +
@@ -782,8 +781,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
boolean isInvalidStorage =
!storage.isValid() || rowData.getFormalDataType().getLength() != storage.size();
if (isInvalidStorage) {
setForeground(
isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED);
setForeground(getErrorForegroundColor(isSelected));
setToolTipText("Invalid Parameter Storage");
}
else {
@@ -818,8 +816,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
ParameterTableModel tableModel = (ParameterTableModel) table.getModel();
if (!tableModel.isCellEditable(row, column)) {
setForeground(
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED);
setForeground(getUneditableForegroundColor(isSelected));
}
else {
if (isSelected) {
@@ -15,6 +15,7 @@
*/
package ghidra.app.plugin.core.function.editor;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.MouseEvent;
import java.util.EventObject;
@@ -53,8 +54,7 @@ class StorageTableCellEditor extends AbstractCellEditor implements TableCellEdit
boolean isSelected, int row, int column) {
String stringValue = value == null ? "" : value.toString();
JTextField field = new JTextField(stringValue);
field.setBackground(
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED);
field.setBackground(getUneditableForegroundColor(isSelected));
field.setEditable(false);
ParameterTableModel tableModel = (ParameterTableModel) table.getModel();
FunctionVariableData rowData = tableModel.getRowObject(row);
@@ -78,4 +78,9 @@ class StorageTableCellEditor extends AbstractCellEditor implements TableCellEdit
});
return field;
}
protected Color getUneditableForegroundColor(boolean isSelected) {
return isSelected ? Tables.UNEDITABLE_SELECTED : Tables.UNEDITABLE_UNSELECTED;
}
}
@@ -27,7 +27,7 @@ import org.apache.commons.lang3.StringUtils;
import docking.widgets.label.GLabel;
import docking.widgets.textfield.HintTextField;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.cmd.function.CreateFunctionTagCmd;
import ghidra.app.context.ProgramActionContext;
import ghidra.framework.cmd.Command;
@@ -239,9 +239,9 @@ public class FunctionTagProvider extends ComponentProviderAdapter
targetPanel = new TargetTagsPanel(this, tool, "Assigned To Function");
allFunctionsPanel = new AllFunctionsPanel(program, this, "Functions with Selected Tag");
buttonPanel = new FunctionTagButtonPanel(sourcePanel, targetPanel);
sourcePanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
targetPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
allFunctionsPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
sourcePanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
targetPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
allFunctionsPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
// If we don't set this, then the splitter won't be able to shrink the
// target panels below the size required by its header, which can be large
@@ -24,8 +24,8 @@ import javax.swing.JToolTip;
import docking.widgets.fieldpanel.field.Field;
import docking.widgets.fieldpanel.support.FieldLocation;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Messages;
import generic.theme.GThemeDefaults.Colors.Tooltips;
import ghidra.app.plugin.core.gotoquery.GoToHelper;
import ghidra.app.services.CodeFormatService;
import ghidra.app.util.*;
@@ -46,7 +46,7 @@ import ghidra.util.bean.opteditor.OptionsVetoException;
public abstract class AbstractReferenceHover extends AbstractConfigurableHover {
private static final int WINDOW_OFFSET = 50;
private static final Color BACKGROUND_COLOR = Colors.BG_TOOLTIP;
private static final Color BACKGROUND_COLOR = Tooltips.BACKGROUND;
private static final Color FG_COLOR_NOT_IN_MEMORY = Messages.HINT;
private CodeFormatService codeFormatService;
@@ -21,7 +21,7 @@ import java.awt.GridBagLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
/**
@@ -57,7 +57,7 @@ public class ControlPanel extends JPanel {
gbc.weightx = 1.0;
this.add(directionWidget, gbc);
this.setBorder(BorderFactory.createLineBorder(Java.BORDER));
this.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
}
public SelectionScopeWidget getRangeWidget() {
@@ -25,20 +25,14 @@ import javax.swing.border.EmptyBorder;
import javax.swing.event.ListDataListener;
import docking.widgets.list.GListCellRenderer;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Tooltips;
import generic.util.WindowUtilities;
import ghidra.app.plugin.core.console.CodeCompletion;
/**
* This class encapsulates a code completion popup Window for the ConsolePlugin.
*
*
*
*/
public class CodeCompletionWindow extends JDialog {
private static final long serialVersionUID = 1L;
/* from ReferenceHoverPlugin */
private static final Color BACKGROUND_COLOR = Colors.BG_TOOLTIP;
protected final InterpreterPanel console;
protected final JTextPane outputTextField;
@@ -50,17 +44,6 @@ public class CodeCompletionWindow extends JDialog {
/* current list of completions */
protected JList jlist;
/**
* Constructs a new CodeCompletionWindow.
*
* We pass in the PluginTool so we can get a reference to the Frame we are
* popping up over, as well as the text field we are coming from (so we
* can fine-tune where we pop up).
*
* @param tool the PluginTool the has the Frame we are popping up over
* @param console the ConsolePlugin we are providing services for
* @param outputTextField the JTextField from whence we came
*/
public CodeCompletionWindow(Window parent, InterpreterPanel cp, JTextPane textField) {
super(parent);
@@ -73,7 +56,7 @@ public class CodeCompletionWindow extends JDialog {
/* don't steal focus from text input! */
setFocusableWindowState(false);
jlist.setBackground(BACKGROUND_COLOR);
jlist.setBackground(Tooltips.BACKGROUND);
jlist.setCellRenderer(new CodeCompletionListCellRenderer());
/* add the ability to double-click a code completion */
MouseListener mouseListener = new MouseAdapter() {
@@ -405,9 +388,6 @@ class CodeCompletionListSelectionModel extends DefaultListSelectionModel {
/**
* Renders CodeCompletions for the CodeCompletionWindow.
*
*
*
*/
class CodeCompletionListCellRenderer extends GListCellRenderer<CodeCompletion> {
@@ -425,14 +405,14 @@ class CodeCompletionListCellRenderer extends GListCellRenderer<CodeCompletion> {
@Override
public Component getListCellRendererComponent(JList<? extends CodeCompletion> list,
CodeCompletion codeCompletion, int index, boolean isSelected, boolean cellHasFocus) {
if (null == codeCompletion.getComponent()) {
if (codeCompletion.getComponent() == null) {
return super.getListCellRendererComponent(list, codeCompletion, index, isSelected,
cellHasFocus);
}
/* ooh, we have a fancy component! */
JComponent component = codeCompletion.getComponent();
/* if it's selected, make sure it shows up that way */
// if it's selected, make sure it shows up that way
component.setOpaque(true);
if (isSelected) {
component.setBackground(list.getSelectionBackground());
@@ -440,7 +420,7 @@ class CodeCompletionListCellRenderer extends GListCellRenderer<CodeCompletion> {
else {
component.setBackground(list.getBackground());
}
/* other nice formatting stuff */
component.setEnabled(list.isEnabled());
component.setFont(list.getFont());
component.setComponentOrientation(list.getComponentOrientation());
@@ -21,7 +21,6 @@ import java.util.*;
import org.apache.commons.lang3.StringUtils;
import docking.widgets.table.GTableCellRenderingData;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.docking.settings.Settings;
import ghidra.framework.plugintool.ServiceProvider;
import ghidra.program.model.address.Address;
@@ -127,8 +126,7 @@ class LocationReferencesTableModel extends AddressBasedTableModel<LocationRefere
//==================================================================================================
private class ContextTableColumn
extends
AbstractProgramBasedDynamicTableColumn<LocationReference, LocationReference> {
extends AbstractProgramBasedDynamicTableColumn<LocationReference, LocationReference> {
private ContextCellRenderer renderer = new ContextCellRenderer();
@@ -189,8 +187,7 @@ class LocationReferencesTableModel extends AddressBasedTableModel<LocationRefere
if (!StringUtils.isBlank(refType)) {
String trailingText = "";
if (rowObject.isOffcutReference()) {
setForeground(
isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED);
setForeground(getErrorForegroundColor(isSelected));
trailingText = OFFCUT_STRING;
}
return refType + trailingText;
@@ -20,7 +20,7 @@ import java.util.ArrayList;
import javax.swing.JPanel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.Gui;
public class KnotLabelPanel extends JPanel {
@@ -55,7 +55,7 @@ public class KnotLabelPanel extends JPanel {
int fontOffset = ascent / 3; // this looks about right
ArrayList<KnotRecord> knots = palette.getKnots();
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.drawLine(5, topBottomMargin - 6, 10, topBottomMargin - ascent + 2);
g.drawString("min entropy (0.0)", 20, topBottomMargin - ascent - descent);
@@ -70,7 +70,7 @@ public class KnotLabelPanel extends JPanel {
g.drawLine(5, y, 10, y);
}
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.drawLine(5, height + topBottomMargin + 4, 10, height + topBottomMargin + 8);
g.drawString("max entropy (8.0)", 20, topBottomMargin + height + ascent + descent);
@@ -19,7 +19,7 @@ import java.awt.*;
import javax.swing.JPanel;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
public class PalettePanel extends JPanel {
@@ -47,7 +47,7 @@ public class PalettePanel extends JPanel {
g.setColor(getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
if (palette == null) {
g.drawRect(0, 0, width - 1, height - 1);
return;
@@ -64,7 +64,7 @@ public class PalettePanel extends JPanel {
g.setColor(c);
g.fillRect(0, topBottomMargin + i, width, 1);
}
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.drawRect(0, topBottomMargin, width - 1, height);
}
@@ -31,7 +31,7 @@ import javax.swing.text.Document;
import docking.widgets.list.GListCellRenderer;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.program.model.listing.Program;
/**
@@ -154,7 +154,7 @@ class ProgramListPanel extends JPanel {
// add some padding around the panel
Border innerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5);
Border outerBorder = BorderFactory.createLineBorder(Java.BORDER);
Border outerBorder = BorderFactory.createLineBorder(Colors.BORDER);
Border compoundBorder = BorderFactory.createCompoundBorder(outerBorder, innerBorder);
setBorder(compoundBorder);
@@ -36,7 +36,6 @@ import docking.widgets.label.GDLabel;
import docking.widgets.label.GLabel;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import ghidra.app.util.AddressInput;
import ghidra.program.model.address.*;
import ghidra.program.model.listing.*;
@@ -534,7 +533,7 @@ class EditMemoryReferencePanel extends EditReferencePanel {
model = new HistoryTableModel(fromCodeUnit.getProgram());
displayTable = new JTable(model);
displayTable.setTableHeader(null);
displayTable.setBorder(new LineBorder(Java.BORDER));
displayTable.setBorder(new LineBorder(Colors.BORDER));
displayTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
displayTable.addMouseListener(new MouseAdapter() {
@@ -37,7 +37,6 @@ import docking.widgets.checkbox.GCheckBox;
import docking.widgets.table.*;
import generic.theme.GColor;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Colors.Tables;
import ghidra.app.events.ProgramSelectionPluginEvent;
import ghidra.app.util.SelectionTransferData;
import ghidra.app.util.SelectionTransferable;
@@ -136,8 +135,7 @@ public class EditReferencesProvider extends ComponentProviderAdapter
Memory memory = currentCodeUnit.getProgram().getMemory();
try {
Object data = e.getTransferable()
.getTransferData(
SelectionTransferable.localProgramSelectionFlavor);
.getTransferData(SelectionTransferable.localProgramSelectionFlavor);
AddressSetView view = ((SelectionTransferData) data).getAddressSet();
if (memory.contains(view)) {
return true;
@@ -289,8 +287,8 @@ public class EditReferencesProvider extends ComponentProviderAdapter
enableGotoReferenceLocation(gotoReferenceLocationToggleAction.isSelected());
}
};
gotoReferenceLocationToggleAction.setToolBarData(
new ToolBarData(SEND_LOCATION_ICON, "NavAction"));
gotoReferenceLocationToggleAction
.setToolBarData(new ToolBarData(SEND_LOCATION_ICON, "NavAction"));
gotoReferenceLocationToggleAction.setEnabled(true);
tool.addLocalAction(this, gotoReferenceLocationToggleAction);
@@ -890,8 +888,8 @@ public class EditReferencesProvider extends ComponentProviderAdapter
}
Reference ref = tableModel.getReference(row);
RefType[] refTypes = EditReferencesModel.getAllowedRefTypes(
EditReferencesProvider.this.currentProgram, ref);
RefType[] refTypes = EditReferencesModel
.getAllowedRefTypes(EditReferencesProvider.this.currentProgram, ref);
comboBox.removeAllItems();
int selectedIndex = -1;
@@ -913,10 +911,6 @@ public class EditReferencesProvider extends ComponentProviderAdapter
private class CellEditComboBox extends JComboBox<RefType> {
public CellEditComboBox() {
super();
}
@Override
public void setSelectedIndex(int anIndex) {
if (refsTable.getRowCount() == 0) {
@@ -1035,40 +1029,27 @@ public class EditReferencesProvider extends ComponentProviderAdapter
super.getTableCellRendererComponent(data);
JTable table = data.getTable();
int row = data.getRowViewIndex();
boolean isSelected = data.isSelected();
Reference ref = tableModel.getReference(row);
Address addr = ref.getToAddress();
Memory memory = tableModel.getProgram().getMemory();
boolean bad = addr.isMemoryAddress() ? !memory.contains(addr) : false;
setOpaque(false); // disable table striping
setFont(table.getFont());
// disable table striping when not selected to reduce clutter
setOpaque(isSelected);
if (isSelected) {
if (bad) {
setForeground(Tables.FG_ERROR_SELECTED);
setFont(boldFont);
}
else {
setFont(defaultFont);
}
setOpaque(true);
if (bad) {
setForeground(getErrorForegroundColor(isSelected));
setFont(boldFont);
}
else {
// set color to red if address does not exist in memory
setFont(defaultFont);
}
if (bad) {
setForeground(Tables.FG_ERROR_UNSELECTED);
setFont(boldFont);
}
else {
setFont(defaultFont);
}
// use a special color when not selected to show which row matches the operand
if (!isSelected) {
if (ref.getOperandIndex() == instrPanel.getSelectedOpIndex()) {
setBackground(BG_COLOR_ACTIVE_OPERAND);
setOpaque(true);
@@ -372,7 +372,7 @@ class GhidraScriptTableModel extends GDynamicColumnTableModel<ResourceFile, Obje
KeyBindingsInfo info = (KeyBindingsInfo) value;
if (info.errorMessage != null) {
component.setForeground(Tables.FG_ERROR_UNSELECTED);
component.setForeground(Tables.ERROR_UNSELECTED);
component.setToolTipText(info.errorMessage);
}
else {
@@ -394,7 +394,7 @@ class GhidraScriptTableModel extends GDynamicColumnTableModel<ResourceFile, Obje
if (isSelected) {
JTable table = data.getTable();
Color selectedForegroundColor =
(info.errorMessage != null) ? Tables.FG_ERROR_SELECTED
(info.errorMessage != null) ? Tables.ERROR_SELECTED
: table.getSelectionForeground();
component.setForeground(selectedForegroundColor);
}
@@ -28,7 +28,6 @@ import docking.widgets.checkbox.GCheckBox;
import docking.widgets.label.GLabel;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.Gui;
class TipOfTheDayDialog extends ReusableDialogComponentProvider {
@@ -88,7 +87,7 @@ class TipOfTheDayDialog extends ReusableDialogComponentProvider {
JPanel panel = new JPanel(new BorderLayout());
Border panelBorder =
BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10),
BorderFactory.createLineBorder(Java.BORDER));
BorderFactory.createLineBorder(Colors.BORDER));
panel.setBorder(panelBorder);
JLabel label = new GLabel("Did you know...", tipIcon, SwingConstants.LEFT);
@@ -48,7 +48,6 @@ import docking.widgets.table.threaded.ThreadedTableModel;
import docking.widgets.tree.GTree;
import generic.test.AbstractGenericTest;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors.Palette;
import generic.util.image.ImageUtils;
import ghidra.app.events.ProgramSelectionPluginEvent;
@@ -423,7 +422,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
captureComponent(window);
}
}
drawBorder(Java.BORDER);
drawBorder(Colors.BORDER);
}
public JPopupMenu getPopupMenu() {
@@ -1375,7 +1374,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
}
public void drawRectangleWithDropShadowAround(JComponent component, Color color, int padding) {
Rectangle r = drawRectangleAround(component, Java.BORDER, padding);
Rectangle r = drawRectangleAround(component, Colors.BORDER, padding);
// move it back a bit to create the drop-shadow effect
r.x -= padding;
@@ -1628,7 +1627,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(Java.BORDER);
g2.setColor(Colors.BORDER);
g2.setStroke(new BasicStroke(3f));
g2.draw(topPath);
g2.draw(bottomPath);
@@ -33,7 +33,7 @@ import docking.action.DockingAction;
import docking.action.ToolBarData;
import docking.widgets.combobox.GComboBox;
import docking.widgets.label.*;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Palette;
import ghidra.util.Msg;
import ghidra.util.bean.GGlassPane;
@@ -179,12 +179,12 @@ public class ImageDialogProvider extends DialogComponentProvider {
}
newLabelPanel.add(createImageLabelComponent("New Image"), BorderLayout.NORTH);
newLabelPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER, 20));
newLabelPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER, 20));
newLabelPanel.add(newImageLabel, BorderLayout.CENTER);
JPanel oldLabelPanel = new JPanel(new BorderLayout());
oldLabelPanel.add(createImageLabelComponent("Old Image"), BorderLayout.NORTH);
oldLabelPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER, 20));
oldLabelPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER, 20));
oldLabelPanel.add(oldImageLabel, BorderLayout.CENTER);
imagePanel.add(oldLabelPanel, BorderLayout.WEST);
@@ -20,7 +20,6 @@ import java.awt.event.MouseEvent;
import javax.swing.JComponent;
import generic.theme.GThemeDefaults.Colors;
import ghidra.app.plugin.core.functiongraph.graph.FGEdge;
import ghidra.app.plugin.core.functiongraph.graph.FGVertexType;
import ghidra.app.plugin.core.functiongraph.mvc.FGController;
@@ -40,14 +39,18 @@ import ghidra.program.util.ProgramSelection;
*/
public interface FGVertex extends VisualVertex {
static final Color TOOLTIP_BACKGROUND_COLOR = Colors.BG_TOOLTIP;
public FGVertex cloneVertex(FGController newController);
/** A chance for this vertex to save off changed settings */
/**
* A chance for this vertex to save off changed settings
* @param settings the settings
*/
public void writeSettings(FunctionGraphVertexAttributes settings);
/** A chance for this vertex to read in stored settings */
/**
* A chance for this vertex to read in stored settings
* @param settings the settings
*/
public void readSettings(FunctionGraphVertexAttributes settings);
public void restoreColor(Color color);
@@ -40,6 +40,7 @@ import docking.widgets.label.GDLabel;
import generic.theme.GColor;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Tooltips;
import ghidra.app.plugin.core.codebrowser.hover.ListingHoverService;
import ghidra.app.plugin.core.functiongraph.FunctionGraphPlugin;
import ghidra.app.plugin.core.functiongraph.graph.FGEdge;
@@ -203,7 +204,7 @@ public class ListingGraphComponentPanel extends AbstractGraphComponentPanel {
boolean useFullSizeTooltip = options.useFullSizeTooltip();
previewListingPanel = new FGVertexListingPanel(controller,
getFormatManager(useFullSizeTooltip), program, addressSet);
previewListingPanel.setTextBackgroundColor(FGVertex.TOOLTIP_BACKGROUND_COLOR);
previewListingPanel.setTextBackgroundColor(Tooltips.BACKGROUND);
previewListingPanel.getFieldPanel().setCursorOn(false);
// keep the tooltip window from getting too big; use an arbitrary, reasonable max
@@ -216,14 +217,14 @@ public class ListingGraphComponentPanel extends AbstractGraphComponentPanel {
tooltipTitleLabel = new GDLabel();
tooltipTitleLabel.setHorizontalAlignment(SwingConstants.LEADING);
tooltipTitleLabel.setBackground(FGVertex.TOOLTIP_BACKGROUND_COLOR);
tooltipTitleLabel.setBackground(Tooltips.BACKGROUND);
tooltipTitleLabel.setOpaque(true);
Font labelFont = tooltipTitleLabel.getFont();
tooltipTitleLabel.setFont(labelFont.deriveFont(Font.BOLD));
JPanel headerPanel = new JPanel(new BorderLayout());
headerPanel.add(tooltipTitleLabel);
headerPanel.setBorder(BorderFactory.createLineBorder(Colors.Java.BORDER));
headerPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
panel.add(headerPanel, BorderLayout.NORTH);
panel.add(previewListingPanel, BorderLayout.CENTER);
@@ -21,7 +21,7 @@ import java.awt.event.ActionListener;
import javax.swing.*;
import docking.widgets.label.GDLabel;
import generic.theme.GThemeDefaults;
import generic.theme.GThemeDefaults.Ids.Fonts;
import generic.theme.Gui;
import ghidra.feature.fid.db.*;
import ghidra.feature.fid.service.FidService;
@@ -38,6 +38,7 @@ public class FidFunctionDebugPanel extends JPanel {
/**
* Creates the panel.
* @param service the FID database service
* @param fidQueryService the query service
* @param functionRecord the function record to debug
*/
public FidFunctionDebugPanel(FidService service, FidQueryService fidQueryService,
@@ -57,7 +58,7 @@ public class FidFunctionDebugPanel extends JPanel {
JButton button = new JButton(text);
button.addActionListener(listener);
button.setHorizontalAlignment(SwingConstants.LEFT);
Gui.registerFont(button, GThemeDefaults.Ids.Fonts.MONOSPACED);
Gui.registerFont(button, Fonts.MONOSPACED);
add(button);
}
@@ -68,7 +69,7 @@ public class FidFunctionDebugPanel extends JPanel {
private void addLabel(String text) {
JLabel label = new GDLabel(text);
label.setHorizontalAlignment(SwingConstants.LEFT);
label.setFont(Gui.getFont("font.monospaced"));
Gui.registerFont(label, Fonts.MONOSPACED);
add(label);
}
@@ -85,16 +86,14 @@ public class FidFunctionDebugPanel extends JPanel {
libraryRecord.getLibraryVersion(), libraryRecord.getLibraryVariant(),
languageID.getIdAsString()));
addButton(String.format("0x%016x", functionRecord.getID()),
e -> FidDebugUtils.searchByFunctionID(functionRecord.getID(), service,
fidQueryService));
addButton(String.format("0x%016x", functionRecord.getID()), e -> FidDebugUtils
.searchByFunctionID(functionRecord.getID(), service, fidQueryService));
addButton(functionRecord.getName(),
e -> FidDebugUtils.searchByName(functionRecord.getName(), service, fidQueryService));
addButton(shorten(functionRecord.getDomainPath()),
e -> FidDebugUtils.searchByDomainPath(functionRecord.getDomainPath(), service,
fidQueryService));
addButton(shorten(functionRecord.getDomainPath()), e -> FidDebugUtils
.searchByDomainPath(functionRecord.getDomainPath(), service, fidQueryService));
addLabel(String.format("Entry Point: 0x%x", functionRecord.getEntryPoint()));
@@ -77,13 +77,13 @@ public class FidSearchDebugDialog extends DialogComponentProvider {
private JLabel getPreparedLabel(String text) {
JLabel label = new GDLabel(text, SwingConstants.RIGHT);
label.setFont(Gui.getFont(Fonts.MONOSPACED));
Gui.registerFont(label, Fonts.MONOSPACED);
return label;
}
private JTextField getPreparedTextField() {
JTextField textField = new JTextField(25);
textField.setFont(Gui.getFont(Fonts.MONOSPACED));
Gui.registerFont(textField, Fonts.MONOSPACED);
return textField;
}
@@ -26,8 +26,6 @@ import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import docking.widgets.table.*;
import generic.theme.GThemeDefaults.Ids.Fonts;
import generic.theme.Gui;
import ghidra.feature.fid.db.*;
import ghidra.feature.fid.service.FidService;
import ghidra.util.Msg;
@@ -66,7 +64,7 @@ public class FidSearchResultFrame extends JFrame implements FidQueryCloseListene
private void buildFrame() {
GTableCellRenderer renderer = new GTableCellRenderer();
renderer.setFont(Gui.getFont(Fonts.MONOSPACED));
renderer.setFont(renderer.getFixedWidthFont());
int columnCount = table.getColumnCount();
for (int ii = 0; ii < columnCount; ++ii) {
Class<?> columnClass = table.getColumnClass(ii);
@@ -22,7 +22,7 @@ import java.util.List;
import javax.swing.Icon;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import ghidra.feature.vt.api.main.VTAssociationMarkupStatus;
public class VTMarkupStatusIcon implements Icon {
@@ -74,7 +74,7 @@ public class VTMarkupStatusIcon implements Icon {
drawBar(g, x + startX + BORDER + 1, y + BORDER + 1, width, colors.get(i));
}
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.drawRect(x, y, WIDTH, HEIGHT);
// g.drawRect(x, y, WIDTH / 2, HEIGHT);
g.drawRect(x + WIDTH, y + HEIGHT / 2 - 3, KNOB_WIDTH, 6);
@@ -27,7 +27,9 @@ import org.apache.commons.lang3.StringUtils;
import docking.widgets.button.BrowseButton;
import docking.widgets.label.GDLabel;
import docking.wizard.*;
import generic.theme.*;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Ids.Fonts;
import generic.theme.Gui;
import ghidra.app.util.task.OpenProgramTask;
import ghidra.app.util.task.OpenProgramTask.OpenProgramRequest;
import ghidra.framework.main.DataTreeDialog;
@@ -74,7 +76,7 @@ public class NewSessionPanel extends AbstractMageJPanel<VTWizardStateKey> {
folderLabel.setHorizontalAlignment(SwingConstants.RIGHT);
folderLabel.setToolTipText("The folder to store the new Version Tracking Session");
folderNameField = new JTextField();
Gui.registerFont(folderNameField, GThemeDefaults.Ids.Fonts.MONOSPACED);
Gui.registerFont(folderNameField, Fonts.MONOSPACED);
folderNameField.setEditable(false); // force user to browse to choose
JButton browseFolderButton = new BrowseButton();
@@ -2,8 +2,6 @@
<HTML>
<HEAD>
<META name="generator" content=
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
<TITLE>Developer's Guide</TITLE>
</HEAD>
@@ -21,8 +19,8 @@
want to use colors, fonts, and icons. The key idea to support theming is to never
<B>directly</B>
reference those resources. Instead, the developer should create an ID string for the resource
and then in a <CODE><I>module</I>.theme.properties</CODE> file, provide a default value for that ID.
(Also, you may define an alternate "dark" default value that will be used if the
and then in a <CODE><I>module</I>.theme.properties</CODE> file, provide a default value for that
ID. (Also, you may define an alternate "dark" default value that will be used if the
current theme is considered a dark theme). The way you
define and use these IDs is a bit different depending on whether the resource is a color, font,
or icon. Colors and icons are similar in that developers use these types by creating either
@@ -182,6 +180,42 @@
<LI>icon.plugin.byteviewer.provider</LI>
</UL>
</BLOCKQUOTE>
<UL>
<LI><A NAME="System_IDs"></A><B>System IDs:</B> The following resource IDs are created and
used by the system. For a description of how these IDs are used internally by the
application, see the <CODE>UiDefaultsMapper</CODE> class . The <CODE>system.*</CODE> keys
allow users to quickly change many Look and Feel values via these high-level concepts. The
<CODE>laf.*</CODE> properties are for internal use and do not need to be changed by the user.
A description of the system properties can be found in the <CODE>SystemThemeIds</CODE> class.
</LI>
</UL>
<BLOCKQUOTE>
<UL>
<LI>laf.color.*</LI>
<LI>laf.font.*</LI>
<LI>laf.icon.*</LI>
</UL>
<UL>
<LI>system.color.*</LI>
<LI>system.font.*</LI>
</UL>
<P>
The <CODE>system</CODE> property names use the standard property names, such as <CODE>
font, bg</CODE> and <CODE>fg</CODE>. These properties introduce these additional terms:
<CODE>control, view, menu and tooltip</CODE>. <CODE>control</CODE> refers to items that
generally control the state of the application, such as buttons and check boxes.
<CODE>view</CODE> refers to widgets that display data, such as trees, tables and text
fields. <CODE>menu</CODE> and <CODE>tooltip</CODE> work with the items after which they are
named.
</P>
</BLOCKQUOTE>
</BLOCKQUOTE>
<H2>Theme Property Files</H2>
@@ -198,7 +232,7 @@
they exist in a module's data directory and are named with the
<CODE>.theme.properties</CODE> suffix.</P>
<H3>Theme Properties File Naming Convention</H3>
<H3><A NAME="Theme_Property_Names"></A>Theme Properties File Naming Convention</H3>
<P>To promote consistency, theme property files should use the following naming
convention:</P>
@@ -260,7 +294,7 @@ color.bg.listing = color.bg
color.fg.listing.address = black
color.fg.listing.bytes = #00ff00
font.global = courirer-BOLD-12
font.global = courier-BOLD-12
font.global.listing = font.global
icon.error = defaultError.png
@@ -295,11 +329,22 @@ color.fg.listing.bytes = orange
example, a reference color entry might be something like "color.bg.listing = color.bg". This
says that the listing's background color should be whatever "color.bg" is defined to be. Note
that all of the application's defined properties start with either "color.", "font.", or
"icon.". Properties defined by a Java Look and Feel don't follow this pattern. To reference a
property that does not have a standard prefix, an ID can be prefixed with "[color]",
"[font]", or "[icon] as appropriate to allow the theme property parser to recognize the
values as IDs to other properties. So to refer to a Java property named "table.background",
you would use the following definition: "color.bg.table = [color]table.background".</P>
"icon.".
<P>
Properties defined by the theming system do not follow this pattern. To reference a
property that does not have a standard prefix, an ID can be prefixed with <COD>[color]
</CODE>, <CODE>[font]</CODE>, or <CODE>[icon]</CODE> as appropriate to allow the theme
property parser to recognize the values as IDs to other properties. For example, to refer to a
system property named<CODE>system.color.bg.view</CODE>,
you would use the following definition:
<P>
<BLOCKUOTE>
<P>
<CODE>color.bg.tree = [color]system.color.bg.view</CODE>
</P>
</BLOCKQUOTE>
<H3>Color Values</H3>
@@ -319,8 +364,8 @@ color.fg.listing.bytes = orange
<LI>rgba(red, green, blue, alpha)</LI>
<LI><I>web color name</I> // the case-insensitive name of a web color such as red, olive, or
purple</LI>
<LI><I>web color name</I> // the case-insensitive name of a web color such as red, olive,
or purple</LI>
</UL>
</BLOCKQUOTE>
@@ -449,6 +494,126 @@ color.fg.listing.bytes = orange
</PRE>
<H2>Useful Concepts</H2>
<H3>GThemeDefaults</H3>
<BLOCKQUOTE>
<P>
This class contains many common application theme values for developers to use, such as
the default background color. These values can be used directly so developers do not have
to instantiate theme objects using theme IDs.
</P>
</BLOCKQUOTE>
<H3>Icons</H3>
<BLOCKQUOTE>
<p>
When adding icons to the application, consider using standard icons provided by the
<CODE>Icons</CODE> class. Many generic concepts that require icons are in this class.
</P>
</BLOCKQUOTE>
<H3>Palette Colors</H3>
<BLOCKQUOTE>
<P>
A list of palette colors has been defined in <CODE>gui.palette.theme.properties.</CODE>.
These palette colors values are meant to be used by developers to reduce the total number
of colors used in the application. These color ids and values are viewable in the
<A href="ThemingUserDocs.html#Edit_Theme">Theme Editor Dialog</A>.
</P>
<P>
One of the benefits of using the palette system is that it is easy for end-users to change
one palette color to update all widgets in the application.
</P>
<P>
We recommend you use the existing palette colors when picking colors for your widgets.
</P>
</BLOCKQUOTE>
<H3>HTML Foreground Colors in Messages</H3>
<BLOCKQUOTE>
<P>
Some developers use HTML messages in labels, tables, tooltips, and in calls to system APIs,
like <CODE>Msg</CODE>. Using HTML text allows clients to control the formatting of the
text, including the usage of color. If you use color in your HTML, then we suggest you do
so using GColors, like this:
<PRE>
String message = "Some text: &LT;FONT COLOR=\"" + Messages.ERROR + "\"&GT;" + errorText + "</FONT>";
</PRE>
<P>
In this example, an HTML message is created and part of that text is colored with the
standard error message color, which is red in a light mode theme. You can also use your
own <CODE>GColor</CODE> object in your HTML messages. Using standard system colors or
GColors allows these colors to be updated as the theme changes. We do not
recommend the use of hard-coded color values.
</P>
</BLOCKQUOTE>
<H3>Options Usage of Colors and Fonts</H3>
<BLOCKQUOTE>
<P>
The <CODE>Options</CODE> class in Ghidra facilitates user-configurable options in the
application. Previously, developers could use options to allow end-users to control color
values. In the new theme-based system, all colors are controlled via theming. However, to
make the transition to theming easier for developers, we added methods to the options class
that allow the developer to bind color editing via the options UI. These color options will
write any changes directly to the theme system.
</P>
<P> See: <CODE>Options.registerThemeColorBinding()</CODE> and
<CODE>Options.registerThemeFontBinding()</CODE>
</P>
</BLOCKQUOTE>
<H3>UiDefaultsMapper</H3>
<BLOCKQUOTE>
<P>This class discusses some of the plumbing the application uses to unify the various Look
and Feel concepts presented by the different LaFs.
</P>
</BLOCKQUOTE>
<H3>SystemThemeIds</H3>
<BLOCKQUOTE>
<P>This class is used by the <CODE>UiDefaultsMapper</CODE> class and presents a set of resource IDs common across all
LaFs. These values can be changed by the user. See also the description of
<A NAME="#System_IDs">System IDs in this document</A>.
</P>
</BLOCKQUOTE>
<H3>Known Issues</H3>
<BLOCKQUOTE>
<P>
Sometimes switching between themes does not reset all widgets. When
this happens, you may notice odd UI artifacts. These will go away when the application is
restarted and often when you again switch the theme.
</P>
</BLOCKQUOTE>
<P class="providedbyplugin">Provided by: <I>Theme Manager</I></P>
<P class="relatedtopic">Related Topics</P>
@@ -2,9 +2,6 @@
<HTML>
<HEAD>
<META name="generator" content=
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
<TITLE>Theming Architecture</TITLE>
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>
@@ -2,9 +2,6 @@
<HTML>
<HEAD>
<META name="generator" content=
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
<TITLE>General Overivew</TITLE>
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>
@@ -2,9 +2,6 @@
<HTML>
<HEAD>
<META name="generator" content=
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
<TITLE>Theming User Documentation</TITLE>
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>
@@ -67,11 +64,10 @@
called "Button.background", it would appear in Ghidra as "laf.color.Button.background".</LI>
<LI>Look and Feel Palette Properties - All the color and fonts used by the Look and Feel
properties are grouped into either system property values or auto-generated palette
properties, sso that groups of properties can be changed together.</LI>
properties, so that groups of properties can be changed together.</LI>
</UL>
<P>See the <A href="ThemingDeveloperDocs.html#Resource_Ids">Developer Documentation</A> for more
details on the property ID format and naming conventions.
</P>
@@ -185,6 +181,14 @@
action, press the refresh button <IMG alt="" src="images/reload3.png" border="0"> in the top
right corner of the Theme Editor dialog.
<H3>Toggle Showing System Values<A NAME="Toggle_Show_System_Values"></A></H3>
<P>
Toggles whether the given table shows system ID values (e.g, those starting with <CODE>
laf.</CODE> or <CODE>system.</CODE>. By default these values are hidden.
</P>
<H3>Saving Themes</H3>
<P>After making changes to one or more theme values, the <A href="#Edit_Theme">Theme
Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 62 KiB

@@ -38,10 +38,6 @@ public class EditWindow extends JWindow {
private AssociatedComponentListener compListener = new AssociatedComponentListener();
/**
* Constructor for RenameViewWindow.
* @param owner
*/
EditWindow(DockingWindowManager mgr) {
super(mgr.getRootFrame());
this.mgr = mgr;
@@ -52,17 +48,11 @@ public class EditWindow extends JWindow {
return comp;
}
/**
* @see java.awt.Window#isActive()
*/
@Override
public boolean isActive() {
return active;
}
/**
* @see java.awt.Component#setVisible(boolean)
*/
@Override
public void setVisible(boolean state) {
@@ -133,8 +123,7 @@ public class EditWindow extends JWindow {
private void create() {
textField = new JTextField(" ");
JPanel panel = new JPanel(new BorderLayout());
Color bgColor = Colors.BG_TOOLTIP;
panel.setBackground(bgColor);
panel.setBackground(Colors.BACKGROUND);
panel.add(textField, BorderLayout.CENTER);
textField.addKeyListener(new KeyAdapter() {
@@ -167,32 +156,21 @@ public class EditWindow extends JWindow {
private class AssociatedComponentListener implements ComponentListener, ChangeListener {
/*
* @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
*/
@Override
public void componentHidden(ComponentEvent e) {
close();
}
/*
* @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
*/
@Override
public void componentResized(ComponentEvent e) {
close();
}
/*
* @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
*/
@Override
public void componentShown(ComponentEvent e) {
// stub
}
/*
* @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
*/
@Override
public void componentMoved(ComponentEvent e) {
if (comp != null && comp.isVisible()) {
@@ -200,9 +178,6 @@ public class EditWindow extends JWindow {
}
}
/*
* @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent)
*/
@Override
public void stateChanged(ChangeEvent e) {
close();
@@ -30,7 +30,7 @@ import docking.util.AnimationUtils;
import docking.widgets.VariableHeightPanel;
import docking.widgets.label.GDLabel;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Palette;
// TODO: should this be put into generic?
@@ -211,7 +211,7 @@ public class GenericHeader extends JPanel {
private void constructMultiLinePanel() {
removeAll();
toolbar.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Java.BORDER));
toolbar.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Colors.BORDER));
add(toolbar, BorderLayout.SOUTH);
add(titlePanel, BorderLayout.CENTER);
add(menuCloseToolbar, BorderLayout.EAST);
@@ -35,7 +35,6 @@ import docking.dnd.StringTransferable;
import docking.widgets.label.GDLabel;
import docking.widgets.label.GLabel;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors.Messages;
import ghidra.util.ColorUtils;
import ghidra.util.WebColors;
@@ -151,7 +150,7 @@ public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
recentSwatchListener = new RecentSwatchListener();
recentSwatchPanel.addMouseListener(recentSwatchListener);
LineBorder border = new LineBorder(Java.BORDER);
LineBorder border = new LineBorder(Colors.BORDER);
swatchPanel.setBorder(border);
gbc.gridx = 0;
gbc.gridy = 0;
@@ -424,7 +423,7 @@ class SwatchPanel extends JPanel {
}
int y = row * (swatchSize.height + gap.height);
g.fillRect(x, y, swatchSize.width, swatchSize.height);
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
g.drawLine(x + swatchSize.width - 1, y, x + swatchSize.width - 1,
y + swatchSize.height - 1);
g.drawLine(x, y + swatchSize.height - 1, x + swatchSize.width - 1,
@@ -33,6 +33,8 @@ public class ThemeColorPaletteTable extends ThemeColorTable {
@Override
protected void filter() {
super.filter(); // this call will update 'colors'
List<ColorValue> filtered = new ArrayList<>();
for (ColorValue colorValue : colors) {
@@ -34,7 +34,7 @@ import ghidra.util.Swing;
/**
* Color Table for Theme Dialog
*/
public class ThemeColorTable extends JPanel implements ActionContextProvider {
public class ThemeColorTable extends JPanel implements ActionContextProvider, ThemeTable {
private ThemeColorTableModel colorTableModel;
private ColorValueEditor colorEditor = new ColorValueEditor(this::colorValueChanged);
@@ -87,6 +87,17 @@ public class ThemeColorTable extends JPanel implements ActionContextProvider {
return new ThemeColorTableModel(valuesProvider);
}
@Override
public void setShowSystemValues(boolean show) {
colorTableModel.setShowSystemValues(show);
reloadAll();
}
@Override
public boolean isShowingSystemValues() {
return colorTableModel.isShowingSystemValues();
}
void colorValueChanged(PropertyChangeEvent event) {
// run later - don't rock the boat in the middle of a listener callback
Swing.runLater(() -> {
@@ -118,7 +129,7 @@ public class ThemeColorTable extends JPanel implements ActionContextProvider {
}
String id = currentValue.getId();
ColorValue themeValue = colorTableModel.getThemeValue(id);
return new ThemeTableContext<>(currentValue, themeValue);
return new ThemeTableContext<>(currentValue, themeValue, this);
}
return null;
}
@@ -16,6 +16,7 @@
package docking.theme.gui;
import java.awt.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.function.Supplier;
@@ -44,6 +45,7 @@ public class ThemeColorTableModel extends GDynamicColumnTableModel<ColorValue, O
private GThemeValueMap lightDefaultValues;
private GThemeValueMap darkDefaultValues;
private GThemeValuesCache valuesCache;
private boolean showSystemValues;
public ThemeColorTableModel(GThemeValuesCache valuesProvider) {
super(new ServiceProviderStub());
@@ -51,9 +53,17 @@ public class ThemeColorTableModel extends GDynamicColumnTableModel<ColorValue, O
load();
}
public void setShowSystemValues(boolean show) {
this.showSystemValues = show;
}
public boolean isShowingSystemValues() {
return showSystemValues;
}
/**
* Reloads the just the current values shown in the table. Called whenever a color changes.
*/
* Reloads the just the current values shown in the table. Called whenever a color changes.
*/
public void reloadCurrent() {
currentValues = valuesCache.getCurrentValues();
colors = currentValues.getColors();
@@ -86,7 +96,23 @@ public class ThemeColorTableModel extends GDynamicColumnTableModel<ColorValue, O
}
protected void filter() {
// for subclasses
List<ColorValue> filtered = new ArrayList<>();
for (ColorValue colorValue : colors) {
String id = colorValue.getId();
if (showSystemValues) {
filtered.add(colorValue);
continue;
}
if (!Gui.isSystemId(id)) {
filtered.add(colorValue);
}
}
colors = filtered;
}
@Override
@@ -50,7 +50,6 @@ public class ThemeEditorDialog extends DialogComponentProvider {
private ThemeColorTable paletteTable;
private ThemeManager themeManager;
private GThemeValuesCache valuesCache;
public ThemeEditorDialog(ThemeManager themeManager) {
@@ -107,6 +106,22 @@ public class ThemeEditorDialog extends DialogComponentProvider {
.onAction(c -> c.getThemeValue().installValue(themeManager))
.build();
addAction(resetValueAction);
DockingAction showSystemValuesAction =
new ActionBuilder("Toggle Show System Values", getTitle())
.popupMenuPath("Toggle Show System Values")
.withContext(ThemeTableContext.class)
.popupWhen(c -> true)
.helpLocation(new HelpLocation("Theming", "Toggle_Show_System_Values"))
.onAction(context -> toggleSystemValues(context))
.build();
addAction(showSystemValuesAction);
}
private void toggleSystemValues(ThemeTableContext<?> context) {
ThemeTable themeTable = context.getThemeTable();
boolean isShowing = themeTable.isShowingSystemValues();
themeTable.setShowSystemValues(!isShowing);
}
private void adjustFonts(int amount) {
@@ -35,7 +35,7 @@ import ghidra.util.Swing;
/**
* Font Table for Theme Dialog
*/
public class ThemeFontTable extends JPanel implements ActionContextProvider {
public class ThemeFontTable extends JPanel implements ActionContextProvider, ThemeTable {
private ThemeFontTableModel fontTableModel;
private FontValueEditor fontEditor = new FontValueEditor(this::fontValueChanged);
@@ -84,6 +84,17 @@ public class ThemeFontTable extends JPanel implements ActionContextProvider {
}
@Override
public void setShowSystemValues(boolean show) {
fontTableModel.setShowSystemValues(show);
reloadAll();
}
@Override
public boolean isShowingSystemValues() {
return fontTableModel.isShowingSystemValues();
}
void fontValueChanged(PropertyChangeEvent event) {
// run later - don't rock the boat in the middle of a listener callback
Swing.runLater(() -> {
@@ -115,7 +126,7 @@ public class ThemeFontTable extends JPanel implements ActionContextProvider {
}
String id = currentValue.getId();
FontValue themeValue = fontTableModel.getThemeValue(id);
return new ThemeTableContext<Font>(currentValue, themeValue);
return new ThemeTableContext<Font>(currentValue, themeValue, this);
}
return null;
}
@@ -17,15 +17,13 @@ package docking.theme.gui;
import java.awt.Component;
import java.awt.Font;
import java.util.Comparator;
import java.util.List;
import java.util.*;
import java.util.function.Supplier;
import javax.swing.JLabel;
import docking.widgets.table.*;
import generic.theme.FontValue;
import generic.theme.GThemeValueMap;
import generic.theme.*;
import ghidra.docking.settings.Settings;
import ghidra.framework.plugintool.ServiceProvider;
import ghidra.framework.plugintool.ServiceProviderStub;
@@ -41,6 +39,7 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
private GThemeValueMap themeValues;
private GThemeValueMap defaultValues;
private GThemeValuesCache valuesProvider;
private boolean showSystemValues;
public ThemeFontTableModel(GThemeValuesCache valuesProvider) {
super(new ServiceProviderStub());
@@ -48,6 +47,34 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
load();
}
public void setShowSystemValues(boolean show) {
this.showSystemValues = show;
}
public boolean isShowingSystemValues() {
return showSystemValues;
}
protected void filter() {
List<FontValue> filtered = new ArrayList<>();
for (FontValue fontValue : fonts) {
String id = fontValue.getId();
if (showSystemValues) {
filtered.add(fontValue);
continue;
}
if (!Gui.isSystemId(id)) {
filtered.add(fontValue);
}
}
fonts = filtered;
}
/**
* Reloads the just the current values shown in the table. Called whenever a font changes.
*/
@@ -71,6 +98,8 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
fonts = currentValues.getFonts();
themeValues = valuesProvider.getThemeValues();
defaultValues = valuesProvider.getDefaultValues();
filter();
}
@Override
@@ -172,6 +201,7 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
return renderer;
}
@Override
public Comparator<ResolvedFont> getComparator() {
return (v1, v2) -> {
if (v1 == null && v2 == null) {
@@ -220,5 +250,6 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
}
private record ResolvedFont(String id, String refId, Font font) {/**/}
private record ResolvedFont(String id, String refId, Font font) {
/**/}
}
@@ -33,7 +33,7 @@ import ghidra.util.Swing;
/**
* Icon Table for Theme Dialog
*/
public class ThemeIconTable extends JPanel implements ActionContextProvider {
public class ThemeIconTable extends JPanel implements ActionContextProvider, ThemeTable {
private ThemeIconTableModel iconTableModel;
private IconValueEditor iconEditor = new IconValueEditor(this::iconValueChanged);
@@ -80,6 +80,17 @@ public class ThemeIconTable extends JPanel implements ActionContextProvider {
add(filterTable, BorderLayout.CENTER);
}
@Override
public void setShowSystemValues(boolean show) {
iconTableModel.setShowSystemValues(show);
reloadAll();
}
@Override
public boolean isShowingSystemValues() {
return iconTableModel.isShowingSystemValues();
}
void iconValueChanged(PropertyChangeEvent event) {
// run later - don't rock the boat in the middle of a listener callback
Swing.runLater(() -> {
@@ -111,7 +122,7 @@ public class ThemeIconTable extends JPanel implements ActionContextProvider {
}
String id = currentValue.getId();
IconValue themeValue = iconTableModel.getThemeValue(id);
return new ThemeTableContext<Icon>(currentValue, themeValue);
return new ThemeTableContext<Icon>(currentValue, themeValue, this);
}
return null;
}
@@ -16,8 +16,7 @@
package docking.theme.gui;
import java.awt.Component;
import java.util.Comparator;
import java.util.List;
import java.util.*;
import java.util.function.Supplier;
import javax.swing.*;
@@ -40,6 +39,7 @@ public class ThemeIconTableModel extends GDynamicColumnTableModel<IconValue, Obj
private GThemeValueMap themeValues;
private GThemeValueMap defaultValues;
private GThemeValuesCache valuesProvider;
private boolean showSystemValues;
public ThemeIconTableModel(GThemeValuesCache valuesProvider) {
super(new ServiceProviderStub());
@@ -47,6 +47,34 @@ public class ThemeIconTableModel extends GDynamicColumnTableModel<IconValue, Obj
load();
}
public void setShowSystemValues(boolean show) {
this.showSystemValues = show;
}
public boolean isShowingSystemValues() {
return showSystemValues;
}
protected void filter() {
List<IconValue> filtered = new ArrayList<>();
for (IconValue iconValue : icons) {
String id = iconValue.getId();
if (showSystemValues) {
filtered.add(iconValue);
continue;
}
if (!Gui.isSystemId(id)) {
filtered.add(iconValue);
}
}
icons = filtered;
}
/**
* Reloads the just the current values shown in the table. Called whenever an icon changes.
*/
@@ -70,6 +98,8 @@ public class ThemeIconTableModel extends GDynamicColumnTableModel<IconValue, Obj
icons = currentValues.getIcons();
themeValues = valuesProvider.getThemeValues();
defaultValues = valuesProvider.getDefaultValues();
filter();
}
@Override
@@ -242,6 +272,6 @@ public class ThemeIconTableModel extends GDynamicColumnTableModel<IconValue, Obj
}
}
private record ResolvedIcon(String id, String refId, Icon icon) {/**/}
private record ResolvedIcon(String id, String refId, Icon icon) {
/**/}
}
@@ -0,0 +1,34 @@
/* ###
* IP: GHIDRA
*
* 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 docking.theme.gui;
/**
* A common interface for theme tables
*/
public interface ThemeTable {
/**
* True signals to show IDs used for system values
* @param show true signals to show IDs used for system values
*/
public void setShowSystemValues(boolean show);
/**
* True if showing system IDs
* @return true if showing system IDs
*/
public boolean isShowingSystemValues();
}
@@ -27,10 +27,21 @@ public class ThemeTableContext<T> extends ActionContext {
private ThemeValue<T> currentValue;
private ThemeValue<T> themeValue;
private ThemeTable themeTable;
public ThemeTableContext(ThemeValue<T> currentValue, ThemeValue<T> themeValue) {
public ThemeTableContext(ThemeValue<T> currentValue, ThemeValue<T> themeValue,
ThemeTable themeTable) {
this.currentValue = currentValue;
this.themeValue = themeValue;
this.themeTable = themeTable;
}
/**
* Returns the theme table for this context
* @return the table
*/
public ThemeTable getThemeTable() {
return themeTable;
}
/**
@@ -26,7 +26,7 @@ import org.jdesktop.animation.timing.TimingTargetAdapter;
import org.jdesktop.animation.timing.interpolation.PropertySetter;
import generic.theme.GIcon;
import generic.theme.GThemeDefaults.Colors.Java;
import generic.theme.GThemeDefaults.Colors;
import generic.theme.GThemeDefaults.Colors.Palette;
import generic.util.WindowUtilities;
import generic.util.image.ImageUtils;
@@ -878,7 +878,7 @@ public class AnimationUtils {
double cx = emphasizedBounds.getCenterX();
double cy = emphasizedBounds.getCenterY();
g2d.rotate(rad, cx, cy);
g.setColor(Java.BORDER);
g.setColor(Colors.BORDER);
int iw = emphasizedBounds.width;
int ih = emphasizedBounds.height;
@@ -26,6 +26,7 @@ import docking.widgets.label.GDHtmlLabel;
import generic.theme.GColor;
import generic.theme.GColorUIResource;
import generic.theme.GThemeDefaults.Colors.Palette;
import generic.theme.GThemeDefaults.Colors.Tables;
/**
* A common base class for list and table renderer objects, unifying the Ghidra look and feel.
@@ -165,6 +166,14 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel {
return ALT_BACKGROUND_COLOR;
}
protected Color getErrorForegroundColor(boolean isSelected) {
return isSelected ? Tables.ERROR_SELECTED : Tables.ERROR_UNSELECTED;
}
protected Color getUneditableForegroundColor(boolean isSelected) {
return isSelected ? Tables.UNEDITABLE_SELECTED : Tables.UNEDITABLE_UNSELECTED;
}
// ==================================================================================================
// Methods overridden for performance reasons (see DefaultTableCellRenderer &
// DefaultListCellRenderer)

Some files were not shown because too many files have changed in this diff Show More