mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-02 06:42:30 +08:00
GP-2846 - Theming Documentation
This commit is contained in:
+4
-4
@@ -20,7 +20,7 @@ import java.awt.Graphics;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.program.model.address.AddressRange;
|
import ghidra.program.model.address.AddressRange;
|
||||||
import ghidra.trace.model.Lifespan;
|
import ghidra.trace.model.Lifespan;
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ public class MemoryBox {
|
|||||||
int w = vertical ? getTimePixelWidth() : getAddressPixelWidth();
|
int w = vertical ? getTimePixelWidth() : getAddressPixelWidth();
|
||||||
int y = vertical ? getAddressPixelStart() : getTimePixelStart();
|
int y = vertical ? getAddressPixelStart() : getTimePixelStart();
|
||||||
int h = vertical ? getAddressPixelWidth() : getTimePixelWidth();
|
int h = vertical ? getAddressPixelWidth() : getTimePixelWidth();
|
||||||
g.setColor(Java.BORDER);
|
g.setColor(Colors.BORDER);
|
||||||
g.fillRect(x - 1, y - 1, w + 2, h + 2);
|
g.fillRect(x - 1, y - 1, w + 2, h + 2);
|
||||||
g.setColor(color);
|
g.setColor(color);
|
||||||
g.fillRect(x, y, w, h);
|
g.fillRect(x, y, w, h);
|
||||||
@@ -148,7 +148,7 @@ public class MemoryBox {
|
|||||||
int w = vertical ? sz : getAddressPixelWidth();
|
int w = vertical ? sz : getAddressPixelWidth();
|
||||||
int y = vertical ? getAddressPixelStart() : 0;
|
int y = vertical ? getAddressPixelStart() : 0;
|
||||||
int h = vertical ? getAddressPixelWidth() : sz;
|
int h = vertical ? getAddressPixelWidth() : sz;
|
||||||
g.setColor(Java.BORDER);
|
g.setColor(Colors.BORDER);
|
||||||
g.fillRect(x - 1, y - 1, w + 2, h + 2);
|
g.fillRect(x - 1, y - 1, w + 2, h + 2);
|
||||||
g.setColor(color);
|
g.setColor(color);
|
||||||
g.fillRect(x, y, w, h);
|
g.fillRect(x, y, w, h);
|
||||||
@@ -159,7 +159,7 @@ public class MemoryBox {
|
|||||||
int w = vertical ? 1 : sz;
|
int w = vertical ? 1 : sz;
|
||||||
int y = vertical ? 0 : getTimePixelStart();
|
int y = vertical ? 0 : getTimePixelStart();
|
||||||
int h = vertical ? sz : 1;
|
int h = vertical ? sz : 1;
|
||||||
g.setColor(Java.BORDER);
|
g.setColor(Colors.BORDER);
|
||||||
g.fillRect(x - 1, y - 1, w + 2, h + 2);
|
g.fillRect(x - 1, y - 1, w + 2, h + 2);
|
||||||
g.setColor(color);
|
g.setColor(color);
|
||||||
g.fillRect(x, y, w, h);
|
g.fillRect(x, y, w, h);
|
||||||
|
|||||||
+2
-2
@@ -23,7 +23,7 @@ import java.util.List;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import generic.theme.GColor;
|
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.Address;
|
||||||
import ghidra.program.model.address.AddressRange;
|
import ghidra.program.model.address.AddressRange;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ public class MemviewPanel extends JPanel implements MouseListener, MouseMotionLi
|
|||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
setPreferredSize(new Dimension(barWidth, barHeight));
|
setPreferredSize(new Dimension(barWidth, barHeight));
|
||||||
setSize(getPreferredSize());
|
setSize(getPreferredSize());
|
||||||
setBorder(BorderFactory.createLineBorder(Java.BORDER, 1));
|
setBorder(BorderFactory.createLineBorder(Colors.BORDER, 1));
|
||||||
setFocusable(true);
|
setFocusable(true);
|
||||||
|
|
||||||
addMouseListener(this);
|
addMouseListener(this);
|
||||||
|
|||||||
+2
-2
@@ -29,7 +29,7 @@ import docking.widgets.button.GRadioButton;
|
|||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.app.merge.util.ConflictUtility;
|
import ghidra.app.merge.util.ConflictUtility;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.HTMLUtilities;
|
||||||
import ghidra.util.layout.MaximizeSpecificColumnGridLayout;
|
import ghidra.util.layout.MaximizeSpecificColumnGridLayout;
|
||||||
@@ -46,7 +46,7 @@ public class VariousChoicesPanel extends ConflictPanel {
|
|||||||
|
|
||||||
private final static long serialVersionUID = 1;
|
private final static long serialVersionUID = 1;
|
||||||
private static final Border UNDERLINE_BORDER =
|
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 JPanel rowPanel;
|
||||||
private GDHtmlLabel headerLabel;
|
private GDHtmlLabel headerLabel;
|
||||||
|
|||||||
+2
-2
@@ -29,7 +29,7 @@ import docking.widgets.button.GRadioButton;
|
|||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.app.merge.util.ConflictUtility;
|
import ghidra.app.merge.util.ConflictUtility;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.HTMLUtilities;
|
||||||
import ghidra.util.datastruct.LongArrayList;
|
import ghidra.util.datastruct.LongArrayList;
|
||||||
@@ -190,7 +190,7 @@ public class VerticalChoicesPanel extends ConflictPanel {
|
|||||||
headerComps[i] = new MyLabel(items[i]);
|
headerComps[i] = new MyLabel(items[i]);
|
||||||
headerComps[i].setName(getComponentName(0, i));
|
headerComps[i].setName(getComponentName(0, i));
|
||||||
setRowComponent(headerComps[i], 0, i, defaultInsets);
|
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();
|
rowPanel.validate();
|
||||||
|
|||||||
+2
-2
@@ -21,7 +21,7 @@ import java.beans.PropertyEditorSupport;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.framework.options.CustomOptionsEditor;
|
import ghidra.framework.options.CustomOptionsEditor;
|
||||||
import ghidra.util.layout.PairLayout;
|
import ghidra.util.layout.PairLayout;
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ public class StoredAnalyzerTimesPropertyEditor extends PropertyEditorSupport
|
|||||||
new JTextField(StoredAnalyzerTimes.formatTimeMS(times.getTotalTime()));
|
new JTextField(StoredAnalyzerTimes.formatTimeMS(times.getTotalTime()));
|
||||||
valueField.setEditable(false);
|
valueField.setEditable(false);
|
||||||
valueField.setHorizontalAlignment(SwingConstants.RIGHT);
|
valueField.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
valueField.setBorder(BorderFactory.createLineBorder(Java.BORDER, 2));
|
valueField.setBorder(BorderFactory.createLineBorder(Colors.BORDER, 2));
|
||||||
panel.add(valueField);
|
panel.add(valueField);
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
|
|||||||
+12
-21
@@ -26,8 +26,6 @@ import javax.swing.*;
|
|||||||
import javax.swing.event.*;
|
import javax.swing.event.*;
|
||||||
import javax.swing.table.TableModel;
|
import javax.swing.table.TableModel;
|
||||||
|
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
|
|
||||||
import docking.*;
|
import docking.*;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
@@ -41,11 +39,8 @@ import docking.widgets.pathmanager.PathnameTablePanel;
|
|||||||
import docking.widgets.table.GTableCellRenderer;
|
import docking.widgets.table.GTableCellRenderer;
|
||||||
import docking.widgets.table.GTableCellRenderingData;
|
import docking.widgets.table.GTableCellRenderingData;
|
||||||
import generic.jar.ResourceFile;
|
import generic.jar.ResourceFile;
|
||||||
import generic.theme.GThemeDefaults.Colors.Tables;
|
|
||||||
import ghidra.app.plugin.core.processors.SetLanguageDialog;
|
import ghidra.app.plugin.core.processors.SetLanguageDialog;
|
||||||
import ghidra.app.util.Option;
|
|
||||||
import ghidra.app.util.cparser.C.CParserUtils;
|
import ghidra.app.util.cparser.C.CParserUtils;
|
||||||
import ghidra.app.util.exporter.Exporter;
|
|
||||||
import ghidra.framework.Application;
|
import ghidra.framework.Application;
|
||||||
import ghidra.framework.options.SaveState;
|
import ghidra.framework.options.SaveState;
|
||||||
import ghidra.framework.preferences.Preferences;
|
import ghidra.framework.preferences.Preferences;
|
||||||
@@ -139,13 +134,15 @@ class ParseDialog extends ReusableDialogComponentProvider {
|
|||||||
if (currentProfileName != null) {
|
if (currentProfileName != null) {
|
||||||
for (int i = 0; i < itemList.size(); i++) {
|
for (int i = 0; i < itemList.size(); i++) {
|
||||||
ComboBoxItem item = itemList.get(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);
|
comboBox.setSelectedIndex(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
toFront();
|
toFront();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -245,8 +242,7 @@ class ParseDialog extends ReusableDialogComponentProvider {
|
|||||||
|
|
||||||
label.setText(pathName.toString());
|
label.setText(pathName.toString());
|
||||||
if (!fileExists) {
|
if (!fileExists) {
|
||||||
label.setForeground(data.isSelected() ? Tables.FG_ERROR_SELECTED
|
label.setForeground(getErrorForegroundColor(data.isSelected()));
|
||||||
: Tables.FG_ERROR_UNSELECTED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
@@ -304,11 +300,11 @@ class ParseDialog extends ReusableDialogComponentProvider {
|
|||||||
parseToFileButton.setToolTipText("Parse files and output to archive file");
|
parseToFileButton.setToolTipText("Parse files and output to archive file");
|
||||||
addButton(parseToFileButton);
|
addButton(parseToFileButton);
|
||||||
|
|
||||||
|
|
||||||
mainPanel.add(comboPanel, BorderLayout.NORTH);
|
mainPanel.add(comboPanel, BorderLayout.NORTH);
|
||||||
|
|
||||||
includePathPanel.setPreferredSize(new Dimension(pathPanel.getPreferredSize().width, 200));
|
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);
|
optionsPane.setResizeWeight(0.50);
|
||||||
|
|
||||||
pathPanel.setPreferredSize(new Dimension(pathPanel.getPreferredSize().width, 200));
|
pathPanel.setPreferredSize(new Dimension(pathPanel.getPreferredSize().width, 200));
|
||||||
@@ -349,8 +345,8 @@ class ParseDialog extends ReusableDialogComponentProvider {
|
|||||||
|
|
||||||
languageButton = new BrowseButton();
|
languageButton = new BrowseButton();
|
||||||
languageButton.addActionListener(e -> {
|
languageButton.addActionListener(e -> {
|
||||||
SetLanguageDialog dialog = new SetLanguageDialog(plugin.getTool(), languageIDString, compilerIDString,
|
SetLanguageDialog dialog = new SetLanguageDialog(plugin.getTool(), languageIDString,
|
||||||
"Select Program Architecture for File DataType Archive");
|
compilerIDString, "Select Program Architecture for File DataType Archive");
|
||||||
LanguageID languageId = dialog.getLanguageDescriptionID();
|
LanguageID languageId = dialog.getLanguageDescriptionID();
|
||||||
CompilerSpecID compilerSpecId = dialog.getCompilerSpecDescriptionID();
|
CompilerSpecID compilerSpecId = dialog.getCompilerSpecDescriptionID();
|
||||||
if ((languageId == null) || (compilerSpecId == null)) {
|
if ((languageId == null) || (compilerSpecId == null)) {
|
||||||
@@ -691,7 +687,6 @@ class ParseDialog extends ReusableDialogComponentProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String[] paths = new String[pathList.size()];
|
String[] paths = new String[pathList.size()];
|
||||||
paths = pathList.toArray(paths);
|
paths = pathList.toArray(paths);
|
||||||
pathPanel.setPaths(paths);
|
pathPanel.setPaths(paths);
|
||||||
@@ -818,7 +813,8 @@ class ParseDialog extends ReusableDialogComponentProvider {
|
|||||||
if (parseToFile) {
|
if (parseToFile) {
|
||||||
File file = getSaveFile();
|
File file = getSaveFile();
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
plugin.parse(paths, includePaths, options, languageIDString, compilerIDString, file.getAbsolutePath());
|
plugin.parse(paths, includePaths, options, languageIDString, compilerIDString,
|
||||||
|
file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -996,11 +992,7 @@ class ParseDialog extends ReusableDialogComponentProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
return Objects.hash(file, isUserDefined);
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((file == null) ? 0 : file.hashCode());
|
|
||||||
result = prime * result + (isUserDefined ? 1231 : 1237);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1022,7 +1014,6 @@ class ParseDialog extends ReusableDialogComponentProvider {
|
|||||||
// Methods for Testing
|
// Methods for Testing
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
||||||
|
|
||||||
GhidraComboBox<ParseDialog.ComboBoxItem> getParseComboBox() {
|
GhidraComboBox<ParseDialog.ComboBoxItem> getParseComboBox() {
|
||||||
return comboBox;
|
return comboBox;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -25,7 +25,6 @@ import javax.swing.JTable;
|
|||||||
|
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
import generic.theme.GThemeDefaults.Colors.Tables;
|
|
||||||
import ghidra.app.util.ToolTipUtils;
|
import ghidra.app.util.ToolTipUtils;
|
||||||
import ghidra.docking.settings.FormatSettingsDefinition;
|
import ghidra.docking.settings.FormatSettingsDefinition;
|
||||||
import ghidra.docking.settings.Settings;
|
import ghidra.docking.settings.Settings;
|
||||||
@@ -156,8 +155,7 @@ class EquateTableModel extends GDynamicColumnTableModel<Equate, Object> {
|
|||||||
|
|
||||||
JTable table = data.getTable();
|
JTable table = data.getTable();
|
||||||
if (!eq.isValidUUID()) { // Error equate
|
if (!eq.isValidUUID()) { // Error equate
|
||||||
label.setForeground(
|
label.setForeground(getErrorForegroundColor(isSelected));
|
||||||
(isSelected) ? table.getSelectionForeground() : Tables.FG_ERROR_UNSELECTED);
|
|
||||||
}
|
}
|
||||||
else if (!eq.isEnumBased()) { // User label
|
else if (!eq.isEnumBased()) { // User label
|
||||||
label.setForeground(
|
label.setForeground(
|
||||||
|
|||||||
+6
-9
@@ -39,7 +39,7 @@ import docking.widgets.label.GLabel;
|
|||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.theme.GThemeDefaults.Colors.*;
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.app.services.DataTypeManagerService;
|
import ghidra.app.services.DataTypeManagerService;
|
||||||
import ghidra.app.util.ToolTipUtils;
|
import ghidra.app.util.ToolTipUtils;
|
||||||
@@ -213,7 +213,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
|||||||
thunkedText.setEditable(false);
|
thunkedText.setEditable(false);
|
||||||
DockingUtils.setTransparent(thunkedText);
|
DockingUtils.setTransparent(thunkedText);
|
||||||
CompoundBorder border =
|
CompoundBorder border =
|
||||||
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Java.BORDER),
|
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Colors.BORDER),
|
||||||
BorderFactory.createEmptyBorder(0, 5, 0, 5));
|
BorderFactory.createEmptyBorder(0, 5, 0, 5));
|
||||||
thunkedText.setBorder(border);
|
thunkedText.setBorder(border);
|
||||||
thunkedText.setForeground(FunctionColors.THUNK);
|
thunkedText.setForeground(FunctionColors.THUNK);
|
||||||
@@ -652,13 +652,12 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
|||||||
DataType dataType = (DataType) value;
|
DataType dataType = (DataType) value;
|
||||||
Color color = isSelected ? table.getSelectionForeground() : table.getForeground();
|
Color color = isSelected ? table.getSelectionForeground() : table.getForeground();
|
||||||
if (!tableModel.isCellEditable(row, column)) {
|
if (!tableModel.isCellEditable(row, column)) {
|
||||||
color =
|
color = getUneditableForegroundColor(isSelected);
|
||||||
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED;
|
|
||||||
}
|
}
|
||||||
if (dataType != null) {
|
if (dataType != null) {
|
||||||
setText(dataType.getName());
|
setText(dataType.getName());
|
||||||
if (dataType.isNotYetDefined()) {
|
if (dataType.isNotYetDefined()) {
|
||||||
color = isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED;
|
color = getErrorForegroundColor(isSelected);
|
||||||
}
|
}
|
||||||
String toolTipText = ToolTipUtils.getToolTipText(dataType);
|
String toolTipText = ToolTipUtils.getToolTipText(dataType);
|
||||||
String headerText = "<HTML><b>" +
|
String headerText = "<HTML><b>" +
|
||||||
@@ -782,8 +781,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
|||||||
boolean isInvalidStorage =
|
boolean isInvalidStorage =
|
||||||
!storage.isValid() || rowData.getFormalDataType().getLength() != storage.size();
|
!storage.isValid() || rowData.getFormalDataType().getLength() != storage.size();
|
||||||
if (isInvalidStorage) {
|
if (isInvalidStorage) {
|
||||||
setForeground(
|
setForeground(getErrorForegroundColor(isSelected));
|
||||||
isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED);
|
|
||||||
setToolTipText("Invalid Parameter Storage");
|
setToolTipText("Invalid Parameter Storage");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -818,8 +816,7 @@ public class FunctionEditorDialog extends DialogComponentProvider implements Mod
|
|||||||
|
|
||||||
ParameterTableModel tableModel = (ParameterTableModel) table.getModel();
|
ParameterTableModel tableModel = (ParameterTableModel) table.getModel();
|
||||||
if (!tableModel.isCellEditable(row, column)) {
|
if (!tableModel.isCellEditable(row, column)) {
|
||||||
setForeground(
|
setForeground(getUneditableForegroundColor(isSelected));
|
||||||
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
|
|||||||
+7
-2
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.function.editor;
|
package ghidra.app.plugin.core.function.editor;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
@@ -53,8 +54,7 @@ class StorageTableCellEditor extends AbstractCellEditor implements TableCellEdit
|
|||||||
boolean isSelected, int row, int column) {
|
boolean isSelected, int row, int column) {
|
||||||
String stringValue = value == null ? "" : value.toString();
|
String stringValue = value == null ? "" : value.toString();
|
||||||
JTextField field = new JTextField(stringValue);
|
JTextField field = new JTextField(stringValue);
|
||||||
field.setBackground(
|
field.setBackground(getUneditableForegroundColor(isSelected));
|
||||||
isSelected ? Tables.FG_UNEDITABLE_SELECTED : Tables.FG_UNEDITABLE_UNSELECTED);
|
|
||||||
field.setEditable(false);
|
field.setEditable(false);
|
||||||
ParameterTableModel tableModel = (ParameterTableModel) table.getModel();
|
ParameterTableModel tableModel = (ParameterTableModel) table.getModel();
|
||||||
FunctionVariableData rowData = tableModel.getRowObject(row);
|
FunctionVariableData rowData = tableModel.getRowObject(row);
|
||||||
@@ -78,4 +78,9 @@ class StorageTableCellEditor extends AbstractCellEditor implements TableCellEdit
|
|||||||
});
|
});
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Color getUneditableForegroundColor(boolean isSelected) {
|
||||||
|
return isSelected ? Tables.UNEDITABLE_SELECTED : Tables.UNEDITABLE_UNSELECTED;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -27,7 +27,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
|
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
import docking.widgets.textfield.HintTextField;
|
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.cmd.function.CreateFunctionTagCmd;
|
||||||
import ghidra.app.context.ProgramActionContext;
|
import ghidra.app.context.ProgramActionContext;
|
||||||
import ghidra.framework.cmd.Command;
|
import ghidra.framework.cmd.Command;
|
||||||
@@ -239,9 +239,9 @@ public class FunctionTagProvider extends ComponentProviderAdapter
|
|||||||
targetPanel = new TargetTagsPanel(this, tool, "Assigned To Function");
|
targetPanel = new TargetTagsPanel(this, tool, "Assigned To Function");
|
||||||
allFunctionsPanel = new AllFunctionsPanel(program, this, "Functions with Selected Tag");
|
allFunctionsPanel = new AllFunctionsPanel(program, this, "Functions with Selected Tag");
|
||||||
buttonPanel = new FunctionTagButtonPanel(sourcePanel, targetPanel);
|
buttonPanel = new FunctionTagButtonPanel(sourcePanel, targetPanel);
|
||||||
sourcePanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
|
sourcePanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
|
||||||
targetPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
|
targetPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
|
||||||
allFunctionsPanel.setBorder(BorderFactory.createLineBorder(Java.BORDER));
|
allFunctionsPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
|
||||||
|
|
||||||
// If we don't set this, then the splitter won't be able to shrink the
|
// 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
|
// target panels below the size required by its header, which can be large
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@ import javax.swing.JToolTip;
|
|||||||
|
|
||||||
import docking.widgets.fieldpanel.field.Field;
|
import docking.widgets.fieldpanel.field.Field;
|
||||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
|
||||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Tooltips;
|
||||||
import ghidra.app.plugin.core.gotoquery.GoToHelper;
|
import ghidra.app.plugin.core.gotoquery.GoToHelper;
|
||||||
import ghidra.app.services.CodeFormatService;
|
import ghidra.app.services.CodeFormatService;
|
||||||
import ghidra.app.util.*;
|
import ghidra.app.util.*;
|
||||||
@@ -46,7 +46,7 @@ import ghidra.util.bean.opteditor.OptionsVetoException;
|
|||||||
public abstract class AbstractReferenceHover extends AbstractConfigurableHover {
|
public abstract class AbstractReferenceHover extends AbstractConfigurableHover {
|
||||||
|
|
||||||
private static final int WINDOW_OFFSET = 50;
|
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 static final Color FG_COLOR_NOT_IN_MEMORY = Messages.HINT;
|
||||||
|
|
||||||
private CodeFormatService codeFormatService;
|
private CodeFormatService codeFormatService;
|
||||||
|
|||||||
+2
-2
@@ -21,7 +21,7 @@ import java.awt.GridBagLayout;
|
|||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
|
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +57,7 @@ public class ControlPanel extends JPanel {
|
|||||||
gbc.weightx = 1.0;
|
gbc.weightx = 1.0;
|
||||||
this.add(directionWidget, gbc);
|
this.add(directionWidget, gbc);
|
||||||
|
|
||||||
this.setBorder(BorderFactory.createLineBorder(Java.BORDER));
|
this.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectionScopeWidget getRangeWidget() {
|
public SelectionScopeWidget getRangeWidget() {
|
||||||
|
|||||||
+6
-26
@@ -25,20 +25,14 @@ import javax.swing.border.EmptyBorder;
|
|||||||
import javax.swing.event.ListDataListener;
|
import javax.swing.event.ListDataListener;
|
||||||
|
|
||||||
import docking.widgets.list.GListCellRenderer;
|
import docking.widgets.list.GListCellRenderer;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
import generic.theme.GThemeDefaults.Colors.Tooltips;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.app.plugin.core.console.CodeCompletion;
|
import ghidra.app.plugin.core.console.CodeCompletion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class encapsulates a code completion popup Window for the ConsolePlugin.
|
* This class encapsulates a code completion popup Window for the ConsolePlugin.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class CodeCompletionWindow extends JDialog {
|
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 InterpreterPanel console;
|
||||||
protected final JTextPane outputTextField;
|
protected final JTextPane outputTextField;
|
||||||
@@ -50,17 +44,6 @@ public class CodeCompletionWindow extends JDialog {
|
|||||||
/* current list of completions */
|
/* current list of completions */
|
||||||
protected JList jlist;
|
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) {
|
public CodeCompletionWindow(Window parent, InterpreterPanel cp, JTextPane textField) {
|
||||||
super(parent);
|
super(parent);
|
||||||
|
|
||||||
@@ -73,7 +56,7 @@ public class CodeCompletionWindow extends JDialog {
|
|||||||
/* don't steal focus from text input! */
|
/* don't steal focus from text input! */
|
||||||
setFocusableWindowState(false);
|
setFocusableWindowState(false);
|
||||||
|
|
||||||
jlist.setBackground(BACKGROUND_COLOR);
|
jlist.setBackground(Tooltips.BACKGROUND);
|
||||||
jlist.setCellRenderer(new CodeCompletionListCellRenderer());
|
jlist.setCellRenderer(new CodeCompletionListCellRenderer());
|
||||||
/* add the ability to double-click a code completion */
|
/* add the ability to double-click a code completion */
|
||||||
MouseListener mouseListener = new MouseAdapter() {
|
MouseListener mouseListener = new MouseAdapter() {
|
||||||
@@ -405,9 +388,6 @@ class CodeCompletionListSelectionModel extends DefaultListSelectionModel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders CodeCompletions for the CodeCompletionWindow.
|
* Renders CodeCompletions for the CodeCompletionWindow.
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class CodeCompletionListCellRenderer extends GListCellRenderer<CodeCompletion> {
|
class CodeCompletionListCellRenderer extends GListCellRenderer<CodeCompletion> {
|
||||||
|
|
||||||
@@ -425,14 +405,14 @@ class CodeCompletionListCellRenderer extends GListCellRenderer<CodeCompletion> {
|
|||||||
@Override
|
@Override
|
||||||
public Component getListCellRendererComponent(JList<? extends CodeCompletion> list,
|
public Component getListCellRendererComponent(JList<? extends CodeCompletion> list,
|
||||||
CodeCompletion codeCompletion, int index, boolean isSelected, boolean cellHasFocus) {
|
CodeCompletion codeCompletion, int index, boolean isSelected, boolean cellHasFocus) {
|
||||||
if (null == codeCompletion.getComponent()) {
|
if (codeCompletion.getComponent() == null) {
|
||||||
return super.getListCellRendererComponent(list, codeCompletion, index, isSelected,
|
return super.getListCellRendererComponent(list, codeCompletion, index, isSelected,
|
||||||
cellHasFocus);
|
cellHasFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ooh, we have a fancy component! */
|
|
||||||
JComponent component = codeCompletion.getComponent();
|
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);
|
component.setOpaque(true);
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
component.setBackground(list.getSelectionBackground());
|
component.setBackground(list.getSelectionBackground());
|
||||||
@@ -440,7 +420,7 @@ class CodeCompletionListCellRenderer extends GListCellRenderer<CodeCompletion> {
|
|||||||
else {
|
else {
|
||||||
component.setBackground(list.getBackground());
|
component.setBackground(list.getBackground());
|
||||||
}
|
}
|
||||||
/* other nice formatting stuff */
|
|
||||||
component.setEnabled(list.isEnabled());
|
component.setEnabled(list.isEnabled());
|
||||||
component.setFont(list.getFont());
|
component.setFont(list.getFont());
|
||||||
component.setComponentOrientation(list.getComponentOrientation());
|
component.setComponentOrientation(list.getComponentOrientation());
|
||||||
|
|||||||
+2
-5
@@ -21,7 +21,6 @@ import java.util.*;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import docking.widgets.table.GTableCellRenderingData;
|
import docking.widgets.table.GTableCellRenderingData;
|
||||||
import generic.theme.GThemeDefaults.Colors.Tables;
|
|
||||||
import ghidra.docking.settings.Settings;
|
import ghidra.docking.settings.Settings;
|
||||||
import ghidra.framework.plugintool.ServiceProvider;
|
import ghidra.framework.plugintool.ServiceProvider;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
@@ -127,8 +126,7 @@ class LocationReferencesTableModel extends AddressBasedTableModel<LocationRefere
|
|||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
||||||
private class ContextTableColumn
|
private class ContextTableColumn
|
||||||
extends
|
extends AbstractProgramBasedDynamicTableColumn<LocationReference, LocationReference> {
|
||||||
AbstractProgramBasedDynamicTableColumn<LocationReference, LocationReference> {
|
|
||||||
|
|
||||||
private ContextCellRenderer renderer = new ContextCellRenderer();
|
private ContextCellRenderer renderer = new ContextCellRenderer();
|
||||||
|
|
||||||
@@ -189,8 +187,7 @@ class LocationReferencesTableModel extends AddressBasedTableModel<LocationRefere
|
|||||||
if (!StringUtils.isBlank(refType)) {
|
if (!StringUtils.isBlank(refType)) {
|
||||||
String trailingText = "";
|
String trailingText = "";
|
||||||
if (rowObject.isOffcutReference()) {
|
if (rowObject.isOffcutReference()) {
|
||||||
setForeground(
|
setForeground(getErrorForegroundColor(isSelected));
|
||||||
isSelected ? Tables.FG_ERROR_SELECTED : Tables.FG_ERROR_UNSELECTED);
|
|
||||||
trailingText = OFFCUT_STRING;
|
trailingText = OFFCUT_STRING;
|
||||||
}
|
}
|
||||||
return refType + trailingText;
|
return refType + trailingText;
|
||||||
|
|||||||
+3
-3
@@ -20,7 +20,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.theme.Gui;
|
import generic.theme.Gui;
|
||||||
|
|
||||||
public class KnotLabelPanel extends JPanel {
|
public class KnotLabelPanel extends JPanel {
|
||||||
@@ -55,7 +55,7 @@ public class KnotLabelPanel extends JPanel {
|
|||||||
int fontOffset = ascent / 3; // this looks about right
|
int fontOffset = ascent / 3; // this looks about right
|
||||||
ArrayList<KnotRecord> knots = palette.getKnots();
|
ArrayList<KnotRecord> knots = palette.getKnots();
|
||||||
|
|
||||||
g.setColor(Java.BORDER);
|
g.setColor(Colors.BORDER);
|
||||||
g.drawLine(5, topBottomMargin - 6, 10, topBottomMargin - ascent + 2);
|
g.drawLine(5, topBottomMargin - 6, 10, topBottomMargin - ascent + 2);
|
||||||
g.drawString("min entropy (0.0)", 20, topBottomMargin - ascent - descent);
|
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.drawLine(5, y, 10, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
g.setColor(Java.BORDER);
|
g.setColor(Colors.BORDER);
|
||||||
g.drawLine(5, height + topBottomMargin + 4, 10, height + topBottomMargin + 8);
|
g.drawLine(5, height + topBottomMargin + 4, 10, height + topBottomMargin + 8);
|
||||||
g.drawString("max entropy (8.0)", 20, topBottomMargin + height + ascent + descent);
|
g.drawString("max entropy (8.0)", 20, topBottomMargin + height + ascent + descent);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -19,7 +19,7 @@ import java.awt.*;
|
|||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
|
||||||
public class PalettePanel extends JPanel {
|
public class PalettePanel extends JPanel {
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public class PalettePanel extends JPanel {
|
|||||||
|
|
||||||
g.setColor(getBackground());
|
g.setColor(getBackground());
|
||||||
g.fillRect(0, 0, getWidth(), getHeight());
|
g.fillRect(0, 0, getWidth(), getHeight());
|
||||||
g.setColor(Java.BORDER);
|
g.setColor(Colors.BORDER);
|
||||||
if (palette == null) {
|
if (palette == null) {
|
||||||
g.drawRect(0, 0, width - 1, height - 1);
|
g.drawRect(0, 0, width - 1, height - 1);
|
||||||
return;
|
return;
|
||||||
@@ -64,7 +64,7 @@ public class PalettePanel extends JPanel {
|
|||||||
g.setColor(c);
|
g.setColor(c);
|
||||||
g.fillRect(0, topBottomMargin + i, width, 1);
|
g.fillRect(0, topBottomMargin + i, width, 1);
|
||||||
}
|
}
|
||||||
g.setColor(Java.BORDER);
|
g.setColor(Colors.BORDER);
|
||||||
g.drawRect(0, topBottomMargin, width - 1, height);
|
g.drawRect(0, topBottomMargin, width - 1, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -31,7 +31,7 @@ import javax.swing.text.Document;
|
|||||||
|
|
||||||
import docking.widgets.list.GListCellRenderer;
|
import docking.widgets.list.GListCellRenderer;
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,7 +154,7 @@ class ProgramListPanel extends JPanel {
|
|||||||
|
|
||||||
// add some padding around the panel
|
// add some padding around the panel
|
||||||
Border innerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5);
|
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);
|
Border compoundBorder = BorderFactory.createCompoundBorder(outerBorder, innerBorder);
|
||||||
setBorder(compoundBorder);
|
setBorder(compoundBorder);
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -36,7 +36,6 @@ import docking.widgets.label.GDLabel;
|
|||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
|
||||||
import ghidra.app.util.AddressInput;
|
import ghidra.app.util.AddressInput;
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
@@ -534,7 +533,7 @@ class EditMemoryReferencePanel extends EditReferencePanel {
|
|||||||
model = new HistoryTableModel(fromCodeUnit.getProgram());
|
model = new HistoryTableModel(fromCodeUnit.getProgram());
|
||||||
displayTable = new JTable(model);
|
displayTable = new JTable(model);
|
||||||
displayTable.setTableHeader(null);
|
displayTable.setTableHeader(null);
|
||||||
displayTable.setBorder(new LineBorder(Java.BORDER));
|
displayTable.setBorder(new LineBorder(Colors.BORDER));
|
||||||
displayTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
displayTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
|
|
||||||
displayTable.addMouseListener(new MouseAdapter() {
|
displayTable.addMouseListener(new MouseAdapter() {
|
||||||
|
|||||||
+10
-29
@@ -37,7 +37,6 @@ import docking.widgets.checkbox.GCheckBox;
|
|||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
import generic.theme.GThemeDefaults.Colors.Tables;
|
|
||||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||||
import ghidra.app.util.SelectionTransferData;
|
import ghidra.app.util.SelectionTransferData;
|
||||||
import ghidra.app.util.SelectionTransferable;
|
import ghidra.app.util.SelectionTransferable;
|
||||||
@@ -136,8 +135,7 @@ public class EditReferencesProvider extends ComponentProviderAdapter
|
|||||||
Memory memory = currentCodeUnit.getProgram().getMemory();
|
Memory memory = currentCodeUnit.getProgram().getMemory();
|
||||||
try {
|
try {
|
||||||
Object data = e.getTransferable()
|
Object data = e.getTransferable()
|
||||||
.getTransferData(
|
.getTransferData(SelectionTransferable.localProgramSelectionFlavor);
|
||||||
SelectionTransferable.localProgramSelectionFlavor);
|
|
||||||
AddressSetView view = ((SelectionTransferData) data).getAddressSet();
|
AddressSetView view = ((SelectionTransferData) data).getAddressSet();
|
||||||
if (memory.contains(view)) {
|
if (memory.contains(view)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -289,8 +287,8 @@ public class EditReferencesProvider extends ComponentProviderAdapter
|
|||||||
enableGotoReferenceLocation(gotoReferenceLocationToggleAction.isSelected());
|
enableGotoReferenceLocation(gotoReferenceLocationToggleAction.isSelected());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gotoReferenceLocationToggleAction.setToolBarData(
|
gotoReferenceLocationToggleAction
|
||||||
new ToolBarData(SEND_LOCATION_ICON, "NavAction"));
|
.setToolBarData(new ToolBarData(SEND_LOCATION_ICON, "NavAction"));
|
||||||
gotoReferenceLocationToggleAction.setEnabled(true);
|
gotoReferenceLocationToggleAction.setEnabled(true);
|
||||||
tool.addLocalAction(this, gotoReferenceLocationToggleAction);
|
tool.addLocalAction(this, gotoReferenceLocationToggleAction);
|
||||||
|
|
||||||
@@ -890,8 +888,8 @@ public class EditReferencesProvider extends ComponentProviderAdapter
|
|||||||
}
|
}
|
||||||
|
|
||||||
Reference ref = tableModel.getReference(row);
|
Reference ref = tableModel.getReference(row);
|
||||||
RefType[] refTypes = EditReferencesModel.getAllowedRefTypes(
|
RefType[] refTypes = EditReferencesModel
|
||||||
EditReferencesProvider.this.currentProgram, ref);
|
.getAllowedRefTypes(EditReferencesProvider.this.currentProgram, ref);
|
||||||
|
|
||||||
comboBox.removeAllItems();
|
comboBox.removeAllItems();
|
||||||
int selectedIndex = -1;
|
int selectedIndex = -1;
|
||||||
@@ -913,10 +911,6 @@ public class EditReferencesProvider extends ComponentProviderAdapter
|
|||||||
|
|
||||||
private class CellEditComboBox extends JComboBox<RefType> {
|
private class CellEditComboBox extends JComboBox<RefType> {
|
||||||
|
|
||||||
public CellEditComboBox() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSelectedIndex(int anIndex) {
|
public void setSelectedIndex(int anIndex) {
|
||||||
if (refsTable.getRowCount() == 0) {
|
if (refsTable.getRowCount() == 0) {
|
||||||
@@ -1035,40 +1029,27 @@ public class EditReferencesProvider extends ComponentProviderAdapter
|
|||||||
|
|
||||||
super.getTableCellRendererComponent(data);
|
super.getTableCellRendererComponent(data);
|
||||||
|
|
||||||
JTable table = data.getTable();
|
|
||||||
int row = data.getRowViewIndex();
|
int row = data.getRowViewIndex();
|
||||||
boolean isSelected = data.isSelected();
|
boolean isSelected = data.isSelected();
|
||||||
|
|
||||||
Reference ref = tableModel.getReference(row);
|
Reference ref = tableModel.getReference(row);
|
||||||
|
|
||||||
Address addr = ref.getToAddress();
|
Address addr = ref.getToAddress();
|
||||||
Memory memory = tableModel.getProgram().getMemory();
|
Memory memory = tableModel.getProgram().getMemory();
|
||||||
boolean bad = addr.isMemoryAddress() ? !memory.contains(addr) : false;
|
boolean bad = addr.isMemoryAddress() ? !memory.contains(addr) : false;
|
||||||
|
|
||||||
setOpaque(false); // disable table striping
|
// disable table striping when not selected to reduce clutter
|
||||||
setFont(table.getFont());
|
setOpaque(isSelected);
|
||||||
|
|
||||||
if (isSelected) {
|
|
||||||
if (bad) {
|
if (bad) {
|
||||||
setForeground(Tables.FG_ERROR_SELECTED);
|
setForeground(getErrorForegroundColor(isSelected));
|
||||||
setFont(boldFont);
|
setFont(boldFont);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setFont(defaultFont);
|
setFont(defaultFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
setOpaque(true);
|
// use a special color when not selected to show which row matches the operand
|
||||||
}
|
if (!isSelected) {
|
||||||
else {
|
|
||||||
// set color to red if address does not exist in memory
|
|
||||||
|
|
||||||
if (bad) {
|
|
||||||
setForeground(Tables.FG_ERROR_UNSELECTED);
|
|
||||||
setFont(boldFont);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setFont(defaultFont);
|
|
||||||
}
|
|
||||||
if (ref.getOperandIndex() == instrPanel.getSelectedOpIndex()) {
|
if (ref.getOperandIndex() == instrPanel.getSelectedOpIndex()) {
|
||||||
setBackground(BG_COLOR_ACTIVE_OPERAND);
|
setBackground(BG_COLOR_ACTIVE_OPERAND);
|
||||||
setOpaque(true);
|
setOpaque(true);
|
||||||
|
|||||||
+2
-2
@@ -372,7 +372,7 @@ class GhidraScriptTableModel extends GDynamicColumnTableModel<ResourceFile, Obje
|
|||||||
KeyBindingsInfo info = (KeyBindingsInfo) value;
|
KeyBindingsInfo info = (KeyBindingsInfo) value;
|
||||||
|
|
||||||
if (info.errorMessage != null) {
|
if (info.errorMessage != null) {
|
||||||
component.setForeground(Tables.FG_ERROR_UNSELECTED);
|
component.setForeground(Tables.ERROR_UNSELECTED);
|
||||||
component.setToolTipText(info.errorMessage);
|
component.setToolTipText(info.errorMessage);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -394,7 +394,7 @@ class GhidraScriptTableModel extends GDynamicColumnTableModel<ResourceFile, Obje
|
|||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
JTable table = data.getTable();
|
JTable table = data.getTable();
|
||||||
Color selectedForegroundColor =
|
Color selectedForegroundColor =
|
||||||
(info.errorMessage != null) ? Tables.FG_ERROR_SELECTED
|
(info.errorMessage != null) ? Tables.ERROR_SELECTED
|
||||||
: table.getSelectionForeground();
|
: table.getSelectionForeground();
|
||||||
component.setForeground(selectedForegroundColor);
|
component.setForeground(selectedForegroundColor);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -28,7 +28,6 @@ import docking.widgets.checkbox.GCheckBox;
|
|||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
|
||||||
import generic.theme.Gui;
|
import generic.theme.Gui;
|
||||||
|
|
||||||
class TipOfTheDayDialog extends ReusableDialogComponentProvider {
|
class TipOfTheDayDialog extends ReusableDialogComponentProvider {
|
||||||
@@ -88,7 +87,7 @@ class TipOfTheDayDialog extends ReusableDialogComponentProvider {
|
|||||||
JPanel panel = new JPanel(new BorderLayout());
|
JPanel panel = new JPanel(new BorderLayout());
|
||||||
Border panelBorder =
|
Border panelBorder =
|
||||||
BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10),
|
BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10),
|
||||||
BorderFactory.createLineBorder(Java.BORDER));
|
BorderFactory.createLineBorder(Colors.BORDER));
|
||||||
panel.setBorder(panelBorder);
|
panel.setBorder(panelBorder);
|
||||||
|
|
||||||
JLabel label = new GLabel("Did you know...", tipIcon, SwingConstants.LEFT);
|
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 docking.widgets.tree.GTree;
|
||||||
import generic.test.AbstractGenericTest;
|
import generic.test.AbstractGenericTest;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import generic.util.image.ImageUtils;
|
import generic.util.image.ImageUtils;
|
||||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||||
@@ -423,7 +422,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
|
|||||||
captureComponent(window);
|
captureComponent(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawBorder(Java.BORDER);
|
drawBorder(Colors.BORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JPopupMenu getPopupMenu() {
|
public JPopupMenu getPopupMenu() {
|
||||||
@@ -1375,7 +1374,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawRectangleWithDropShadowAround(JComponent component, Color color, int padding) {
|
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
|
// move it back a bit to create the drop-shadow effect
|
||||||
r.x -= padding;
|
r.x -= padding;
|
||||||
@@ -1628,7 +1627,7 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
|
|||||||
|
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
|
|
||||||
g2.setColor(Java.BORDER);
|
g2.setColor(Colors.BORDER);
|
||||||
g2.setStroke(new BasicStroke(3f));
|
g2.setStroke(new BasicStroke(3f));
|
||||||
g2.draw(topPath);
|
g2.draw(topPath);
|
||||||
g2.draw(bottomPath);
|
g2.draw(bottomPath);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import docking.action.DockingAction;
|
|||||||
import docking.action.ToolBarData;
|
import docking.action.ToolBarData;
|
||||||
import docking.widgets.combobox.GComboBox;
|
import docking.widgets.combobox.GComboBox;
|
||||||
import docking.widgets.label.*;
|
import docking.widgets.label.*;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
import ghidra.util.bean.GGlassPane;
|
import ghidra.util.bean.GGlassPane;
|
||||||
@@ -179,12 +179,12 @@ public class ImageDialogProvider extends DialogComponentProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newLabelPanel.add(createImageLabelComponent("New Image"), BorderLayout.NORTH);
|
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);
|
newLabelPanel.add(newImageLabel, BorderLayout.CENTER);
|
||||||
|
|
||||||
JPanel oldLabelPanel = new JPanel(new BorderLayout());
|
JPanel oldLabelPanel = new JPanel(new BorderLayout());
|
||||||
oldLabelPanel.add(createImageLabelComponent("Old Image"), BorderLayout.NORTH);
|
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);
|
oldLabelPanel.add(oldImageLabel, BorderLayout.CENTER);
|
||||||
|
|
||||||
imagePanel.add(oldLabelPanel, BorderLayout.WEST);
|
imagePanel.add(oldLabelPanel, BorderLayout.WEST);
|
||||||
|
|||||||
+8
-5
@@ -20,7 +20,6 @@ import java.awt.event.MouseEvent;
|
|||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
|
||||||
import ghidra.app.plugin.core.functiongraph.graph.FGEdge;
|
import ghidra.app.plugin.core.functiongraph.graph.FGEdge;
|
||||||
import ghidra.app.plugin.core.functiongraph.graph.FGVertexType;
|
import ghidra.app.plugin.core.functiongraph.graph.FGVertexType;
|
||||||
import ghidra.app.plugin.core.functiongraph.mvc.FGController;
|
import ghidra.app.plugin.core.functiongraph.mvc.FGController;
|
||||||
@@ -40,14 +39,18 @@ import ghidra.program.util.ProgramSelection;
|
|||||||
*/
|
*/
|
||||||
public interface FGVertex extends VisualVertex {
|
public interface FGVertex extends VisualVertex {
|
||||||
|
|
||||||
static final Color TOOLTIP_BACKGROUND_COLOR = Colors.BG_TOOLTIP;
|
|
||||||
|
|
||||||
public FGVertex cloneVertex(FGController newController);
|
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);
|
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 readSettings(FunctionGraphVertexAttributes settings);
|
||||||
|
|
||||||
public void restoreColor(Color color);
|
public void restoreColor(Color color);
|
||||||
|
|||||||
+4
-3
@@ -40,6 +40,7 @@ import docking.widgets.label.GDLabel;
|
|||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Tooltips;
|
||||||
import ghidra.app.plugin.core.codebrowser.hover.ListingHoverService;
|
import ghidra.app.plugin.core.codebrowser.hover.ListingHoverService;
|
||||||
import ghidra.app.plugin.core.functiongraph.FunctionGraphPlugin;
|
import ghidra.app.plugin.core.functiongraph.FunctionGraphPlugin;
|
||||||
import ghidra.app.plugin.core.functiongraph.graph.FGEdge;
|
import ghidra.app.plugin.core.functiongraph.graph.FGEdge;
|
||||||
@@ -203,7 +204,7 @@ public class ListingGraphComponentPanel extends AbstractGraphComponentPanel {
|
|||||||
boolean useFullSizeTooltip = options.useFullSizeTooltip();
|
boolean useFullSizeTooltip = options.useFullSizeTooltip();
|
||||||
previewListingPanel = new FGVertexListingPanel(controller,
|
previewListingPanel = new FGVertexListingPanel(controller,
|
||||||
getFormatManager(useFullSizeTooltip), program, addressSet);
|
getFormatManager(useFullSizeTooltip), program, addressSet);
|
||||||
previewListingPanel.setTextBackgroundColor(FGVertex.TOOLTIP_BACKGROUND_COLOR);
|
previewListingPanel.setTextBackgroundColor(Tooltips.BACKGROUND);
|
||||||
previewListingPanel.getFieldPanel().setCursorOn(false);
|
previewListingPanel.getFieldPanel().setCursorOn(false);
|
||||||
|
|
||||||
// keep the tooltip window from getting too big; use an arbitrary, reasonable max
|
// 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 = new GDLabel();
|
||||||
tooltipTitleLabel.setHorizontalAlignment(SwingConstants.LEADING);
|
tooltipTitleLabel.setHorizontalAlignment(SwingConstants.LEADING);
|
||||||
tooltipTitleLabel.setBackground(FGVertex.TOOLTIP_BACKGROUND_COLOR);
|
tooltipTitleLabel.setBackground(Tooltips.BACKGROUND);
|
||||||
tooltipTitleLabel.setOpaque(true);
|
tooltipTitleLabel.setOpaque(true);
|
||||||
Font labelFont = tooltipTitleLabel.getFont();
|
Font labelFont = tooltipTitleLabel.getFont();
|
||||||
tooltipTitleLabel.setFont(labelFont.deriveFont(Font.BOLD));
|
tooltipTitleLabel.setFont(labelFont.deriveFont(Font.BOLD));
|
||||||
|
|
||||||
JPanel headerPanel = new JPanel(new BorderLayout());
|
JPanel headerPanel = new JPanel(new BorderLayout());
|
||||||
headerPanel.add(tooltipTitleLabel);
|
headerPanel.add(tooltipTitleLabel);
|
||||||
headerPanel.setBorder(BorderFactory.createLineBorder(Colors.Java.BORDER));
|
headerPanel.setBorder(BorderFactory.createLineBorder(Colors.BORDER));
|
||||||
|
|
||||||
panel.add(headerPanel, BorderLayout.NORTH);
|
panel.add(headerPanel, BorderLayout.NORTH);
|
||||||
panel.add(previewListingPanel, BorderLayout.CENTER);
|
panel.add(previewListingPanel, BorderLayout.CENTER);
|
||||||
|
|||||||
+8
-9
@@ -21,7 +21,7 @@ import java.awt.event.ActionListener;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import generic.theme.GThemeDefaults;
|
import generic.theme.GThemeDefaults.Ids.Fonts;
|
||||||
import generic.theme.Gui;
|
import generic.theme.Gui;
|
||||||
import ghidra.feature.fid.db.*;
|
import ghidra.feature.fid.db.*;
|
||||||
import ghidra.feature.fid.service.FidService;
|
import ghidra.feature.fid.service.FidService;
|
||||||
@@ -38,6 +38,7 @@ public class FidFunctionDebugPanel extends JPanel {
|
|||||||
/**
|
/**
|
||||||
* Creates the panel.
|
* Creates the panel.
|
||||||
* @param service the FID database service
|
* @param service the FID database service
|
||||||
|
* @param fidQueryService the query service
|
||||||
* @param functionRecord the function record to debug
|
* @param functionRecord the function record to debug
|
||||||
*/
|
*/
|
||||||
public FidFunctionDebugPanel(FidService service, FidQueryService fidQueryService,
|
public FidFunctionDebugPanel(FidService service, FidQueryService fidQueryService,
|
||||||
@@ -57,7 +58,7 @@ public class FidFunctionDebugPanel extends JPanel {
|
|||||||
JButton button = new JButton(text);
|
JButton button = new JButton(text);
|
||||||
button.addActionListener(listener);
|
button.addActionListener(listener);
|
||||||
button.setHorizontalAlignment(SwingConstants.LEFT);
|
button.setHorizontalAlignment(SwingConstants.LEFT);
|
||||||
Gui.registerFont(button, GThemeDefaults.Ids.Fonts.MONOSPACED);
|
Gui.registerFont(button, Fonts.MONOSPACED);
|
||||||
add(button);
|
add(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ public class FidFunctionDebugPanel extends JPanel {
|
|||||||
private void addLabel(String text) {
|
private void addLabel(String text) {
|
||||||
JLabel label = new GDLabel(text);
|
JLabel label = new GDLabel(text);
|
||||||
label.setHorizontalAlignment(SwingConstants.LEFT);
|
label.setHorizontalAlignment(SwingConstants.LEFT);
|
||||||
label.setFont(Gui.getFont("font.monospaced"));
|
Gui.registerFont(label, Fonts.MONOSPACED);
|
||||||
add(label);
|
add(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,16 +86,14 @@ public class FidFunctionDebugPanel extends JPanel {
|
|||||||
libraryRecord.getLibraryVersion(), libraryRecord.getLibraryVariant(),
|
libraryRecord.getLibraryVersion(), libraryRecord.getLibraryVariant(),
|
||||||
languageID.getIdAsString()));
|
languageID.getIdAsString()));
|
||||||
|
|
||||||
addButton(String.format("0x%016x", functionRecord.getID()),
|
addButton(String.format("0x%016x", functionRecord.getID()), e -> FidDebugUtils
|
||||||
e -> FidDebugUtils.searchByFunctionID(functionRecord.getID(), service,
|
.searchByFunctionID(functionRecord.getID(), service, fidQueryService));
|
||||||
fidQueryService));
|
|
||||||
|
|
||||||
addButton(functionRecord.getName(),
|
addButton(functionRecord.getName(),
|
||||||
e -> FidDebugUtils.searchByName(functionRecord.getName(), service, fidQueryService));
|
e -> FidDebugUtils.searchByName(functionRecord.getName(), service, fidQueryService));
|
||||||
|
|
||||||
addButton(shorten(functionRecord.getDomainPath()),
|
addButton(shorten(functionRecord.getDomainPath()), e -> FidDebugUtils
|
||||||
e -> FidDebugUtils.searchByDomainPath(functionRecord.getDomainPath(), service,
|
.searchByDomainPath(functionRecord.getDomainPath(), service, fidQueryService));
|
||||||
fidQueryService));
|
|
||||||
|
|
||||||
addLabel(String.format("Entry Point: 0x%x", functionRecord.getEntryPoint()));
|
addLabel(String.format("Entry Point: 0x%x", functionRecord.getEntryPoint()));
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -77,13 +77,13 @@ public class FidSearchDebugDialog extends DialogComponentProvider {
|
|||||||
|
|
||||||
private JLabel getPreparedLabel(String text) {
|
private JLabel getPreparedLabel(String text) {
|
||||||
JLabel label = new GDLabel(text, SwingConstants.RIGHT);
|
JLabel label = new GDLabel(text, SwingConstants.RIGHT);
|
||||||
label.setFont(Gui.getFont(Fonts.MONOSPACED));
|
Gui.registerFont(label, Fonts.MONOSPACED);
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JTextField getPreparedTextField() {
|
private JTextField getPreparedTextField() {
|
||||||
JTextField textField = new JTextField(25);
|
JTextField textField = new JTextField(25);
|
||||||
textField.setFont(Gui.getFont(Fonts.MONOSPACED));
|
Gui.registerFont(textField, Fonts.MONOSPACED);
|
||||||
return textField;
|
return textField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -26,8 +26,6 @@ import javax.swing.table.TableColumn;
|
|||||||
import javax.swing.table.TableColumnModel;
|
import javax.swing.table.TableColumnModel;
|
||||||
|
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
import generic.theme.GThemeDefaults.Ids.Fonts;
|
|
||||||
import generic.theme.Gui;
|
|
||||||
import ghidra.feature.fid.db.*;
|
import ghidra.feature.fid.db.*;
|
||||||
import ghidra.feature.fid.service.FidService;
|
import ghidra.feature.fid.service.FidService;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
@@ -66,7 +64,7 @@ public class FidSearchResultFrame extends JFrame implements FidQueryCloseListene
|
|||||||
|
|
||||||
private void buildFrame() {
|
private void buildFrame() {
|
||||||
GTableCellRenderer renderer = new GTableCellRenderer();
|
GTableCellRenderer renderer = new GTableCellRenderer();
|
||||||
renderer.setFont(Gui.getFont(Fonts.MONOSPACED));
|
renderer.setFont(renderer.getFixedWidthFont());
|
||||||
int columnCount = table.getColumnCount();
|
int columnCount = table.getColumnCount();
|
||||||
for (int ii = 0; ii < columnCount; ++ii) {
|
for (int ii = 0; ii < columnCount; ++ii) {
|
||||||
Class<?> columnClass = table.getColumnClass(ii);
|
Class<?> columnClass = table.getColumnClass(ii);
|
||||||
|
|||||||
+2
-2
@@ -22,7 +22,7 @@ import java.util.List;
|
|||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
|
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.feature.vt.api.main.VTAssociationMarkupStatus;
|
import ghidra.feature.vt.api.main.VTAssociationMarkupStatus;
|
||||||
|
|
||||||
public class VTMarkupStatusIcon implements Icon {
|
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));
|
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, HEIGHT);
|
||||||
// g.drawRect(x, y, WIDTH / 2, HEIGHT);
|
// g.drawRect(x, y, WIDTH / 2, HEIGHT);
|
||||||
g.drawRect(x + WIDTH, y + HEIGHT / 2 - 3, KNOB_WIDTH, 6);
|
g.drawRect(x + WIDTH, y + HEIGHT / 2 - 3, KNOB_WIDTH, 6);
|
||||||
|
|||||||
+4
-2
@@ -27,7 +27,9 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import docking.widgets.button.BrowseButton;
|
import docking.widgets.button.BrowseButton;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import docking.wizard.*;
|
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;
|
||||||
import ghidra.app.util.task.OpenProgramTask.OpenProgramRequest;
|
import ghidra.app.util.task.OpenProgramTask.OpenProgramRequest;
|
||||||
import ghidra.framework.main.DataTreeDialog;
|
import ghidra.framework.main.DataTreeDialog;
|
||||||
@@ -74,7 +76,7 @@ public class NewSessionPanel extends AbstractMageJPanel<VTWizardStateKey> {
|
|||||||
folderLabel.setHorizontalAlignment(SwingConstants.RIGHT);
|
folderLabel.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||||
folderLabel.setToolTipText("The folder to store the new Version Tracking Session");
|
folderLabel.setToolTipText("The folder to store the new Version Tracking Session");
|
||||||
folderNameField = new JTextField();
|
folderNameField = new JTextField();
|
||||||
Gui.registerFont(folderNameField, GThemeDefaults.Ids.Fonts.MONOSPACED);
|
Gui.registerFont(folderNameField, Fonts.MONOSPACED);
|
||||||
folderNameField.setEditable(false); // force user to browse to choose
|
folderNameField.setEditable(false); // force user to browse to choose
|
||||||
|
|
||||||
JButton browseFolderButton = new BrowseButton();
|
JButton browseFolderButton = new BrowseButton();
|
||||||
|
|||||||
+178
-13
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
<HTML>
|
<HTML>
|
||||||
<HEAD>
|
<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">
|
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
|
||||||
<TITLE>Developer's Guide</TITLE>
|
<TITLE>Developer's Guide</TITLE>
|
||||||
</HEAD>
|
</HEAD>
|
||||||
@@ -21,8 +19,8 @@
|
|||||||
want to use colors, fonts, and icons. The key idea to support theming is to never
|
want to use colors, fonts, and icons. The key idea to support theming is to never
|
||||||
<B>directly</B>
|
<B>directly</B>
|
||||||
reference those resources. Instead, the developer should create an ID string for the resource
|
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.
|
and then in a <CODE><I>module</I>.theme.properties</CODE> file, provide a default value for that
|
||||||
(Also, you may define an alternate "dark" default value that will be used if the
|
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
|
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,
|
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
|
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>
|
<LI>icon.plugin.byteviewer.provider</LI>
|
||||||
</UL>
|
</UL>
|
||||||
</BLOCKQUOTE>
|
</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>
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
<H2>Theme Property Files</H2>
|
<H2>Theme Property Files</H2>
|
||||||
@@ -198,7 +232,7 @@
|
|||||||
they exist in a module's data directory and are named with the
|
they exist in a module's data directory and are named with the
|
||||||
<CODE>.theme.properties</CODE> suffix.</P>
|
<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
|
<P>To promote consistency, theme property files should use the following naming
|
||||||
convention:</P>
|
convention:</P>
|
||||||
@@ -260,7 +294,7 @@ color.bg.listing = color.bg
|
|||||||
color.fg.listing.address = black
|
color.fg.listing.address = black
|
||||||
color.fg.listing.bytes = #00ff00
|
color.fg.listing.bytes = #00ff00
|
||||||
|
|
||||||
font.global = courirer-BOLD-12
|
font.global = courier-BOLD-12
|
||||||
font.global.listing = font.global
|
font.global.listing = font.global
|
||||||
|
|
||||||
icon.error = defaultError.png
|
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
|
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
|
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
|
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
|
"icon.".
|
||||||
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
|
<P>
|
||||||
values as IDs to other properties. So to refer to a Java property named "table.background",
|
Properties defined by the theming system do not follow this pattern. To reference a
|
||||||
you would use the following definition: "color.bg.table = [color]table.background".</P>
|
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>
|
<H3>Color Values</H3>
|
||||||
|
|
||||||
@@ -319,8 +364,8 @@ color.fg.listing.bytes = orange
|
|||||||
|
|
||||||
<LI>rgba(red, green, blue, alpha)</LI>
|
<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
|
<LI><I>web color name</I> // the case-insensitive name of a web color such as red, olive,
|
||||||
purple</LI>
|
or purple</LI>
|
||||||
</UL>
|
</UL>
|
||||||
</BLOCKQUOTE>
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
@@ -449,6 +494,126 @@ color.fg.listing.bytes = orange
|
|||||||
</PRE>
|
</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: <FONT COLOR=\"" + Messages.ERROR + "\">" + 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="providedbyplugin">Provided by: <I>Theme Manager</I></P>
|
||||||
|
|
||||||
<P class="relatedtopic">Related Topics</P>
|
<P class="relatedtopic">Related Topics</P>
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
<HTML>
|
<HTML>
|
||||||
<HEAD>
|
<HEAD>
|
||||||
<META name="generator" content=
|
|
||||||
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
|
|
||||||
|
|
||||||
<TITLE>Theming Architecture</TITLE>
|
<TITLE>Theming Architecture</TITLE>
|
||||||
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
|
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
|
||||||
</HEAD>
|
</HEAD>
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
<HTML>
|
<HTML>
|
||||||
<HEAD>
|
<HEAD>
|
||||||
<META name="generator" content=
|
|
||||||
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
|
|
||||||
|
|
||||||
<TITLE>General Overivew</TITLE>
|
<TITLE>General Overivew</TITLE>
|
||||||
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
|
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
|
||||||
</HEAD>
|
</HEAD>
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
<HTML>
|
<HTML>
|
||||||
<HEAD>
|
<HEAD>
|
||||||
<META name="generator" content=
|
|
||||||
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net">
|
|
||||||
|
|
||||||
<TITLE>Theming User Documentation</TITLE>
|
<TITLE>Theming User Documentation</TITLE>
|
||||||
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
|
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
|
||||||
</HEAD>
|
</HEAD>
|
||||||
@@ -67,11 +64,10 @@
|
|||||||
called "Button.background", it would appear in Ghidra as "laf.color.Button.background".</LI>
|
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
|
<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 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>
|
</UL>
|
||||||
|
|
||||||
|
|
||||||
<P>See the <A href="ThemingDeveloperDocs.html#Resource_Ids">Developer Documentation</A> for more
|
<P>See the <A href="ThemingDeveloperDocs.html#Resource_Ids">Developer Documentation</A> for more
|
||||||
details on the property ID format and naming conventions.
|
details on the property ID format and naming conventions.
|
||||||
</P>
|
</P>
|
||||||
@@ -185,6 +181,14 @@
|
|||||||
action, press the refresh button <IMG alt="" src="images/reload3.png" border="0"> in the top
|
action, press the refresh button <IMG alt="" src="images/reload3.png" border="0"> in the top
|
||||||
right corner of the Theme Editor dialog.
|
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>
|
<H3>Saving Themes</H3>
|
||||||
|
|
||||||
<P>After making changes to one or more theme values, the <A href="#Edit_Theme">Theme
|
<P>After making changes to one or more theme values, the <A href="#Edit_Theme">Theme
|
||||||
|
|||||||
BIN
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();
|
private AssociatedComponentListener compListener = new AssociatedComponentListener();
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for RenameViewWindow.
|
|
||||||
* @param owner
|
|
||||||
*/
|
|
||||||
EditWindow(DockingWindowManager mgr) {
|
EditWindow(DockingWindowManager mgr) {
|
||||||
super(mgr.getRootFrame());
|
super(mgr.getRootFrame());
|
||||||
this.mgr = mgr;
|
this.mgr = mgr;
|
||||||
@@ -52,17 +48,11 @@ public class EditWindow extends JWindow {
|
|||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see java.awt.Window#isActive()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see java.awt.Component#setVisible(boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(boolean state) {
|
public void setVisible(boolean state) {
|
||||||
|
|
||||||
@@ -133,8 +123,7 @@ public class EditWindow extends JWindow {
|
|||||||
private void create() {
|
private void create() {
|
||||||
textField = new JTextField(" ");
|
textField = new JTextField(" ");
|
||||||
JPanel panel = new JPanel(new BorderLayout());
|
JPanel panel = new JPanel(new BorderLayout());
|
||||||
Color bgColor = Colors.BG_TOOLTIP;
|
panel.setBackground(Colors.BACKGROUND);
|
||||||
panel.setBackground(bgColor);
|
|
||||||
panel.add(textField, BorderLayout.CENTER);
|
panel.add(textField, BorderLayout.CENTER);
|
||||||
|
|
||||||
textField.addKeyListener(new KeyAdapter() {
|
textField.addKeyListener(new KeyAdapter() {
|
||||||
@@ -167,32 +156,21 @@ public class EditWindow extends JWindow {
|
|||||||
|
|
||||||
private class AssociatedComponentListener implements ComponentListener, ChangeListener {
|
private class AssociatedComponentListener implements ComponentListener, ChangeListener {
|
||||||
|
|
||||||
/*
|
|
||||||
* @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void componentHidden(ComponentEvent e) {
|
public void componentHidden(ComponentEvent e) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void componentResized(ComponentEvent e) {
|
public void componentResized(ComponentEvent e) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void componentShown(ComponentEvent e) {
|
public void componentShown(ComponentEvent e) {
|
||||||
|
// stub
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void componentMoved(ComponentEvent e) {
|
public void componentMoved(ComponentEvent e) {
|
||||||
if (comp != null && comp.isVisible()) {
|
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
|
@Override
|
||||||
public void stateChanged(ChangeEvent e) {
|
public void stateChanged(ChangeEvent e) {
|
||||||
close();
|
close();
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import docking.util.AnimationUtils;
|
|||||||
import docking.widgets.VariableHeightPanel;
|
import docking.widgets.VariableHeightPanel;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
// TODO: should this be put into generic?
|
// TODO: should this be put into generic?
|
||||||
@@ -211,7 +211,7 @@ public class GenericHeader extends JPanel {
|
|||||||
|
|
||||||
private void constructMultiLinePanel() {
|
private void constructMultiLinePanel() {
|
||||||
removeAll();
|
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(toolbar, BorderLayout.SOUTH);
|
||||||
add(titlePanel, BorderLayout.CENTER);
|
add(titlePanel, BorderLayout.CENTER);
|
||||||
add(menuCloseToolbar, BorderLayout.EAST);
|
add(menuCloseToolbar, BorderLayout.EAST);
|
||||||
|
|||||||
+2
-3
@@ -35,7 +35,6 @@ import docking.dnd.StringTransferable;
|
|||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
|
||||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.util.ColorUtils;
|
import ghidra.util.ColorUtils;
|
||||||
import ghidra.util.WebColors;
|
import ghidra.util.WebColors;
|
||||||
@@ -151,7 +150,7 @@ public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
|
|||||||
recentSwatchListener = new RecentSwatchListener();
|
recentSwatchListener = new RecentSwatchListener();
|
||||||
recentSwatchPanel.addMouseListener(recentSwatchListener);
|
recentSwatchPanel.addMouseListener(recentSwatchListener);
|
||||||
|
|
||||||
LineBorder border = new LineBorder(Java.BORDER);
|
LineBorder border = new LineBorder(Colors.BORDER);
|
||||||
swatchPanel.setBorder(border);
|
swatchPanel.setBorder(border);
|
||||||
gbc.gridx = 0;
|
gbc.gridx = 0;
|
||||||
gbc.gridy = 0;
|
gbc.gridy = 0;
|
||||||
@@ -424,7 +423,7 @@ class SwatchPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
int y = row * (swatchSize.height + gap.height);
|
int y = row * (swatchSize.height + gap.height);
|
||||||
g.fillRect(x, y, swatchSize.width, swatchSize.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,
|
g.drawLine(x + swatchSize.width - 1, y, x + swatchSize.width - 1,
|
||||||
y + swatchSize.height - 1);
|
y + swatchSize.height - 1);
|
||||||
g.drawLine(x, y + swatchSize.height - 1, x + swatchSize.width - 1,
|
g.drawLine(x, y + swatchSize.height - 1, x + swatchSize.width - 1,
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public class ThemeColorPaletteTable extends ThemeColorTable {
|
|||||||
@Override
|
@Override
|
||||||
protected void filter() {
|
protected void filter() {
|
||||||
|
|
||||||
|
super.filter(); // this call will update 'colors'
|
||||||
|
|
||||||
List<ColorValue> filtered = new ArrayList<>();
|
List<ColorValue> filtered = new ArrayList<>();
|
||||||
|
|
||||||
for (ColorValue colorValue : colors) {
|
for (ColorValue colorValue : colors) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import ghidra.util.Swing;
|
|||||||
/**
|
/**
|
||||||
* Color Table for Theme Dialog
|
* Color Table for Theme Dialog
|
||||||
*/
|
*/
|
||||||
public class ThemeColorTable extends JPanel implements ActionContextProvider {
|
public class ThemeColorTable extends JPanel implements ActionContextProvider, ThemeTable {
|
||||||
|
|
||||||
private ThemeColorTableModel colorTableModel;
|
private ThemeColorTableModel colorTableModel;
|
||||||
private ColorValueEditor colorEditor = new ColorValueEditor(this::colorValueChanged);
|
private ColorValueEditor colorEditor = new ColorValueEditor(this::colorValueChanged);
|
||||||
@@ -87,6 +87,17 @@ public class ThemeColorTable extends JPanel implements ActionContextProvider {
|
|||||||
return new ThemeColorTableModel(valuesProvider);
|
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) {
|
void colorValueChanged(PropertyChangeEvent event) {
|
||||||
// run later - don't rock the boat in the middle of a listener callback
|
// run later - don't rock the boat in the middle of a listener callback
|
||||||
Swing.runLater(() -> {
|
Swing.runLater(() -> {
|
||||||
@@ -118,7 +129,7 @@ public class ThemeColorTable extends JPanel implements ActionContextProvider {
|
|||||||
}
|
}
|
||||||
String id = currentValue.getId();
|
String id = currentValue.getId();
|
||||||
ColorValue themeValue = colorTableModel.getThemeValue(id);
|
ColorValue themeValue = colorTableModel.getThemeValue(id);
|
||||||
return new ThemeTableContext<>(currentValue, themeValue);
|
return new ThemeTableContext<>(currentValue, themeValue, this);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
package docking.theme.gui;
|
package docking.theme.gui;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
@@ -44,6 +45,7 @@ public class ThemeColorTableModel extends GDynamicColumnTableModel<ColorValue, O
|
|||||||
private GThemeValueMap lightDefaultValues;
|
private GThemeValueMap lightDefaultValues;
|
||||||
private GThemeValueMap darkDefaultValues;
|
private GThemeValueMap darkDefaultValues;
|
||||||
private GThemeValuesCache valuesCache;
|
private GThemeValuesCache valuesCache;
|
||||||
|
private boolean showSystemValues;
|
||||||
|
|
||||||
public ThemeColorTableModel(GThemeValuesCache valuesProvider) {
|
public ThemeColorTableModel(GThemeValuesCache valuesProvider) {
|
||||||
super(new ServiceProviderStub());
|
super(new ServiceProviderStub());
|
||||||
@@ -51,6 +53,14 @@ public class ThemeColorTableModel extends GDynamicColumnTableModel<ColorValue, O
|
|||||||
load();
|
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.
|
||||||
*/
|
*/
|
||||||
@@ -86,7 +96,23 @@ public class ThemeColorTableModel extends GDynamicColumnTableModel<ColorValue, O
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void filter() {
|
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
|
@Override
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ public class ThemeEditorDialog extends DialogComponentProvider {
|
|||||||
private ThemeColorTable paletteTable;
|
private ThemeColorTable paletteTable;
|
||||||
|
|
||||||
private ThemeManager themeManager;
|
private ThemeManager themeManager;
|
||||||
|
|
||||||
private GThemeValuesCache valuesCache;
|
private GThemeValuesCache valuesCache;
|
||||||
|
|
||||||
public ThemeEditorDialog(ThemeManager themeManager) {
|
public ThemeEditorDialog(ThemeManager themeManager) {
|
||||||
@@ -107,6 +106,22 @@ public class ThemeEditorDialog extends DialogComponentProvider {
|
|||||||
.onAction(c -> c.getThemeValue().installValue(themeManager))
|
.onAction(c -> c.getThemeValue().installValue(themeManager))
|
||||||
.build();
|
.build();
|
||||||
addAction(resetValueAction);
|
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) {
|
private void adjustFonts(int amount) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import ghidra.util.Swing;
|
|||||||
/**
|
/**
|
||||||
* Font Table for Theme Dialog
|
* Font Table for Theme Dialog
|
||||||
*/
|
*/
|
||||||
public class ThemeFontTable extends JPanel implements ActionContextProvider {
|
public class ThemeFontTable extends JPanel implements ActionContextProvider, ThemeTable {
|
||||||
|
|
||||||
private ThemeFontTableModel fontTableModel;
|
private ThemeFontTableModel fontTableModel;
|
||||||
private FontValueEditor fontEditor = new FontValueEditor(this::fontValueChanged);
|
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) {
|
void fontValueChanged(PropertyChangeEvent event) {
|
||||||
// run later - don't rock the boat in the middle of a listener callback
|
// run later - don't rock the boat in the middle of a listener callback
|
||||||
Swing.runLater(() -> {
|
Swing.runLater(() -> {
|
||||||
@@ -115,7 +126,7 @@ public class ThemeFontTable extends JPanel implements ActionContextProvider {
|
|||||||
}
|
}
|
||||||
String id = currentValue.getId();
|
String id = currentValue.getId();
|
||||||
FontValue themeValue = fontTableModel.getThemeValue(id);
|
FontValue themeValue = fontTableModel.getThemeValue(id);
|
||||||
return new ThemeTableContext<Font>(currentValue, themeValue);
|
return new ThemeTableContext<Font>(currentValue, themeValue, this);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,15 +17,13 @@ package docking.theme.gui;
|
|||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.util.Comparator;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
import generic.theme.FontValue;
|
import generic.theme.*;
|
||||||
import generic.theme.GThemeValueMap;
|
|
||||||
import ghidra.docking.settings.Settings;
|
import ghidra.docking.settings.Settings;
|
||||||
import ghidra.framework.plugintool.ServiceProvider;
|
import ghidra.framework.plugintool.ServiceProvider;
|
||||||
import ghidra.framework.plugintool.ServiceProviderStub;
|
import ghidra.framework.plugintool.ServiceProviderStub;
|
||||||
@@ -41,6 +39,7 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
|
|||||||
private GThemeValueMap themeValues;
|
private GThemeValueMap themeValues;
|
||||||
private GThemeValueMap defaultValues;
|
private GThemeValueMap defaultValues;
|
||||||
private GThemeValuesCache valuesProvider;
|
private GThemeValuesCache valuesProvider;
|
||||||
|
private boolean showSystemValues;
|
||||||
|
|
||||||
public ThemeFontTableModel(GThemeValuesCache valuesProvider) {
|
public ThemeFontTableModel(GThemeValuesCache valuesProvider) {
|
||||||
super(new ServiceProviderStub());
|
super(new ServiceProviderStub());
|
||||||
@@ -48,6 +47,34 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
|
|||||||
load();
|
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.
|
* 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();
|
fonts = currentValues.getFonts();
|
||||||
themeValues = valuesProvider.getThemeValues();
|
themeValues = valuesProvider.getThemeValues();
|
||||||
defaultValues = valuesProvider.getDefaultValues();
|
defaultValues = valuesProvider.getDefaultValues();
|
||||||
|
|
||||||
|
filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -172,6 +201,7 @@ public class ThemeFontTableModel extends GDynamicColumnTableModel<FontValue, Obj
|
|||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Comparator<ResolvedFont> getComparator() {
|
public Comparator<ResolvedFont> getComparator() {
|
||||||
return (v1, v2) -> {
|
return (v1, v2) -> {
|
||||||
if (v1 == null && v2 == null) {
|
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
|
* Icon Table for Theme Dialog
|
||||||
*/
|
*/
|
||||||
public class ThemeIconTable extends JPanel implements ActionContextProvider {
|
public class ThemeIconTable extends JPanel implements ActionContextProvider, ThemeTable {
|
||||||
|
|
||||||
private ThemeIconTableModel iconTableModel;
|
private ThemeIconTableModel iconTableModel;
|
||||||
private IconValueEditor iconEditor = new IconValueEditor(this::iconValueChanged);
|
private IconValueEditor iconEditor = new IconValueEditor(this::iconValueChanged);
|
||||||
@@ -80,6 +80,17 @@ public class ThemeIconTable extends JPanel implements ActionContextProvider {
|
|||||||
add(filterTable, BorderLayout.CENTER);
|
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) {
|
void iconValueChanged(PropertyChangeEvent event) {
|
||||||
// run later - don't rock the boat in the middle of a listener callback
|
// run later - don't rock the boat in the middle of a listener callback
|
||||||
Swing.runLater(() -> {
|
Swing.runLater(() -> {
|
||||||
@@ -111,7 +122,7 @@ public class ThemeIconTable extends JPanel implements ActionContextProvider {
|
|||||||
}
|
}
|
||||||
String id = currentValue.getId();
|
String id = currentValue.getId();
|
||||||
IconValue themeValue = iconTableModel.getThemeValue(id);
|
IconValue themeValue = iconTableModel.getThemeValue(id);
|
||||||
return new ThemeTableContext<Icon>(currentValue, themeValue);
|
return new ThemeTableContext<Icon>(currentValue, themeValue, this);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,7 @@
|
|||||||
package docking.theme.gui;
|
package docking.theme.gui;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.util.Comparator;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -40,6 +39,7 @@ public class ThemeIconTableModel extends GDynamicColumnTableModel<IconValue, Obj
|
|||||||
private GThemeValueMap themeValues;
|
private GThemeValueMap themeValues;
|
||||||
private GThemeValueMap defaultValues;
|
private GThemeValueMap defaultValues;
|
||||||
private GThemeValuesCache valuesProvider;
|
private GThemeValuesCache valuesProvider;
|
||||||
|
private boolean showSystemValues;
|
||||||
|
|
||||||
public ThemeIconTableModel(GThemeValuesCache valuesProvider) {
|
public ThemeIconTableModel(GThemeValuesCache valuesProvider) {
|
||||||
super(new ServiceProviderStub());
|
super(new ServiceProviderStub());
|
||||||
@@ -47,6 +47,34 @@ public class ThemeIconTableModel extends GDynamicColumnTableModel<IconValue, Obj
|
|||||||
load();
|
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.
|
* 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();
|
icons = currentValues.getIcons();
|
||||||
themeValues = valuesProvider.getThemeValues();
|
themeValues = valuesProvider.getThemeValues();
|
||||||
defaultValues = valuesProvider.getDefaultValues();
|
defaultValues = valuesProvider.getDefaultValues();
|
||||||
|
|
||||||
|
filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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> currentValue;
|
||||||
private ThemeValue<T> themeValue;
|
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.currentValue = currentValue;
|
||||||
this.themeValue = themeValue;
|
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 org.jdesktop.animation.timing.interpolation.PropertySetter;
|
||||||
|
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
import generic.theme.GThemeDefaults.Colors.Java;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import generic.util.image.ImageUtils;
|
import generic.util.image.ImageUtils;
|
||||||
@@ -878,7 +878,7 @@ public class AnimationUtils {
|
|||||||
double cx = emphasizedBounds.getCenterX();
|
double cx = emphasizedBounds.getCenterX();
|
||||||
double cy = emphasizedBounds.getCenterY();
|
double cy = emphasizedBounds.getCenterY();
|
||||||
g2d.rotate(rad, cx, cy);
|
g2d.rotate(rad, cx, cy);
|
||||||
g.setColor(Java.BORDER);
|
g.setColor(Colors.BORDER);
|
||||||
|
|
||||||
int iw = emphasizedBounds.width;
|
int iw = emphasizedBounds.width;
|
||||||
int ih = emphasizedBounds.height;
|
int ih = emphasizedBounds.height;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import docking.widgets.label.GDHtmlLabel;
|
|||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
import generic.theme.GColorUIResource;
|
import generic.theme.GColorUIResource;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
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.
|
* 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;
|
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 &
|
// Methods overridden for performance reasons (see DefaultTableCellRenderer &
|
||||||
// DefaultListCellRenderer)
|
// DefaultListCellRenderer)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user