mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-1981 - Theming - Docking Module
This commit is contained in:
parent
803a9e9864
commit
466db9efe3
73 changed files with 505 additions and 1553 deletions
|
@ -46,8 +46,8 @@ 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.TOOLTIP_BACKGROUND;
|
private static final Color BACKGROUND_COLOR = Colors.BACKGROUND_TOOLTIP;
|
||||||
private static final Color FG_COLOR_NOT_IN_MEMORY = new GColor("color.fg.disabled");
|
private static final Color FG_COLOR_NOT_IN_MEMORY = new GColor("color.fg.hint");
|
||||||
|
|
||||||
private CodeFormatService codeFormatService;
|
private CodeFormatService codeFormatService;
|
||||||
private ListingPanel panel;
|
private ListingPanel panel;
|
||||||
|
|
|
@ -38,7 +38,7 @@ import ghidra.app.plugin.core.console.CodeCompletion;
|
||||||
public class CodeCompletionWindow extends JDialog {
|
public class CodeCompletionWindow extends JDialog {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
/* from ReferenceHoverPlugin */
|
/* from ReferenceHoverPlugin */
|
||||||
private static final Color BACKGROUND_COLOR = Colors.TOOLTIP_BACKGROUND;
|
private static final Color BACKGROUND_COLOR = Colors.BACKGROUND_TOOLTIP;
|
||||||
|
|
||||||
protected final InterpreterPanel console;
|
protected final InterpreterPanel console;
|
||||||
protected final JTextPane outputTextField;
|
protected final JTextPane outputTextField;
|
||||||
|
|
|
@ -40,7 +40,7 @@ import ghidra.program.util.ProgramSelection;
|
||||||
*/
|
*/
|
||||||
public interface FGVertex extends VisualVertex {
|
public interface FGVertex extends VisualVertex {
|
||||||
|
|
||||||
static final Color TOOLTIP_BACKGROUND_COLOR = Colors.TOOLTIP_BACKGROUND;
|
static final Color TOOLTIP_BACKGROUND_COLOR = Colors.BACKGROUND_TOOLTIP;
|
||||||
|
|
||||||
public FGVertex cloneVertex(FGController newController);
|
public FGVertex cloneVertex(FGController newController);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ color.palette.blue = blue
|
||||||
color.palette.crimson = crimson
|
color.palette.crimson = crimson
|
||||||
color.palette.cyan = cyan
|
color.palette.cyan = cyan
|
||||||
color.palette.darkblue = DarkBlue
|
color.palette.darkblue = DarkBlue
|
||||||
|
color.palette.darkgray = DarkGray
|
||||||
color.palette.darkkhaki = DarkKhaki
|
color.palette.darkkhaki = DarkKhaki
|
||||||
color.palette.darkred = DarkRed
|
color.palette.darkred = DarkRed
|
||||||
color.palette.dodgerblue = DodgerBlue
|
color.palette.dodgerblue = DodgerBlue
|
||||||
|
@ -20,6 +21,8 @@ color.palette.lime = lime
|
||||||
color.palette.lightgray = rgb(192, 192, 192)
|
color.palette.lightgray = rgb(192, 192, 192)
|
||||||
color.palette.lightgreen = rgb(127, 255, 127)
|
color.palette.lightgreen = rgb(127, 255, 127)
|
||||||
color.palette.lightred = rgb(255, 127, 127)
|
color.palette.lightred = rgb(255, 127, 127)
|
||||||
|
color.palette.lightskyblue = lightskyblue
|
||||||
|
color.palette.lightsteelblue = lightsteelblue
|
||||||
color.palette.magenta = magenta
|
color.palette.magenta = magenta
|
||||||
color.palette.mistyrose = mistyrose
|
color.palette.mistyrose = mistyrose
|
||||||
color.palette.olive = olive
|
color.palette.olive = olive
|
||||||
|
|
|
@ -6,8 +6,9 @@ color.fg.error = red
|
||||||
color.fg.disabled = lightGray
|
color.fg.disabled = lightGray
|
||||||
color.bg.uneditable = system.color.bg.application // TODO see if there exists an LaF setting for this
|
color.bg.uneditable = system.color.bg.application // TODO see if there exists an LaF setting for this
|
||||||
color.bg.filtered = yellow
|
color.bg.filtered = yellow
|
||||||
color.fg.hint = lightgray
|
color.fg.hint = gray
|
||||||
|
|
||||||
|
color.bg.help.hint = rgba(100, 100, 255, 100)
|
||||||
color.fg.help.selector.h1 = #000080
|
color.fg.help.selector.h1 = #000080
|
||||||
color.fg.help.selector.h2 = #984C4C
|
color.fg.help.selector.h2 = #984C4C
|
||||||
color.fg.help.selector.h3 = #0000FF
|
color.fg.help.selector.h3 = #0000FF
|
||||||
|
@ -17,7 +18,9 @@ color.fg.help.selector.th = #EDF3FE
|
||||||
color.fg.help.selector.code = black
|
color.fg.help.selector.code = black
|
||||||
color.fg.help.selector.code.path = #4682B4
|
color.fg.help.selector.code.path = #4682B4
|
||||||
|
|
||||||
color.bg.header.active = steelblue
|
color.bg.splashscreen = black
|
||||||
|
|
||||||
|
color.bg.header.active = mintcream
|
||||||
color.bg.header.inactive = rgb(150, 150, 150)
|
color.bg.header.inactive = rgb(150, 150, 150)
|
||||||
color.fg.header.active = black
|
color.fg.header.active = black
|
||||||
color.fg.header.inactive = black
|
color.fg.header.inactive = black
|
||||||
|
@ -37,6 +40,7 @@ color.cursor.focused = red
|
||||||
color.cursor.unfocused = pink
|
color.cursor.unfocused = pink
|
||||||
|
|
||||||
color.bg.table.grid = gray
|
color.bg.table.grid = gray
|
||||||
|
color.bg.table.row.drag = color.palette.lavender
|
||||||
color.bg.table.row = color.bg
|
color.bg.table.row = color.bg
|
||||||
color.bg.table.row.alt = rgb(237,243,254)
|
color.bg.table.row.alt = rgb(237,243,254)
|
||||||
color.fg.table.uneditable.selected = yellow
|
color.fg.table.uneditable.selected = yellow
|
||||||
|
@ -55,6 +59,7 @@ color.bg.textfield.hint.valid = color.bg
|
||||||
color.bg.textfield.hint.invalid = rgb(255,225,225)
|
color.bg.textfield.hint.invalid = rgb(255,225,225)
|
||||||
color.fg.textfield.hint = color.fg.hint
|
color.fg.textfield.hint = color.fg.hint
|
||||||
|
|
||||||
|
color.bg.tree.drag = color.palette.lavender
|
||||||
color.bg.tree.drag.no.selection = rgb(204, 204, 255)
|
color.bg.tree.drag.no.selection = rgb(204, 204, 255)
|
||||||
|
|
||||||
color.bg.filterfield = color.bg.filtered
|
color.bg.filterfield = color.bg.filtered
|
||||||
|
@ -66,9 +71,6 @@ color.bg.selection.help = lightSteelBlue
|
||||||
color.border.bevel.highlight = lightGray
|
color.border.bevel.highlight = lightGray
|
||||||
color.border.bevel.shadow = gray
|
color.border.bevel.shadow = gray
|
||||||
|
|
||||||
// extensions
|
|
||||||
|
|
||||||
color.bg.splash = color.bg
|
|
||||||
color.bg.filechooser = color.bg
|
color.bg.filechooser = color.bg
|
||||||
color.fg.filechooser = color.fg
|
color.fg.filechooser = color.fg
|
||||||
|
|
||||||
|
@ -131,6 +133,8 @@ color.fg.help.selector.th = #EDF3FE
|
||||||
color.fg.help.selector.code = gray
|
color.fg.help.selector.code = gray
|
||||||
color.fg.help.selector.code.path = #5BA5E3
|
color.fg.help.selector.code.path = #5BA5E3
|
||||||
|
|
||||||
|
color.bg.splashscreen = black
|
||||||
|
|
||||||
color.bg.header.active = #788CBD
|
color.bg.header.active = #788CBD
|
||||||
color.bg.header.inactive = dimGray
|
color.bg.header.inactive = dimGray
|
||||||
color.fg.header.active = lightGray
|
color.fg.header.active = lightGray
|
||||||
|
|
|
@ -33,6 +33,7 @@ import docking.menu.DialogToolbarButton;
|
||||||
import docking.util.AnimationUtils;
|
import docking.util.AnimationUtils;
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.util.*;
|
import ghidra.util.*;
|
||||||
import ghidra.util.exception.AssertException;
|
import ghidra.util.exception.AssertException;
|
||||||
import ghidra.util.task.*;
|
import ghidra.util.task.*;
|
||||||
|
@ -918,7 +919,7 @@ public class DialogComponentProvider
|
||||||
statusLabel = new GDHtmlLabel(" ");
|
statusLabel = new GDHtmlLabel(" ");
|
||||||
statusLabel.setName("statusLabel");
|
statusLabel.setName("statusLabel");
|
||||||
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
statusLabel.setForeground(Color.blue);
|
statusLabel.setForeground(Messages.NORMAL);
|
||||||
statusLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
|
statusLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
|
||||||
statusLabel.addComponentListener(new ComponentAdapter() {
|
statusLabel.addComponentListener(new ComponentAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.jdesktop.animation.timing.TimingTargetAdapter;
|
||||||
import org.jdesktop.animation.timing.interpolation.PropertySetter;
|
import org.jdesktop.animation.timing.interpolation.PropertySetter;
|
||||||
|
|
||||||
import docking.util.AnimationUtils;
|
import docking.util.AnimationUtils;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import generic.util.image.ImageUtils;
|
import generic.util.image.ImageUtils;
|
||||||
import ghidra.framework.OperatingSystem;
|
import ghidra.framework.OperatingSystem;
|
||||||
|
@ -538,7 +539,7 @@ public class DockableHeader extends GenericHeader
|
||||||
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
|
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
|
||||||
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||||
|
|
||||||
Color background = new Color(218, 232, 250);
|
Color background = Palette.getColor("aliceblue");
|
||||||
g.setColor(background);
|
g.setColor(background);
|
||||||
|
|
||||||
Rectangle othersBounds = null;
|
Rectangle othersBounds = null;
|
||||||
|
|
|
@ -37,6 +37,7 @@ import docking.widgets.list.GList;
|
||||||
import docking.widgets.list.GListCellRenderer;
|
import docking.widgets.list.GListCellRenderer;
|
||||||
import docking.widgets.table.GTableCellRenderer;
|
import docking.widgets.table.GTableCellRenderer;
|
||||||
import docking.widgets.tree.support.GTreeRenderer;
|
import docking.widgets.tree.support.GTreeRenderer;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import generic.theme.Gui;
|
import generic.theme.Gui;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.HTMLUtilities;
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
|
@ -349,7 +350,7 @@ public class DockingUtils {
|
||||||
c.setBorder(BorderFactory.createEmptyBorder());
|
c.setBorder(BorderFactory.createEmptyBorder());
|
||||||
}
|
}
|
||||||
|
|
||||||
c.setBackground(new Color(0, 0, 0, 0));
|
c.setBackground(Palette.NO_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Hides any open tooltip window */
|
/** Hides any open tooltip window */
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,6 +22,8 @@ import javax.swing.*;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A re-usable floating text edit window.
|
* A re-usable floating text edit window.
|
||||||
*/
|
*/
|
||||||
|
@ -132,7 +133,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 = new Color(255, 255, 195);
|
Color bgColor = Colors.BACKGROUND_TOOLTIP;
|
||||||
panel.setBackground(bgColor);
|
panel.setBackground(bgColor);
|
||||||
panel.add(textField, BorderLayout.CENTER);
|
panel.add(textField, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
@ -152,15 +153,13 @@ public class EditWindow extends JWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
textField.addActionListener(new ActionListener() {
|
textField.addActionListener(e -> {
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
String text = textField.getText();
|
String text = textField.getText();
|
||||||
EditListener l = listener;
|
EditListener l = listener;
|
||||||
close();
|
close();
|
||||||
l.editCompleted(text);
|
l.editCompleted(text);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
getContentPane().add(panel, BorderLayout.CENTER);
|
getContentPane().add(panel, BorderLayout.CENTER);
|
||||||
|
@ -171,6 +170,7 @@ public class EditWindow extends JWindow {
|
||||||
/*
|
/*
|
||||||
* @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
|
* @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void componentHidden(ComponentEvent e) {
|
public void componentHidden(ComponentEvent e) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
@ -178,6 +178,7 @@ public class EditWindow extends JWindow {
|
||||||
/*
|
/*
|
||||||
* @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
|
* @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void componentResized(ComponentEvent e) {
|
public void componentResized(ComponentEvent e) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
@ -185,12 +186,14 @@ public class EditWindow extends JWindow {
|
||||||
/*
|
/*
|
||||||
* @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
|
* @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void componentShown(ComponentEvent e) {
|
public void componentShown(ComponentEvent e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
|
* @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void componentMoved(ComponentEvent e) {
|
public void componentMoved(ComponentEvent e) {
|
||||||
if (comp != null && comp.isVisible()) {
|
if (comp != null && comp.isVisible()) {
|
||||||
setLocation();
|
setLocation();
|
||||||
|
@ -200,6 +203,7 @@ public class EditWindow extends JWindow {
|
||||||
/*
|
/*
|
||||||
* @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent)
|
* @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void stateChanged(ChangeEvent e) {
|
public void stateChanged(ChangeEvent e) {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,9 @@ 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;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Java;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
// TODO: should this be put into generic?
|
// TODO: should this be put into generic?
|
||||||
public class GenericHeader extends JPanel {
|
public class GenericHeader extends JPanel {
|
||||||
|
@ -71,7 +74,7 @@ public class GenericHeader extends JPanel {
|
||||||
BorderLayout layout = new BorderLayout();
|
BorderLayout layout = new BorderLayout();
|
||||||
layout.setVgap(1);
|
layout.setVgap(1);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
setBorder(BorderFactory.createLineBorder(Color.GRAY));
|
setBorder(BorderFactory.createLineBorder(Palette.GRAY));
|
||||||
setFocusable(false);
|
setFocusable(false);
|
||||||
|
|
||||||
titlePanel = new TitlePanel();
|
titlePanel = new TitlePanel();
|
||||||
|
@ -209,7 +212,7 @@ public class GenericHeader extends JPanel {
|
||||||
|
|
||||||
private void constructMultiLinePanel() {
|
private void constructMultiLinePanel() {
|
||||||
removeAll();
|
removeAll();
|
||||||
toolbar.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.BLACK));
|
toolbar.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Java.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);
|
||||||
|
@ -297,11 +300,7 @@ public class GenericHeader extends JPanel {
|
||||||
|
|
||||||
TitleFlasher() {
|
TitleFlasher() {
|
||||||
animator = PropertySetter.createAnimator(1000, this, "color", NON_FOCUS_START_COLOR,
|
animator = PropertySetter.createAnimator(1000, this, "color", NON_FOCUS_START_COLOR,
|
||||||
NON_FOCUS_START_COLOR, Color.YELLOW, FOCUS_START_COLOR);
|
NON_FOCUS_START_COLOR, Palette.YELLOW, FOCUS_START_COLOR);
|
||||||
|
|
||||||
// animator =
|
|
||||||
// PropertySetter.createAnimator(1000, this, "color", NON_FOCUS_START_COLOR,
|
|
||||||
// NON_FOCUS_START_COLOR, Color.YELLOW, FOCUS_START_COLOR);
|
|
||||||
|
|
||||||
animator.setAcceleration(0.2f);
|
animator.setAcceleration(0.2f);
|
||||||
animator.setDeceleration(0.8f);
|
animator.setDeceleration(0.8f);
|
||||||
|
@ -350,7 +349,7 @@ public class GenericHeader extends JPanel {
|
||||||
setFocusable(false);
|
setFocusable(false);
|
||||||
titleLabel = new GDLabel();
|
titleLabel = new GDLabel();
|
||||||
titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
|
titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
|
||||||
titleLabel.setForeground(Color.BLACK);
|
titleLabel.setForeground(Colors.FOREGROUND);
|
||||||
titleLabel.setFocusable(false);
|
titleLabel.setFocusable(false);
|
||||||
add(titleLabel, BorderLayout.CENTER);
|
add(titleLabel, BorderLayout.CENTER);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,9 @@ import org.jdesktop.animation.timing.Animator;
|
||||||
import docking.util.AnimationUtils;
|
import docking.util.AnimationUtils;
|
||||||
import docking.widgets.EmptyBorderButton;
|
import docking.widgets.EmptyBorderButton;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
import generic.theme.Gui;
|
||||||
|
import generic.theme.TempColorUtils;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.util.*;
|
import ghidra.util.*;
|
||||||
import ghidra.util.layout.HorizontalLayout;
|
import ghidra.util.layout.HorizontalLayout;
|
||||||
|
@ -196,7 +199,7 @@ public class StatusBar extends JPanel {
|
||||||
String updatedText = fixupMultilineText(text);
|
String updatedText = fixupMultilineText(text);
|
||||||
statusLabel.setText(updatedText);
|
statusLabel.setText(updatedText);
|
||||||
statusLabel.setToolTipText(getToolTipText());
|
statusLabel.setToolTipText(getToolTipText());
|
||||||
statusLabel.setForeground(Color.BLACK);
|
statusLabel.setForeground(Colors.FOREGROUND);
|
||||||
|
|
||||||
if (StringUtils.isBlank(updatedText)) {
|
if (StringUtils.isBlank(updatedText)) {
|
||||||
return;
|
return;
|
||||||
|
@ -304,24 +307,40 @@ public class StatusBar extends JPanel {
|
||||||
private FadeTimer() {
|
private FadeTimer() {
|
||||||
super(5000, null);
|
super(5000, null);
|
||||||
addActionListener(this);
|
addActionListener(this);
|
||||||
initFadeColors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initFadeColors() {
|
private void initFadeColors() {
|
||||||
fadeColorMap.put(Color.BLACK, new Color(16, 16, 16));
|
|
||||||
fadeColorMap.put(new Color(16, 16, 16), new Color(32, 32, 32));
|
int value = 0;
|
||||||
fadeColorMap.put(new Color(32, 32, 32), new Color(64, 64, 64));
|
int delta = 16;
|
||||||
fadeColorMap.put(new Color(64, 64, 64), new Color(80, 80, 80));
|
if (Gui.getActiveTheme().useDarkDefaults()) {
|
||||||
fadeColorMap.put(new Color(80, 80, 80), new Color(96, 96, 96));
|
value = 128;
|
||||||
fadeColorMap.put(new Color(96, 96, 96), new Color(112, 112, 112));
|
delta = -16;
|
||||||
fadeColorMap.put(new Color(112, 112, 112), new Color(128, 128, 128));
|
}
|
||||||
|
|
||||||
|
Color start = TempColorUtils.fromRgb(value, value, value);
|
||||||
|
fadeColorMap.put(statusLabel.getForeground(), start);
|
||||||
|
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
|
||||||
|
Color from = TempColorUtils.fromRgb(value, value, value);
|
||||||
|
value += delta;
|
||||||
|
Color to = TempColorUtils.fromRgb(value, value, value);
|
||||||
|
fadeColorMap.put(from, to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void restart() {
|
||||||
|
initFadeColors();
|
||||||
|
super.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent event) {
|
public void actionPerformed(ActionEvent event) {
|
||||||
Color nextFadeColor = fadeColorMap.get(statusLabel.getForeground());
|
Color nextFadeColor = fadeColorMap.get(statusLabel.getForeground());
|
||||||
|
|
||||||
if (nextFadeColor != null) {
|
if (nextFadeColor != null) {
|
||||||
|
|
||||||
statusLabel.setForeground(nextFadeColor);
|
statusLabel.setForeground(nextFadeColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -385,7 +404,7 @@ public class StatusBar extends JPanel {
|
||||||
int red = color.getRed();
|
int red = color.getRed();
|
||||||
int green = color.getGreen();
|
int green = color.getGreen();
|
||||||
int blue = color.getBlue();
|
int blue = color.getBlue();
|
||||||
return new Color((255 - red), (255 - green), (255 - blue));
|
return TempColorUtils.fromRgb((255 - red), (255 - green), (255 - blue));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void contrastStatusLabelColors() {
|
private void contrastStatusLabelColors() {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import docking.KeyEntryTextField;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.tool.ToolConstants;
|
import docking.tool.ToolConstants;
|
||||||
import docking.widgets.label.GIconLabel;
|
import docking.widgets.label.GIconLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import generic.util.action.ReservedKeyBindings;
|
import generic.util.action.ReservedKeyBindings;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
|
@ -172,7 +173,7 @@ public class KeyEntryDialog extends DialogComponentProvider {
|
||||||
textAttrSet = new SimpleAttributeSet();
|
textAttrSet = new SimpleAttributeSet();
|
||||||
textAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
|
textAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
|
||||||
textAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
|
textAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
|
||||||
textAttrSet.addAttribute(StyleConstants.Foreground, Color.BLUE);
|
textAttrSet.addAttribute(StyleConstants.Foreground, Messages.NORMAL);
|
||||||
|
|
||||||
tabAttrSet = new SimpleAttributeSet();
|
tabAttrSet = new SimpleAttributeSet();
|
||||||
TabStop tabs = new TabStop(20, StyleConstants.ALIGN_LEFT, TabStop.LEAD_NONE);
|
TabStop tabs = new TabStop(20, StyleConstants.ALIGN_LEFT, TabStop.LEAD_NONE);
|
||||||
|
@ -206,9 +207,7 @@ public class KeyEntryDialog extends DialogComponentProvider {
|
||||||
String ksName = KeyBindingUtils.parseKeyStroke(ks);
|
String ksName = KeyBindingUtils.parseKeyStroke(ks);
|
||||||
try {
|
try {
|
||||||
doc.insertString(0, "Actions mapped to " + ksName + "\n\n", textAttrSet);
|
doc.insertString(0, "Actions mapped to " + ksName + "\n\n", textAttrSet);
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (DockingActionIf a : list) {
|
||||||
DockingActionIf a = list.get(i);
|
|
||||||
|
|
||||||
String collisionStr = "\t" + a.getName() + " (" + a.getOwnerDescription() + ")\n";
|
String collisionStr = "\t" + a.getName() + " (" + a.getOwnerDescription() + ")\n";
|
||||||
int offset = doc.getLength();
|
int offset = doc.getLength();
|
||||||
doc.insertString(offset, collisionStr, textAttrSet);
|
doc.insertString(offset, collisionStr, textAttrSet);
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
package docking.framework;
|
package docking.framework;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.DialogComponentProvider;
|
import docking.DialogComponentProvider;
|
||||||
import docking.DockingWindowManager;
|
import docking.DockingWindowManager;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
import ghidra.framework.Application;
|
||||||
|
import utility.application.ApplicationLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Splash screen window to display version information about the current release of
|
* Splash screen window to display version information about the current release of
|
||||||
|
@ -29,7 +31,6 @@ import docking.DockingWindowManager;
|
||||||
* initialization is complete, the splash screen is dismissed.
|
* initialization is complete, the splash screen is dismissed.
|
||||||
*/
|
*/
|
||||||
public class AboutDialog extends DialogComponentProvider {
|
public class AboutDialog extends DialogComponentProvider {
|
||||||
private static final Color DEFAULT_BACKGROUND_COLOR = new Color(243, 250, 255);
|
|
||||||
|
|
||||||
public AboutDialog() {
|
public AboutDialog() {
|
||||||
super(ApplicationInformationDisplayFactory.createAboutTitle(), true, false, true, false);
|
super(ApplicationInformationDisplayFactory.createAboutTitle(), true, false, true, false);
|
||||||
|
@ -57,7 +58,7 @@ public class AboutDialog extends DialogComponentProvider {
|
||||||
private JPanel createMainPanel() {
|
private JPanel createMainPanel() {
|
||||||
JPanel mainPanel = new JPanel(new BorderLayout());
|
JPanel mainPanel = new JPanel(new BorderLayout());
|
||||||
mainPanel.setBorder(BorderFactory.createRaisedBevelBorder());
|
mainPanel.setBorder(BorderFactory.createRaisedBevelBorder());
|
||||||
mainPanel.setBackground(DEFAULT_BACKGROUND_COLOR);
|
mainPanel.setBackground(Colors.BACKGROUND);
|
||||||
mainPanel.add(createInfoComponent(), BorderLayout.CENTER);
|
mainPanel.add(createInfoComponent(), BorderLayout.CENTER);
|
||||||
return mainPanel;
|
return mainPanel;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +68,10 @@ public class AboutDialog extends DialogComponentProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
ApplicationLayout layout = new DockingApplicationLayout("About Dialog", "1.0");
|
||||||
|
DockingApplicationConfiguration config = new DockingApplicationConfiguration();
|
||||||
|
config.setShowSplashScreen(false);
|
||||||
|
Application.initializeApplication(layout, config);
|
||||||
DockingWindowManager.showDialog(null, new AboutDialog());
|
DockingWindowManager.showDialog(null, new AboutDialog());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ import javax.swing.*;
|
||||||
|
|
||||||
import docking.widgets.label.GIconLabel;
|
import docking.widgets.label.GIconLabel;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
|
import generic.theme.GColor;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.framework.Application;
|
import ghidra.framework.Application;
|
||||||
import ghidra.framework.PluggableServiceRegistry;
|
import ghidra.framework.PluggableServiceRegistry;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
|
@ -115,12 +117,11 @@ public class ApplicationInformationDisplayFactory {
|
||||||
final JPanel panel = new JPanel(new BorderLayout());
|
final JPanel panel = new JPanel(new BorderLayout());
|
||||||
panel.setPreferredSize(new Dimension(400, 400));
|
panel.setPreferredSize(new Dimension(400, 400));
|
||||||
|
|
||||||
Color background = Color.BLACK;
|
Color background = new GColor("color.bg.splashscreen");
|
||||||
|
|
||||||
panel.setBackground(background);
|
panel.setBackground(background);
|
||||||
|
|
||||||
JLabel nameLabel = new GLabel(Application.getName());
|
JLabel nameLabel = new GLabel(Application.getName());
|
||||||
nameLabel.setForeground(new Color(155, 155, 155));
|
nameLabel.setForeground(Palette.GRAY);
|
||||||
Font newFont = new Font("Garamond", Font.BOLD, 35);
|
Font newFont = new Font("Garamond", Font.BOLD, 35);
|
||||||
nameLabel.setFont(newFont);
|
nameLabel.setFont(newFont);
|
||||||
nameLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
nameLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
|
|
@ -24,7 +24,6 @@ import javax.swing.border.BevelBorder;
|
||||||
|
|
||||||
import docking.*;
|
import docking.*;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import docking.widgets.label.GLabel;
|
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.framework.Application;
|
import ghidra.framework.Application;
|
||||||
|
@ -38,6 +37,8 @@ import utility.application.ApplicationLayout;
|
||||||
*/
|
*/
|
||||||
public class SplashScreen extends JWindow {
|
public class SplashScreen extends JWindow {
|
||||||
|
|
||||||
|
private static final Color BG_COLOR = new GColor("color.bg.splashscreen");
|
||||||
|
|
||||||
private static SplashScreen splashWindow; // splash window displayed while ghidra is coming up
|
private static SplashScreen splashWindow; // splash window displayed while ghidra is coming up
|
||||||
private static DockingFrame hiddenFrame;
|
private static DockingFrame hiddenFrame;
|
||||||
private static JLabel statusLabel;
|
private static JLabel statusLabel;
|
||||||
|
@ -285,8 +286,7 @@ public class SplashScreen extends JWindow {
|
||||||
|
|
||||||
private JPanel createMainPanel() {
|
private JPanel createMainPanel() {
|
||||||
JPanel mainPanel = new JPanel(new BorderLayout());
|
JPanel mainPanel = new JPanel(new BorderLayout());
|
||||||
mainPanel.setBackground(new GColor("color.bg.splash"));
|
mainPanel.setBackground(BG_COLOR);
|
||||||
mainPanel.add(createTitlePanel(), BorderLayout.NORTH);
|
|
||||||
mainPanel.add(createContentPanel(), BorderLayout.CENTER);
|
mainPanel.add(createContentPanel(), BorderLayout.CENTER);
|
||||||
return mainPanel;
|
return mainPanel;
|
||||||
}
|
}
|
||||||
|
@ -299,38 +299,12 @@ public class SplashScreen extends JWindow {
|
||||||
return contentPanel;
|
return contentPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Component createTitlePanel() {
|
|
||||||
Color backgroundColor = UIManager.getColor("InternalFrame.activeTitleBackground");
|
|
||||||
Color foregroundColor = UIManager.getColor("InternalFrame.activeTitleForeground");
|
|
||||||
|
|
||||||
JPanel titlePanel = new JPanel();
|
|
||||||
if (backgroundColor == null) {
|
|
||||||
backgroundColor = new Color(0, 0, 255);
|
|
||||||
}
|
|
||||||
titlePanel.setBackground(backgroundColor);
|
|
||||||
titlePanel.setLayout(new BorderLayout());
|
|
||||||
|
|
||||||
JLabel titleLabel =
|
|
||||||
new GLabel(ApplicationInformationDisplayFactory.createSplashScreenTitle());
|
|
||||||
Font font = titleLabel.getFont();
|
|
||||||
font = new Font(font.getName(), Font.BOLD, 11);
|
|
||||||
titleLabel.setFont(font);
|
|
||||||
if (foregroundColor == null) {
|
|
||||||
foregroundColor = Color.white;
|
|
||||||
}
|
|
||||||
titleLabel.setForeground(foregroundColor);
|
|
||||||
titlePanel.add(titleLabel, BorderLayout.CENTER);
|
|
||||||
titlePanel.setBorder(BorderFactory.createEmptyBorder(2, 10, 2, 10));
|
|
||||||
return titlePanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Component createStatusComponent() {
|
private Component createStatusComponent() {
|
||||||
Font f = new Font("serif", Font.BOLD, 12);
|
Font f = new Font("serif", Font.BOLD, 12);
|
||||||
statusLabel = new GDLabel(" Loading...");
|
statusLabel = new GDLabel(" Loading...");
|
||||||
statusLabel.setFont(f);
|
statusLabel.setFont(f);
|
||||||
|
|
||||||
statusLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 2, 10));
|
statusLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 2, 10));
|
||||||
statusLabel.setBackground(new GColor("color.bg.splash"));
|
|
||||||
statusLabel.setOpaque(true);
|
statusLabel.setOpaque(true);
|
||||||
return statusLabel;
|
return statusLabel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,10 @@ import org.jdesktop.animation.timing.TimingTargetAdapter;
|
||||||
import docking.framework.ApplicationInformationDisplayFactory;
|
import docking.framework.ApplicationInformationDisplayFactory;
|
||||||
import docking.util.AnimationPainter;
|
import docking.util.AnimationPainter;
|
||||||
import docking.util.AnimationUtils;
|
import docking.util.AnimationUtils;
|
||||||
|
import generic.theme.GColor;
|
||||||
import ghidra.framework.preferences.Preferences;
|
import ghidra.framework.preferences.Preferences;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
|
import ghidra.util.Swing;
|
||||||
import ghidra.util.bean.GGlassPane;
|
import ghidra.util.bean.GGlassPane;
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
|
|
||||||
|
@ -498,7 +500,7 @@ public class GHelpBroker extends DefaultHelpBroker {
|
||||||
//
|
//
|
||||||
// Unusual Code: Not yet rendered! Try again.
|
// Unusual Code: Not yet rendered! Try again.
|
||||||
//
|
//
|
||||||
SwingUtilities.invokeLater(() -> doCalloutReference(area, numberOfCalls));
|
Swing.runLater(() -> doCalloutReference(area, numberOfCalls));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -653,7 +655,7 @@ public class GHelpBroker extends DefaultHelpBroker {
|
||||||
|
|
||||||
private class LocationHintPainter implements AnimationPainter {
|
private class LocationHintPainter implements AnimationPainter {
|
||||||
|
|
||||||
private Color color = new Color(100, 100, 255, 100);
|
private Color color = new GColor("color.bg.help.hint");
|
||||||
private Shape paintShape;
|
private Shape paintShape;
|
||||||
|
|
||||||
LocationHintPainter(Shape paintShape) {
|
LocationHintPainter(Shape paintShape) {
|
||||||
|
@ -705,11 +707,11 @@ public class GHelpBroker extends DefaultHelpBroker {
|
||||||
/*
|
/*
|
||||||
// Debug
|
// Debug
|
||||||
Shape box = scaler.createTransformedShape(b);
|
Shape box = scaler.createTransformedShape(b);
|
||||||
g2d.setColor(Color.GREEN);
|
g2d.setColor(Palette.GREEN);
|
||||||
g2d.fill(box);
|
g2d.fill(box);
|
||||||
|
|
||||||
box = transform.createTransformedShape(box);
|
box = transform.createTransformedShape(box);
|
||||||
g2d.setColor(Color.YELLOW);
|
g2d.setColor(Palette.YELLOW);
|
||||||
g2d.fill(box);
|
g2d.fill(box);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ import docking.*;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.widgets.EmptyBorderButton;
|
import docking.widgets.EmptyBorderButton;
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.util.Swing;
|
import ghidra.util.Swing;
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
|
|
||||||
|
@ -251,7 +252,7 @@ public class MultipleActionDockingToolbarButton extends EmptyBorderButton {
|
||||||
return; // shouldn't happen
|
return; // shouldn't happen
|
||||||
}
|
}
|
||||||
|
|
||||||
g.setColor(Color.BLACK);
|
g.setColor(Colors.FOREGROUND);
|
||||||
int iconWidth = baseIcon.getIconWidth();
|
int iconWidth = baseIcon.getIconWidth();
|
||||||
int iconHeight = baseIcon.getIconHeight();
|
int iconHeight = baseIcon.getIconHeight();
|
||||||
int insetsPadding = insets.left + insets.right; // the insets of the left icon and the arrow (between the two)
|
int insetsPadding = insets.left + insets.right; // the insets of the left icon and the arrow (between the two)
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.awt.*;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,7 +100,7 @@ public class ButtonPanelFactory {
|
||||||
public final static Icon BROWSE_ICON = new Icon() {
|
public final static Icon BROWSE_ICON = new Icon() {
|
||||||
@Override
|
@Override
|
||||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||||
g.setColor(Color.BLACK);
|
g.setColor(Colors.FOREGROUND);
|
||||||
g.fillRect(x, y + 5, 2, 2);
|
g.fillRect(x, y + 5, 2, 2);
|
||||||
g.fillRect(x + 4, y + 5, 2, 2);
|
g.fillRect(x + 4, y + 5, 2, 2);
|
||||||
g.fillRect(x + 8, y + 5, 2, 2);
|
g.fillRect(x + 8, y + 5, 2, 2);
|
||||||
|
|
|
@ -21,12 +21,13 @@ import java.awt.event.MouseEvent;
|
||||||
import java.beans.PropertyEditorSupport;
|
import java.beans.PropertyEditorSupport;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
|
||||||
|
|
||||||
import docking.DialogComponentProvider;
|
import docking.DialogComponentProvider;
|
||||||
import docking.DockingWindowManager;
|
import docking.DockingWindowManager;
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
import generic.theme.TempColorUtils;
|
||||||
|
import ghidra.util.ColorUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Color editor that is a bit unusual in that its custom component is a button that when pushed,
|
* Color editor that is a bit unusual in that its custom component is a button that when pushed,
|
||||||
|
@ -35,9 +36,6 @@ import docking.widgets.label.GDHtmlLabel;
|
||||||
*/
|
*/
|
||||||
public class ColorEditor extends PropertyEditorSupport {
|
public class ColorEditor extends PropertyEditorSupport {
|
||||||
|
|
||||||
private static final String LIGHT_COLOR = "SILVER";
|
|
||||||
private static final String DARK_COLOR = "BLACK";
|
|
||||||
|
|
||||||
private static GhidraColorChooser colorChooser;
|
private static GhidraColorChooser colorChooser;
|
||||||
|
|
||||||
private JLabel previewLabel = new GDHtmlLabel();
|
private JLabel previewLabel = new GDHtmlLabel();
|
||||||
|
@ -88,14 +86,9 @@ public class ColorEditor extends PropertyEditorSupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateColor(Color newColor) {
|
private void updateColor(Color newColor) {
|
||||||
String colorString = LIGHT_COLOR;
|
|
||||||
|
|
||||||
// change the color to a darker value if the color being set is light
|
// change the color to a darker value if the color being set is light
|
||||||
int colorValue = newColor.getRed() + newColor.getGreen() + newColor.getBlue();
|
String colorString = TempColorUtils.toString(ColorUtils.contrastForegroundColor(newColor));
|
||||||
if (colorValue > 400) { // arbitrary threshold determined by trial-and-error
|
|
||||||
colorString = DARK_COLOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
previewLabel.setText(
|
previewLabel.setText(
|
||||||
"<HTML><CENTER><I><FONT SIZE=2 COLOR=" + colorString + ">click</FONT></I></CENTER>");
|
"<HTML><CENTER><I><FONT SIZE=2 COLOR=" + colorString + ">click</FONT></I></CENTER>");
|
||||||
|
|
||||||
|
@ -118,14 +111,12 @@ public class ColorEditor extends PropertyEditorSupport {
|
||||||
gfx.setColor(color);
|
gfx.setColor(color);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gfx.setColor(Color.black);
|
gfx.setColor(Palette.BLACK);
|
||||||
}
|
}
|
||||||
gfx.fillRect(box.x, box.y, box.width, box.height);
|
gfx.fillRect(box.x, box.y, box.width, box.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
private class EditorProvider extends DialogComponentProvider {
|
||||||
|
|
||||||
class EditorProvider extends DialogComponentProvider {
|
|
||||||
EditorProvider(JPanel contentPanel) {
|
EditorProvider(JPanel contentPanel) {
|
||||||
super("Color Editor", true);
|
super("Color Editor", true);
|
||||||
|
|
||||||
|
@ -141,7 +132,7 @@ public class ColorEditor extends PropertyEditorSupport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ColorEditorPanel extends JPanel {
|
private class ColorEditorPanel extends JPanel {
|
||||||
|
|
||||||
ColorEditorPanel() {
|
ColorEditorPanel() {
|
||||||
|
|
||||||
|
@ -152,15 +143,13 @@ public class ColorEditor extends PropertyEditorSupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
add(colorChooser, BorderLayout.CENTER);
|
add(colorChooser, BorderLayout.CENTER);
|
||||||
colorChooser.getSelectionModel().addChangeListener(new ChangeListener() {
|
colorChooser.getSelectionModel().addChangeListener(e -> {
|
||||||
@Override
|
|
||||||
public void stateChanged(ChangeEvent e) {
|
// This could be a ColorUIResource, but Options only support storing Color. So,
|
||||||
lastUserSelectedColor = colorChooser.getColor();
|
// manually create a new Color object to avoid saving a ColorUIResource.
|
||||||
// This could be a ColorUIResource, but Options only support storing Color.
|
Color c = colorChooser.getColor();
|
||||||
lastUserSelectedColor =
|
lastUserSelectedColor = TempColorUtils.fromRgba(c.getRed(), c.getGreen(),
|
||||||
new Color(lastUserSelectedColor.getRed(), lastUserSelectedColor.getGreen(),
|
c.getBlue(), c.getAlpha());
|
||||||
lastUserSelectedColor.getBlue(), lastUserSelectedColor.getAlpha());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
colorChooser.setColor(color);
|
colorChooser.setColor(color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
*/
|
*/
|
||||||
package docking.options.editor;
|
package docking.options.editor;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
|
|
||||||
|
@ -55,7 +54,6 @@ public class OptionsDialog extends DialogComponentProvider {
|
||||||
new OptionsPropertyChangeListener());
|
new OptionsPropertyChangeListener());
|
||||||
|
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
setBackground(Color.lightGray);
|
|
||||||
|
|
||||||
addWorkPanel(panel);
|
addWorkPanel(panel);
|
||||||
addOKButton();
|
addOKButton();
|
||||||
|
@ -67,6 +65,7 @@ public class OptionsDialog extends DialogComponentProvider {
|
||||||
setFocusComponent(panel.getFocusComponent());
|
setFocusComponent(panel.getFocusComponent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
panel.dispose();
|
panel.dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,14 @@ import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.*;
|
import javax.swing.border.LineBorder;
|
||||||
import javax.swing.colorchooser.AbstractColorChooserPanel;
|
import javax.swing.colorchooser.AbstractColorChooserPanel;
|
||||||
|
|
||||||
import docking.widgets.label.GHtmlLabel;
|
import docking.widgets.label.GHtmlLabel;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Java;
|
||||||
|
import generic.theme.TempColorUtils;
|
||||||
import ghidra.util.layout.VerticalLayout;
|
import ghidra.util.layout.VerticalLayout;
|
||||||
|
|
||||||
public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
|
public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
|
||||||
|
@ -66,6 +69,7 @@ public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
|
||||||
return Integer.parseInt((String) value);
|
return Integer.parseInt((String) value);
|
||||||
}
|
}
|
||||||
catch (NumberFormatException nfe) {
|
catch (NumberFormatException nfe) {
|
||||||
|
// return default value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
@ -118,8 +122,7 @@ public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
|
||||||
recentSwatchListener = new RecentSwatchListener();
|
recentSwatchListener = new RecentSwatchListener();
|
||||||
recentSwatchPanel.addMouseListener(recentSwatchListener);
|
recentSwatchPanel.addMouseListener(recentSwatchListener);
|
||||||
|
|
||||||
Border border =
|
LineBorder border = new LineBorder(Java.BORDER);
|
||||||
new CompoundBorder(new LineBorder(Color.black), new LineBorder(Color.white));
|
|
||||||
swatchPanel.setBorder(border);
|
swatchPanel.setBorder(border);
|
||||||
gbc.weightx = 1.0;
|
gbc.weightx = 1.0;
|
||||||
gbc.gridwidth = 2;
|
gbc.gridwidth = 2;
|
||||||
|
@ -182,6 +185,7 @@ public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateChooser() {
|
public void updateChooser() {
|
||||||
|
// stub
|
||||||
}
|
}
|
||||||
|
|
||||||
class HistorySwatchListener extends MouseAdapter {
|
class HistorySwatchListener extends MouseAdapter {
|
||||||
|
@ -222,7 +226,7 @@ class SwatchPanel extends JPanel {
|
||||||
initColors();
|
initColors();
|
||||||
setToolTipText(""); // register for events
|
setToolTipText(""); // register for events
|
||||||
setOpaque(true);
|
setOpaque(true);
|
||||||
setBackground(Color.white);
|
setBackground(Colors.BACKGROUND);
|
||||||
setRequestFocusEnabled(false);
|
setRequestFocusEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,6 +236,7 @@ class SwatchPanel extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initValues() {
|
protected void initValues() {
|
||||||
|
// stub
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -251,7 +256,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(Color.black);
|
g.setColor(Java.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,
|
||||||
|
@ -268,7 +273,7 @@ class SwatchPanel extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initColors() {
|
protected void initColors() {
|
||||||
|
// stub
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -384,7 +389,8 @@ class MainSwatchPanel extends SwatchPanel {
|
||||||
colors = new Color[numColors];
|
colors = new Color[numColors];
|
||||||
for (int i = 0; i < numColors; i++) {
|
for (int i = 0; i < numColors; i++) {
|
||||||
colors[i] =
|
colors[i] =
|
||||||
new Color(rawValues[(i * 3)], rawValues[(i * 3) + 1], rawValues[(i * 3) + 2]);
|
TempColorUtils.fromRgb(rawValues[(i * 3)], rawValues[(i * 3) + 1],
|
||||||
|
rawValues[(i * 3) + 2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,15 @@ import javax.swing.Icon;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
|
||||||
import docking.util.GraphicsUtils;
|
import docking.util.GraphicsUtils;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An icon that paints the given number
|
* An icon that paints the given number
|
||||||
*/
|
*/
|
||||||
public class NumberIcon implements Icon {
|
public class NumberIcon implements Icon {
|
||||||
|
|
||||||
|
private static final Color BORDER_COLOR = Palette.getColor("lightskyblue");
|
||||||
private String number;
|
private String number;
|
||||||
private float bestFontSize = -1;
|
private float bestFontSize = -1;
|
||||||
|
|
||||||
|
@ -42,9 +45,9 @@ public class NumberIcon implements Icon {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||||
g.setColor(Color.WHITE);
|
g.setColor(Colors.BACKGROUND);
|
||||||
g.fillRect(x, y, getIconWidth(), getIconHeight());
|
g.fillRect(x, y, getIconWidth(), getIconHeight());
|
||||||
g.setColor(new Color(0xb5d5ff));
|
g.setColor(BORDER_COLOR);
|
||||||
g.drawRect(x, y, getIconWidth(), getIconHeight());
|
g.drawRect(x, y, getIconWidth(), getIconHeight());
|
||||||
|
|
||||||
float fontSize = getMaxFontSize(g, getIconWidth() - 1, getIconHeight());
|
float fontSize = getMaxFontSize(g, getIconWidth() - 1, getIconHeight());
|
||||||
|
@ -66,7 +69,7 @@ public class NumberIcon implements Icon {
|
||||||
int halfTextWidth = textWidth >> 1;
|
int halfTextWidth = textWidth >> 1;
|
||||||
int baselineX = x + (halfWidth - halfTextWidth);
|
int baselineX = x + (halfWidth - halfTextWidth);
|
||||||
|
|
||||||
g.setColor(Color.BLACK);
|
g.setColor(Colors.FOREGROUND);
|
||||||
JComponent jc = null;
|
JComponent jc = null;
|
||||||
if (c instanceof JComponent) {
|
if (c instanceof JComponent) {
|
||||||
jc = (JComponent) c;
|
jc = (JComponent) c;
|
||||||
|
|
|
@ -25,6 +25,8 @@ import org.jdesktop.animation.timing.Animator.RepeatBehavior;
|
||||||
import org.jdesktop.animation.timing.TimingTargetAdapter;
|
import org.jdesktop.animation.timing.TimingTargetAdapter;
|
||||||
import org.jdesktop.animation.timing.interpolation.PropertySetter;
|
import org.jdesktop.animation.timing.interpolation.PropertySetter;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Java;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import generic.util.image.ImageUtils;
|
import generic.util.image.ImageUtils;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
|
@ -392,12 +394,11 @@ public class AnimationUtils {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paint(GGlassPane glassPane, Graphics g) {
|
public void paint(GGlassPane glassPane, Graphics g) {
|
||||||
Color gray = Color.GRAY;
|
Color gray = Palette.GRAY;
|
||||||
// double darknessFudge = .95;
|
// double darknessFudge = .95;
|
||||||
// double progress = percentComplete * darknessFudge; // emphasis starts at 1
|
// double progress = percentComplete * darknessFudge; // emphasis starts at 1
|
||||||
// int alpha = Math.min(255, (int) (255 * progress));
|
// int alpha = Math.min(255, (int) (255 * progress));
|
||||||
// gray = new Color(gray.getRed(), gray.getGreen(), gray.getBlue(), alpha);
|
// gray = ColorUtils.fromRgba(gray.getRed(), gray.getGreen(), gray.getBlue(), alpha);
|
||||||
gray = new Color(gray.getRed(), gray.getGreen(), gray.getBlue());
|
|
||||||
|
|
||||||
Graphics2D g2d = (Graphics2D) g;
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
Composite originaComposite = g2d.getComposite();
|
Composite originaComposite = g2d.getComposite();
|
||||||
|
@ -819,7 +820,7 @@ public class AnimationUtils {
|
||||||
@Override
|
@Override
|
||||||
public void paint(GGlassPane glassPane, Graphics g) {
|
public void paint(GGlassPane glassPane, Graphics g) {
|
||||||
|
|
||||||
Color background = new Color(218, 232, 250);
|
Color background = Palette.getColor("lightsteelblue");
|
||||||
g.setColor(background);
|
g.setColor(background);
|
||||||
|
|
||||||
Rectangle defaultBounds = component.getBounds();
|
Rectangle defaultBounds = component.getBounds();
|
||||||
|
@ -877,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(Color.BLACK);
|
g.setColor(Java.BORDER);
|
||||||
|
|
||||||
int iw = emphasizedBounds.width;
|
int iw = emphasizedBounds.width;
|
||||||
int ih = emphasizedBounds.height;
|
int ih = emphasizedBounds.height;
|
||||||
|
|
|
@ -1,371 +0,0 @@
|
||||||
/* ###
|
|
||||||
* 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.util;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import javax.swing.Icon;
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
|
|
||||||
import resources.MultiIcon;
|
|
||||||
import resources.ResourceManager;
|
|
||||||
import resources.icons.EmptyIcon;
|
|
||||||
import resources.icons.ScaledImageIcon;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An icon that allows sub-icons to be added at key perimeter locations. Each position can
|
|
||||||
* be manipulated independently, adding and removing icons as desired. Additionally,
|
|
||||||
* each position can be toggled enabled or disabled, or visible or invisible.
|
|
||||||
*/
|
|
||||||
public class BadgedIcon implements Icon {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The top-edge horizontal positions move up 20% from origin
|
|
||||||
* The middle horizontal positions are at origin+30%
|
|
||||||
* The bottom-edge horizontal positions are at origin+60%
|
|
||||||
*
|
|
||||||
* The left-edge vertical positions move left 20% from origin
|
|
||||||
* The middle vertical positions are at origin+30%
|
|
||||||
* The right-edge vertical positions are at origin+60%
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public enum BadgePosition {
|
|
||||||
TopLeft(-.2, -.2),
|
|
||||||
TopMiddle(.3, -.2),
|
|
||||||
TopRight(.6, -.2),
|
|
||||||
|
|
||||||
LeftMiddle(-.2, .3),
|
|
||||||
Center(.3, .3),
|
|
||||||
RightMiddle(.6, .3),
|
|
||||||
|
|
||||||
BottomLeft(-.2, .6),
|
|
||||||
BottomMiddle(.3, .6),
|
|
||||||
BottomRight(.6, .6);
|
|
||||||
|
|
||||||
private final double horizontalDisplacementFactor;
|
|
||||||
private final double verticalDisplacementFactor;
|
|
||||||
|
|
||||||
private BadgePosition(double hdf, double vdf) {
|
|
||||||
horizontalDisplacementFactor = hdf;
|
|
||||||
verticalDisplacementFactor = vdf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getHorizontalDisplacementFactor() {
|
|
||||||
return horizontalDisplacementFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getVerticalDisplacementFactor() {
|
|
||||||
return verticalDisplacementFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<BadgePosition, MultiIcon> badgeMap = new EnumMap<>(BadgePosition.class);
|
|
||||||
private Map<BadgePosition, Boolean> badgeEnablement = new EnumMap<>(BadgePosition.class);
|
|
||||||
private Map<BadgePosition, Boolean> badgeVisibility = new EnumMap<>(BadgePosition.class);
|
|
||||||
|
|
||||||
private static double BADGE_HSCALE_FACTOR = .75;
|
|
||||||
private static double BADGE_VSCALE_FACTOR = .75;
|
|
||||||
|
|
||||||
// if the icon hasn't changed, this will help in painting...
|
|
||||||
private Icon cachedThis = null;
|
|
||||||
|
|
||||||
private Icon base;
|
|
||||||
|
|
||||||
private int height;
|
|
||||||
private int width;
|
|
||||||
private boolean enabled;
|
|
||||||
|
|
||||||
public BadgedIcon(Icon baseIcon) {
|
|
||||||
this(baseIcon, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BadgedIcon(Icon baseIcon, boolean enabled) {
|
|
||||||
this(baseIcon, enabled, baseIcon.getIconWidth(), baseIcon.getIconHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
public BadgedIcon(Icon baseIcon, boolean enabled, int width, int height) {
|
|
||||||
|
|
||||||
Objects.requireNonNull(baseIcon, "Base Icon must not be null");
|
|
||||||
|
|
||||||
this.base = baseIcon;
|
|
||||||
this.width = width;
|
|
||||||
this.height = height;
|
|
||||||
this.enabled = enabled;
|
|
||||||
|
|
||||||
initDefaultBadges();
|
|
||||||
|
|
||||||
cachedThis = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static MultiIcon getEmptyIcon(int width, int height, boolean enabled) {
|
|
||||||
return new MultiIcon(new EmptyIcon(width, height), !enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initDefaultBadges() {
|
|
||||||
for (BadgePosition pos : BadgePosition.values()) {
|
|
||||||
|
|
||||||
badgeMap.put(pos, getEmptyIcon(width, height, enabled));
|
|
||||||
badgeEnablement.put(pos, true);
|
|
||||||
badgeVisibility.put(pos, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add an icon at the specified location
|
|
||||||
* @param badge The icon
|
|
||||||
* @param position Where to place the image
|
|
||||||
* @return a reference to this object
|
|
||||||
*/
|
|
||||||
public BadgedIcon addBadge(Icon badge, BadgePosition position) {
|
|
||||||
|
|
||||||
badgeMap.get(position).addIcon(badge);
|
|
||||||
|
|
||||||
height = Math.max(height, badge.getIconHeight());
|
|
||||||
width = Math.max(width, badge.getIconWidth());
|
|
||||||
|
|
||||||
cachedThis = null;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BadgedIcon addScaledBadge(Icon icon, int newWidth, int newHeight,
|
|
||||||
BadgePosition position) {
|
|
||||||
|
|
||||||
Icon badge = ResourceManager.getScaledIcon(icon, width, height);
|
|
||||||
|
|
||||||
badgeMap.get(position).addIcon(badge);
|
|
||||||
|
|
||||||
height = Math.max(height, badge.getIconHeight());
|
|
||||||
width = Math.max(width, badge.getIconWidth());
|
|
||||||
|
|
||||||
cachedThis = null;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replace the existing icon with the provided icon at the specified location
|
|
||||||
* @param badge The icon
|
|
||||||
* @param position Where to place the image
|
|
||||||
* @return a reference to this object
|
|
||||||
*/
|
|
||||||
public BadgedIcon setBadge(Icon badge, BadgePosition position) {
|
|
||||||
MultiIcon multi = null;
|
|
||||||
if (badge == null) {
|
|
||||||
badge = getEmptyIcon(width, height, enabled);
|
|
||||||
}
|
|
||||||
multi = new MultiIcon(badge, enabled, width, height);
|
|
||||||
badgeMap.put(position, multi);
|
|
||||||
|
|
||||||
cachedThis = null;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the badge from the specified location
|
|
||||||
* @param position Where to place the image
|
|
||||||
* @return a reference to this object
|
|
||||||
*/
|
|
||||||
public BadgedIcon removeBadge(BadgePosition position) {
|
|
||||||
setBadge(null, position);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the enablement of the badge at the specified location
|
|
||||||
* @param position Which icon to modify
|
|
||||||
* @param enabled True if the image should be shown 'enabled', false otherwise
|
|
||||||
* @see BadgedIcon#isBadgeEnabled(BadgePosition)
|
|
||||||
*/
|
|
||||||
public void setBadgeEnabled(BadgePosition position, boolean enabled) {
|
|
||||||
if (isBadgeEnabled(position) == enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
badgeEnablement.put(position, enabled);
|
|
||||||
cachedThis = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the enablement status of the badge at the specified location
|
|
||||||
* @param position Which icon to enquire about
|
|
||||||
* @return True if the badge is enabled, false otherwise
|
|
||||||
* @see BadgedIcon#setBadgeEnabled(BadgePosition, boolean)
|
|
||||||
*/
|
|
||||||
public boolean isBadgeEnabled(BadgePosition position) {
|
|
||||||
return badgeEnablement.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the visibility status of the badge at the specified location
|
|
||||||
* @param position Which icon to modify
|
|
||||||
* @param visible True if the badge should be visible, false otherwise
|
|
||||||
* @see #isBadgeVisible(BadgePosition)
|
|
||||||
*/
|
|
||||||
public void setBadgeVisisble(BadgePosition position, boolean visible) {
|
|
||||||
if (isBadgeVisible(position) == visible) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
badgeVisibility.put(position, visible);
|
|
||||||
|
|
||||||
cachedThis = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the visibility status of the badge at the specified location
|
|
||||||
* @param position Which icon to enquire about
|
|
||||||
* @return True if the badge is visible, false otherwise
|
|
||||||
* @see #setBadgeVisisble(BadgePosition, boolean)
|
|
||||||
*/
|
|
||||||
public boolean isBadgeVisible(BadgePosition position) {
|
|
||||||
return badgeVisibility.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see javax.swing.Icon#getIconHeight()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int getIconHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see javax.swing.Icon#getIconWidth()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int getIconWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine the overall enablement appearance state.
|
|
||||||
* @return true if the if the entire icon is rendered as 'enabled'; false otherwise.
|
|
||||||
*/
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the 'enabled' appearance of the entire icon.
|
|
||||||
* Preserves the underlying enablement state of badges, though the entire icon
|
|
||||||
* looks disabled if <code>setEnabled(true)</code> is called.
|
|
||||||
* @param enabled
|
|
||||||
*/
|
|
||||||
public void setEnabled(boolean enabled) {
|
|
||||||
this.enabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return array of Icons that were added to this BadgedIcon.
|
|
||||||
*/
|
|
||||||
public Icon[] getBadges(BadgePosition pos) {
|
|
||||||
MultiIcon badge = badgeMap.get(pos);
|
|
||||||
return badge.getIcons();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dimension getBadgeDimension() {
|
|
||||||
return new Dimension((int) (width * BADGE_HSCALE_FACTOR),
|
|
||||||
(int) (height * BADGE_VSCALE_FACTOR));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
|
||||||
|
|
||||||
if (cachedThis != null) {
|
|
||||||
cachedThis.paintIcon(c, g, x, y);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Dimension badgeSize = getBadgeDimension();
|
|
||||||
doPaintIcon(c, g, x, y, badgeSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!enabled) {
|
|
||||||
// Alpha blend to background
|
|
||||||
Color bgColor = c.getBackground();
|
|
||||||
g.setColor(new Color(bgColor.getRed(), bgColor.getGreen(), bgColor.getBlue(), 128));
|
|
||||||
g.fillRect(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doPaintIcon(Component c, Graphics g, int x, int y, Dimension badgeSize) {
|
|
||||||
BufferedImage cached = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
|
||||||
Graphics gc = cached.getGraphics();
|
|
||||||
|
|
||||||
base.paintIcon(c, gc, x, y);
|
|
||||||
|
|
||||||
for (BadgePosition pos : BadgePosition.values()) {
|
|
||||||
if (!isBadgeVisible(pos)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
MultiIcon icon = badgeMap.get(pos);
|
|
||||||
|
|
||||||
Icon scaled = new ScaledImageIcon(icon, badgeSize.width, badgeSize.height);
|
|
||||||
|
|
||||||
Point badgePaintLoc = getBadgePaintLocation(pos, badgeSize);
|
|
||||||
|
|
||||||
int badgeX = x + badgePaintLoc.x;
|
|
||||||
int badgeY = y + badgePaintLoc.y;
|
|
||||||
|
|
||||||
scaled.paintIcon(c, gc, badgeX, badgeY);
|
|
||||||
|
|
||||||
if (!isBadgeEnabled(pos)) {
|
|
||||||
// Alpha blend to background
|
|
||||||
Color bgColor = c.getBackground();
|
|
||||||
gc.setColor(
|
|
||||||
new Color(bgColor.getRed(), bgColor.getGreen(), bgColor.getBlue(), 128));
|
|
||||||
gc.fillRect(badgeX, badgeY, badgeSize.width, badgeSize.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cachedThis = new ImageIcon(cached);
|
|
||||||
|
|
||||||
cachedThis.paintIcon(c, g, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Point getBadgePaintLocation(BadgePosition pos, Dimension badgeSize) {
|
|
||||||
|
|
||||||
double dx = pos.getHorizontalDisplacementFactor();
|
|
||||||
double dy = pos.getVerticalDisplacementFactor();
|
|
||||||
|
|
||||||
Point p = new Point((int) (dx * badgeSize.width), (int) (dy * badgeSize.height));
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return getClass().getSimpleName() + "[" + getIconNames() + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getIconNames() {
|
|
||||||
|
|
||||||
StringBuffer buffy = new StringBuffer();
|
|
||||||
|
|
||||||
for (BadgePosition pos : BadgePosition.values()) {
|
|
||||||
MultiIcon mi = badgeMap.get(pos);
|
|
||||||
buffy.append(pos).append("[").append(mi.toString()).append("]");
|
|
||||||
buffy.append(", ");
|
|
||||||
}
|
|
||||||
|
|
||||||
return buffy.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -21,11 +21,12 @@ import java.awt.geom.RectangularShape;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.VolatileImage;
|
import java.awt.image.VolatileImage;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import generic.util.image.ImageUtils;
|
import generic.util.image.ImageUtils;
|
||||||
|
|
||||||
public class Callout {
|
public class Callout {
|
||||||
|
|
||||||
private static final Color CALLOUT_SHAPE_COLOR = new Color(0xB5, 0xDE, 0x2F);
|
private static final Color CALLOUT_SHAPE_COLOR = Palette.getColor("color.palette.palegreen");
|
||||||
private static final int CALLOUT_BORDER_PADDING = 20;
|
private static final int CALLOUT_BORDER_PADDING = 20;
|
||||||
|
|
||||||
public Image createCallout(CalloutComponentInfo calloutInfo) {
|
public Image createCallout(CalloutComponentInfo calloutInfo) {
|
||||||
|
@ -111,13 +112,13 @@ public class Callout {
|
||||||
//
|
//
|
||||||
// Debug
|
// Debug
|
||||||
//
|
//
|
||||||
// g2d.setColor(Color.RED);
|
// g2d.setColor(Palette.RED);
|
||||||
// g2d.draw(fullBounds);
|
// g2d.draw(fullBounds);
|
||||||
//
|
//
|
||||||
// g2d.setColor(Color.CYAN);
|
// g2d.setColor(Palette.CYAN);
|
||||||
// g2d.draw(calloutBounds);
|
// g2d.draw(calloutBounds);
|
||||||
//
|
//
|
||||||
// g2d.setColor(Color.BLUE);
|
// g2d.setColor(Palette.BLUE);
|
||||||
// g2d.draw(cBounds);
|
// g2d.draw(cBounds);
|
||||||
|
|
||||||
// return image;
|
// return image;
|
||||||
|
@ -189,7 +190,7 @@ public class Callout {
|
||||||
createCalloutImage(calloutInfo, componentLocation, calloutBounds, calloutDrawingArea);
|
createCalloutImage(calloutInfo, componentLocation, calloutBounds, calloutDrawingArea);
|
||||||
|
|
||||||
DropShadow dropShadow = new DropShadow();
|
DropShadow dropShadow = new DropShadow();
|
||||||
Image shadow = dropShadow.createDrowShadow(calloutImage, 40);
|
Image shadow = dropShadow.createDropShadow(calloutImage, 40);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create our final image and draw into it the callout image and its shadow
|
// Create our final image and draw into it the callout image and its shadow
|
||||||
|
@ -214,7 +215,8 @@ public class Callout {
|
||||||
bottomPadding = overlap;
|
bottomPadding = overlap;
|
||||||
}
|
}
|
||||||
|
|
||||||
image = ImageUtils.padImage(image, Color.WHITE, topPadding, 0, rightPadding, bottomPadding);
|
image =
|
||||||
|
ImageUtils.padImage(image, Palette.WHITE, topPadding, 0, rightPadding, bottomPadding);
|
||||||
Graphics g = image.getGraphics();
|
Graphics g = image.getGraphics();
|
||||||
Graphics2D g2d = (Graphics2D) g;
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
|
@ -228,30 +230,30 @@ public class Callout {
|
||||||
//
|
//
|
||||||
// Debug
|
// Debug
|
||||||
//
|
//
|
||||||
// g2d.setColor(Color.RED);
|
// g2d.setColor(Palette.RED);
|
||||||
// g2d.draw(fullBounds);
|
// g2d.draw(fullBounds);
|
||||||
//
|
//
|
||||||
// g2d.setColor(Color.CYAN);
|
// g2d.setColor(Palette.CYAN);
|
||||||
// g2d.draw(calloutBounds);
|
// g2d.draw(calloutBounds);
|
||||||
//
|
//
|
||||||
// g2d.setColor(Color.BLUE);
|
// g2d.setColor(Palette.BLUE);
|
||||||
// g2d.draw(componentBounds);
|
// g2d.draw(componentBounds);
|
||||||
//
|
//
|
||||||
// g2d.setColor(Color.MAGENTA);
|
// g2d.setColor(Palette.MAGENTA);
|
||||||
// g2d.draw(completeBounds);
|
// g2d.draw(completeBounds);
|
||||||
//
|
//
|
||||||
// g2d.setColor(Color.GRAY);
|
// g2d.setColor(Palette.GRAY);
|
||||||
// g2d.draw(dropShadowBounds);
|
// g2d.draw(dropShadowBounds);
|
||||||
//
|
//
|
||||||
// Point cLocation = componentBounds.getLocation();
|
// Point cLocation = componentBounds.getLocation();
|
||||||
// Point convertedCLocation = calloutInfo.convertPointToParent(cLocation);
|
// Point convertedCLocation = calloutInfo.convertPointToParent(cLocation);
|
||||||
// g2d.setColor(Color.PINK);
|
// g2d.setColor(Palette.PINK);
|
||||||
// componentBounds.setLocation(convertedCLocation);
|
// componentBounds.setLocation(convertedCLocation);
|
||||||
// g2d.draw(componentBounds);
|
// g2d.draw(componentBounds);
|
||||||
//
|
//
|
||||||
// Point convertedFBLocation = calloutInfo.convertPointToParent(fullBounds.getLocation());
|
// Point convertedFBLocation = calloutInfo.convertPointToParent(fullBounds.getLocation());
|
||||||
// fullBounds.setLocation(convertedFBLocation);
|
// fullBounds.setLocation(convertedFBLocation);
|
||||||
// g2d.setColor(Color.ORANGE);
|
// g2d.setColor(Palette.ORANGE);
|
||||||
// g2d.draw(fullBounds);
|
// g2d.draw(fullBounds);
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
@ -404,7 +406,7 @@ public class Callout {
|
||||||
// render the clip shape into the image
|
// render the clip shape into the image
|
||||||
g.setComposite(AlphaComposite.Src);
|
g.setComposite(AlphaComposite.Src);
|
||||||
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
g.setColor(Color.WHITE);
|
g.setColor(Palette.WHITE);
|
||||||
|
|
||||||
g.fill(imageShape);
|
g.fill(imageShape);
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,11 @@ import java.awt.image.*;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
public class DropShadow {
|
public class DropShadow {
|
||||||
|
|
||||||
private Color shadowColor = new Color(0x000000);
|
private Color shadowColor = Palette.BLACK;
|
||||||
private float shadowOpacity = 0.85f;
|
private float shadowOpacity = 0.85f;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -40,7 +42,7 @@ public class DropShadow {
|
||||||
@Override
|
@Override
|
||||||
protected void paintComponent(Graphics g) {
|
protected void paintComponent(Graphics g) {
|
||||||
Graphics2D g2d = (Graphics2D) g;
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
Color background = Color.WHITE;
|
Color background = Palette.WHITE;
|
||||||
g.setColor(background);
|
g.setColor(background);
|
||||||
Dimension size = getSize();
|
Dimension size = getSize();
|
||||||
g.fillRect(0, 0, size.width, size.height);
|
g.fillRect(0, 0, size.width, size.height);
|
||||||
|
@ -59,14 +61,14 @@ public class DropShadow {
|
||||||
g2d.setComposite(AlphaComposite.Src);
|
g2d.setComposite(AlphaComposite.Src);
|
||||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
g2d.setColor(Color.WHITE);
|
g2d.setColor(Palette.WHITE);
|
||||||
g2d.fillOval(size.width / 4, size.height / 4, size.width / 2, size.height / 2);
|
g2d.fillOval(size.width / 4, size.height / 4, size.width / 2, size.height / 2);
|
||||||
|
|
||||||
// Using ScrAtop uses the alpha value as a coverage for each pixel stored in
|
// Using ScrAtop uses the alpha value as a coverage for each pixel stored in
|
||||||
// the destination. For the areas outside the clip shape, the destination alpha will
|
// the destination. For the areas outside the clip shape, the destination alpha will
|
||||||
// be zero, so nothing is rendered in those areas.
|
// be zero, so nothing is rendered in those areas.
|
||||||
g2d.setComposite(AlphaComposite.SrcAtop);
|
g2d.setComposite(AlphaComposite.SrcAtop);
|
||||||
g2d.setPaint(new GradientPaint(0, 0, Color.RED, 0, size.height, Color.YELLOW));
|
g2d.setPaint(new GradientPaint(0, 0, Palette.RED, 0, size.height, Palette.YELLOW));
|
||||||
g2d.fillRect(0, 0, size.width, size.height);
|
g2d.fillRect(0, 0, size.width, size.height);
|
||||||
g2d.dispose();
|
g2d.dispose();
|
||||||
|
|
||||||
|
@ -77,7 +79,7 @@ public class DropShadow {
|
||||||
graphics.dispose();
|
graphics.dispose();
|
||||||
image = bufferedImage;
|
image = bufferedImage;
|
||||||
|
|
||||||
shadow = ds.createDrowShadow(bufferedImage, 5);
|
shadow = ds.createDropShadow(bufferedImage, 5);
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -206,7 +208,7 @@ public class DropShadow {
|
||||||
return subject;
|
return subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image createDrowShadow(BufferedImage image, int shadowSize) {
|
public Image createDropShadow(BufferedImage image, int shadowSize) {
|
||||||
BufferedImage subject = prepareImage(image, shadowSize);
|
BufferedImage subject = prepareImage(image, shadowSize);
|
||||||
|
|
||||||
// BufferedImage shadow =
|
// BufferedImage shadow =
|
||||||
|
|
|
@ -23,6 +23,7 @@ import javax.swing.border.Border;
|
||||||
|
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
@ -57,7 +58,7 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel {
|
||||||
public AbstractGCellRenderer() {
|
public AbstractGCellRenderer() {
|
||||||
noFocusBorder = BorderFactory.createEmptyBorder(0, 5, 0, 5);
|
noFocusBorder = BorderFactory.createEmptyBorder(0, 5, 0, 5);
|
||||||
Border innerBorder = BorderFactory.createEmptyBorder(0, 4, 0, 4);
|
Border innerBorder = BorderFactory.createEmptyBorder(0, 4, 0, 4);
|
||||||
Border outerBorder = BorderFactory.createLineBorder(Color.YELLOW, 1);
|
Border outerBorder = BorderFactory.createLineBorder(Palette.YELLOW, 1);
|
||||||
focusBorder = BorderFactory.createCompoundBorder(outerBorder, innerBorder);
|
focusBorder = BorderFactory.createCompoundBorder(outerBorder, innerBorder);
|
||||||
setBorder(noFocusBorder);
|
setBorder(noFocusBorder);
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class DropDownMultiSelectionTextField<T> extends DropDownSelectionTextFie
|
||||||
previewList = new JList<>();
|
previewList = new JList<>();
|
||||||
}
|
}
|
||||||
previewList.setOpaque(true);
|
previewList.setOpaque(true);
|
||||||
previewList.setBackground(TOOLTIP_WINDOW_BGCOLOR);
|
previewList.setBackground(PREVIEW_WINDOW_BGCOLOR);
|
||||||
previewList.setFocusable(false);
|
previewList.setFocusable(false);
|
||||||
previewList.setModel(new DefaultListModel<String>());
|
previewList.setModel(new DefaultListModel<String>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
import docking.widgets.list.GList;
|
import docking.widgets.list.GList;
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.util.StringUtilities;
|
import ghidra.util.StringUtilities;
|
||||||
import ghidra.util.SystemUtilities;
|
import ghidra.util.SystemUtilities;
|
||||||
|
@ -62,7 +63,7 @@ public class DropDownTextField<T> extends JTextField implements GComponent {
|
||||||
private static final int DEFAULT_MAX_UPDATE_DELAY = 2000;
|
private static final int DEFAULT_MAX_UPDATE_DELAY = 2000;
|
||||||
private static final int MIN_HEIGHT = 300;
|
private static final int MIN_HEIGHT = 300;
|
||||||
private static final int MIN_WIDTH = 200;
|
private static final int MIN_WIDTH = 200;
|
||||||
protected static final Color TOOLTIP_WINDOW_BGCOLOR = new Color(255, 255, 225);
|
protected static final Color PREVIEW_WINDOW_BGCOLOR = Colors.BACKGROUND;
|
||||||
|
|
||||||
private JWindow toolTipWindow; // delayed initialization for parenting
|
private JWindow toolTipWindow; // delayed initialization for parenting
|
||||||
private JWindow matchingWindow; // delayed initialization for parenting
|
private JWindow matchingWindow; // delayed initialization for parenting
|
||||||
|
@ -155,7 +156,7 @@ public class DropDownTextField<T> extends JTextField implements GComponent {
|
||||||
protected void setPreviewPaneAttributes() {
|
protected void setPreviewPaneAttributes() {
|
||||||
previewLabel = new GDHtmlLabel();
|
previewLabel = new GDHtmlLabel();
|
||||||
previewLabel.setOpaque(true);
|
previewLabel.setOpaque(true);
|
||||||
previewLabel.setBackground(TOOLTIP_WINDOW_BGCOLOR);
|
previewLabel.setBackground(PREVIEW_WINDOW_BGCOLOR);
|
||||||
previewLabel.setVerticalAlignment(SwingConstants.TOP);
|
previewLabel.setVerticalAlignment(SwingConstants.TOP);
|
||||||
previewLabel.setFocusable(false);
|
previewLabel.setFocusable(false);
|
||||||
}
|
}
|
||||||
|
@ -342,7 +343,7 @@ public class DropDownTextField<T> extends JTextField implements GComponent {
|
||||||
updateWindowLocation();
|
updateWindowLocation();
|
||||||
showMatchingWindow();
|
showMatchingWindow();
|
||||||
|
|
||||||
getPreviewPaneComponent().setBackground(TOOLTIP_WINDOW_BGCOLOR);
|
getPreviewPaneComponent().setBackground(PREVIEW_WINDOW_BGCOLOR);
|
||||||
toolTipWindow.setVisible(hasPreview());
|
toolTipWindow.setVisible(hasPreview());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import javax.swing.*;
|
||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
|
|
||||||
import docking.widgets.shapes.*;
|
import docking.widgets.shapes.*;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.util.bean.GGlassPane;
|
import ghidra.util.bean.GGlassPane;
|
||||||
import ghidra.util.bean.GGlassPanePainter;
|
import ghidra.util.bean.GGlassPanePainter;
|
||||||
|
@ -337,7 +338,7 @@ public class PopupWindow {
|
||||||
Point p = new Point(r.getLocation());
|
Point p = new Point(r.getLocation());
|
||||||
SwingUtilities.convertPointFromScreen(p, glassPane);
|
SwingUtilities.convertPointFromScreen(p, glassPane);
|
||||||
|
|
||||||
Color c = new Color(50, 50, 200, 125);
|
Color c = Palette.LAVENDER;
|
||||||
g.setColor(c);
|
g.setColor(c);
|
||||||
g.fillRect(p.x, p.y, r.width, r.height);
|
g.fillRect(p.x, p.y, r.width, r.height);
|
||||||
}
|
}
|
||||||
|
@ -346,7 +347,7 @@ public class PopupWindow {
|
||||||
if (sourceEvent != null) {
|
if (sourceEvent != null) {
|
||||||
Point p = sourceEvent.getPoint();
|
Point p = sourceEvent.getPoint();
|
||||||
p = SwingUtilities.convertPoint(sourceEvent.getComponent(), p.x, p.y, glassPane);
|
p = SwingUtilities.convertPoint(sourceEvent.getComponent(), p.x, p.y, glassPane);
|
||||||
g.setColor(Color.RED);
|
g.setColor(Palette.RED);
|
||||||
int offset = 10;
|
int offset = 10;
|
||||||
g.fillRect(p.x - offset, p.y - offset, (offset * 2), (offset * 2));
|
g.fillRect(p.x - offset, p.y - offset, (offset * 2), (offset * 2));
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import docking.widgets.EmptyBorderButton;
|
||||||
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.Palette;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.HTMLUtilities;
|
||||||
import ghidra.util.exception.CancelledException;
|
import ghidra.util.exception.CancelledException;
|
||||||
import ghidra.util.layout.PairLayout;
|
import ghidra.util.layout.PairLayout;
|
||||||
|
@ -121,12 +122,12 @@ public class ConditionTestPanel extends JPanel {
|
||||||
private void updateOverallProgress() {
|
private void updateOverallProgress() {
|
||||||
overallProgressBar.setMaxProgress(conditionTestModel.getTestCount());
|
overallProgressBar.setMaxProgress(conditionTestModel.getTestCount());
|
||||||
overallProgressBar.setProgress(conditionTestModel.getCompletedTestCount());
|
overallProgressBar.setProgress(conditionTestModel.getCompletedTestCount());
|
||||||
Color color = Color.GREEN;
|
Color color = Palette.GREEN;
|
||||||
if (conditionTestModel.getErrorCount() > 0) {
|
if (conditionTestModel.getErrorCount() > 0) {
|
||||||
color = Color.RED;
|
color = Palette.RED;
|
||||||
}
|
}
|
||||||
else if (conditionTestModel.getWarningCount() > 0) {
|
else if (conditionTestModel.getWarningCount() > 0) {
|
||||||
color = Color.YELLOW;
|
color = Palette.YELLOW;
|
||||||
}
|
}
|
||||||
overallProgressBar.setColor(color);
|
overallProgressBar.setColor(color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ import docking.widgets.fieldpanel.support.*;
|
||||||
import docking.widgets.indexedscrollpane.IndexScrollListener;
|
import docking.widgets.indexedscrollpane.IndexScrollListener;
|
||||||
import docking.widgets.indexedscrollpane.IndexedScrollable;
|
import docking.widgets.indexedscrollpane.IndexedScrollable;
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
|
import generic.theme.TempColorUtils;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
import ghidra.util.SystemUtilities;
|
import ghidra.util.SystemUtilities;
|
||||||
|
|
||||||
|
@ -1152,10 +1154,7 @@ public class FieldPanel extends JPanel
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color blend(Color primary, Color secondary) {
|
private Color blend(Color primary, Color secondary) {
|
||||||
int red = (primary.getRed() * 3 + secondary.getRed()) / 4;
|
return TempColorUtils.blend4(primary, secondary);
|
||||||
int green = (primary.getGreen() * 3 + secondary.getGreen()) / 4;
|
|
||||||
int blue = (primary.getBlue() * 3 + secondary.getBlue()) / 4;
|
|
||||||
return new Color(red, green, blue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void paintLayoutBackground(Graphics g, Rectangle rect, AnchoredLayout layout,
|
private void paintLayoutBackground(Graphics g, Rectangle rect, AnchoredLayout layout,
|
||||||
|
@ -1185,7 +1184,7 @@ public class FieldPanel extends JPanel
|
||||||
Color defaultBackgroundColor = backgroundColorModel.getDefaultBackgroundColor();
|
Color defaultBackgroundColor = backgroundColorModel.getDefaultBackgroundColor();
|
||||||
g.setColor(defaultBackgroundColor);
|
g.setColor(defaultBackgroundColor);
|
||||||
g.fillRect(r.x, layout.getYPos() - layout.getHeight(), r.width, layout.getHeight());
|
g.fillRect(r.x, layout.getYPos() - layout.getHeight(), r.width, layout.getHeight());
|
||||||
g.setColor(Color.RED);
|
g.setColor(Messages.ERROR);
|
||||||
GraphicsUtils.drawString(this, g, "Error Painting Field", r.x, layout.getYPos());
|
GraphicsUtils.drawString(this, g, "Error Painting Field", r.x, layout.getYPos());
|
||||||
Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);
|
Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import docking.widgets.fieldpanel.internal.FieldBackgroundColorManager;
|
||||||
import docking.widgets.fieldpanel.internal.PaintContext;
|
import docking.widgets.fieldpanel.internal.PaintContext;
|
||||||
import docking.widgets.fieldpanel.support.DefaultRowColLocation;
|
import docking.widgets.fieldpanel.support.DefaultRowColLocation;
|
||||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Text field that is blank.
|
* A Text field that is blank.
|
||||||
|
@ -55,6 +56,7 @@ public class EmptyTextField implements Field {
|
||||||
/**
|
/**
|
||||||
* Returns true if the cursor is allowed past the last character. This
|
* Returns true if the cursor is allowed past the last character. This
|
||||||
* field always returns false since there is no text.
|
* field always returns false since there is no text.
|
||||||
|
* @returns true if the cursor is allowed past the last character
|
||||||
*/
|
*/
|
||||||
public boolean isAllowCursorAtEnd() {
|
public boolean isAllowCursorAtEnd() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -168,6 +170,7 @@ public class EmptyTextField implements Field {
|
||||||
* @param color the new foreground color.
|
* @param color the new foreground color.
|
||||||
*/
|
*/
|
||||||
public void setForeground(Color color) {
|
public void setForeground(Color color) {
|
||||||
|
// cannot change foreground
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,7 +181,7 @@ public class EmptyTextField implements Field {
|
||||||
* was called.
|
* was called.
|
||||||
*/
|
*/
|
||||||
public Color getForeground() {
|
public Color getForeground() {
|
||||||
return Color.WHITE;
|
return Palette.NO_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.awt.Graphics;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to force a clip to happen by using this field with space characters and size that far
|
* Used to force a clip to happen by using this field with space characters and size that far
|
||||||
|
@ -68,7 +69,7 @@ public class StrutFieldElement implements FieldElement {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Color getColor(int charIndex) {
|
public Color getColor(int charIndex) {
|
||||||
return Color.BLACK;
|
return Colors.FOREGROUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,10 +15,10 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.fieldpanel.internal;
|
package docking.widgets.fieldpanel.internal;
|
||||||
|
|
||||||
import ghidra.util.datastruct.*;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
|
import generic.theme.TempColorUtils;
|
||||||
|
import ghidra.util.datastruct.*;
|
||||||
|
|
||||||
public class ColorRangeMap {
|
public class ColorRangeMap {
|
||||||
private RangeMap map;
|
private RangeMap map;
|
||||||
|
@ -38,14 +37,17 @@ public class ColorRangeMap {
|
||||||
map.paintRange(start, end, colorValue);
|
map.paintRange(start, end, colorValue);
|
||||||
valueRange = map.getValueRange(0);
|
valueRange = map.getValueRange(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear(long start, long end) {
|
public void clear(long start, long end) {
|
||||||
map.paintRange(start, end, 0);
|
map.paintRange(start, end, 0);
|
||||||
valueRange = map.getValueRange(0);
|
valueRange = map.getValueRange(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
map.clear();
|
map.clear();
|
||||||
valueRange = map.getValueRange(0);
|
valueRange = map.getValueRange(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color getColor(long index, Color defaultColor) {
|
public Color getColor(long index, Color defaultColor) {
|
||||||
if (!valueRange.contains(index)) {
|
if (!valueRange.contains(index)) {
|
||||||
valueRange = map.getValueRange(index);
|
valueRange = map.getValueRange(index);
|
||||||
|
@ -56,14 +58,16 @@ public class ColorRangeMap {
|
||||||
}
|
}
|
||||||
return getColor(valueRange.getValue());
|
return getColor(valueRange.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color getColor(int colorValue) {
|
private Color getColor(int colorValue) {
|
||||||
if (lastColorValue == colorValue) {
|
if (lastColorValue == colorValue) {
|
||||||
return lastColor;
|
return lastColor;
|
||||||
}
|
}
|
||||||
lastColorValue = colorValue;
|
lastColorValue = colorValue;
|
||||||
lastColor = new Color(colorValue);
|
lastColor = TempColorUtils.fromRgb(colorValue);
|
||||||
return lastColor;
|
return lastColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColorRangeMap copy() {
|
public ColorRangeMap copy() {
|
||||||
ColorRangeMap newMap = new ColorRangeMap();
|
ColorRangeMap newMap = new ColorRangeMap();
|
||||||
IndexRangeIterator it = map.getIndexRangeIterator(-1);
|
IndexRangeIterator it = map.getIndexRangeIterator(-1);
|
||||||
|
|
|
@ -18,6 +18,8 @@ package docking.widgets.fieldpanel.internal;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
import generic.theme.TempColorUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Miscellaneous information needed by fields to paint.
|
* Miscellaneous information needed by fields to paint.
|
||||||
|
@ -50,7 +52,7 @@ public class PaintContext {
|
||||||
focusedCursorColor = new GColor("color.cursor.focused");
|
focusedCursorColor = new GColor("color.cursor.focused");
|
||||||
notFocusedCursorColor = new GColor("color.cursor.unfocused");
|
notFocusedCursorColor = new GColor("color.cursor.unfocused");
|
||||||
cursorColor = focusedCursorColor;
|
cursorColor = focusedCursorColor;
|
||||||
invisibleCursorColor = new Color(255, 0, 0, 1);
|
invisibleCursorColor = Palette.NO_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaintContext(PaintContext other) {
|
public PaintContext(PaintContext other) {
|
||||||
|
@ -128,10 +130,7 @@ public class PaintContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adjustSelectedHighlightColor() {
|
private void adjustSelectedHighlightColor() {
|
||||||
int red = (selectionColor.getRed() + highlightColor.getRed()) / 2;
|
selectedHighlightColor = TempColorUtils.blend3(selectionColor, highlightColor);
|
||||||
int green = (selectionColor.getGreen() + highlightColor.getGreen()) / 2;
|
|
||||||
int blue = (selectionColor.getBlue() + highlightColor.getBlue()) / 2;
|
|
||||||
selectedHighlightColor = new Color(red, green, blue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBackgroundColor(Color c) {
|
public void setBackgroundColor(Color c) {
|
||||||
|
@ -144,7 +143,7 @@ public class PaintContext {
|
||||||
|
|
||||||
public void setCursorColor(Color c) {
|
public void setCursorColor(Color c) {
|
||||||
cursorColor = c;
|
cursorColor = c;
|
||||||
invisibleCursorColor = new Color(c.getRed(), c.getGreen(), c.getBlue(), 1);
|
invisibleCursorColor = Palette.NO_COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean cursorHidden() {
|
public boolean cursorHidden() {
|
||||||
|
|
|
@ -28,12 +28,13 @@ import docking.widgets.fieldpanel.listener.IndexMapper;
|
||||||
import docking.widgets.fieldpanel.listener.LayoutModelListener;
|
import docking.widgets.fieldpanel.listener.LayoutModelListener;
|
||||||
import docking.widgets.fieldpanel.support.*;
|
import docking.widgets.fieldpanel.support.*;
|
||||||
import docking.widgets.indexedscrollpane.IndexedScrollPane;
|
import docking.widgets.indexedscrollpane.IndexedScrollPane;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
|
||||||
public class TestBigLayoutModel implements LayoutModel {
|
public class TestBigLayoutModel implements LayoutModel {
|
||||||
private static final Highlight[] NO_HIGHLIGHTS = new Highlight[0];
|
private static final Highlight[] NO_HIGHLIGHTS = new Highlight[0];
|
||||||
private static final HighlightFactory hlFactory =
|
private static final HighlightFactory hlFactory =
|
||||||
(field, text, cursorTextOffset) -> NO_HIGHLIGHTS;
|
(field, text, cursorTextOffset) -> NO_HIGHLIGHTS;
|
||||||
ArrayList<LayoutModelListener> listeners = new ArrayList<LayoutModelListener>();
|
ArrayList<LayoutModelListener> listeners = new ArrayList<>();
|
||||||
|
|
||||||
FontMetrics fm;
|
FontMetrics fm;
|
||||||
// BigInteger numIndexes = BigInteger.valueOf(1000000000000000L);
|
// BigInteger numIndexes = BigInteger.valueOf(1000000000000000L);
|
||||||
|
@ -83,9 +84,10 @@ public class TestBigLayoutModel implements LayoutModel {
|
||||||
}
|
}
|
||||||
String text = name + ": This is line " + index +
|
String text = name + ": This is line " + index +
|
||||||
" More text to make line longer abcdefghijklmnopqrstuvwxyzabcdefghijk";
|
" More text to make line longer abcdefghijklmnopqrstuvwxyzabcdefghijk";
|
||||||
FieldElement fe1 = new TextFieldElement(new AttributedString(text, Color.BLACK, fm), 0, 0);
|
FieldElement fe1 =
|
||||||
|
new TextFieldElement(new AttributedString(text, Colors.FOREGROUND, fm), 0, 0);
|
||||||
FieldElement fe2 =
|
FieldElement fe2 =
|
||||||
new TextFieldElement(new AttributedString("More text", Color.BLACK, fm), 0, 0);
|
new TextFieldElement(new AttributedString("More text", Colors.FOREGROUND, fm), 0, 0);
|
||||||
SingleRowLayout layout = new SingleRowLayout(new ClippingTextField(20, 300, fe1, hlFactory),
|
SingleRowLayout layout = new SingleRowLayout(new ClippingTextField(20, 300, fe1, hlFactory),
|
||||||
new ClippingTextField(330, 100, fe2, hlFactory));
|
new ClippingTextField(330, 100, fe2, hlFactory));
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@ import docking.widgets.AutoLookup;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import docking.widgets.list.GList;
|
import docking.widgets.list.GList;
|
||||||
import docking.widgets.list.GListAutoLookup;
|
import docking.widgets.list.GListAutoLookup;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Java;
|
||||||
import ghidra.util.exception.AssertException;
|
import ghidra.util.exception.AssertException;
|
||||||
|
|
||||||
class DirectoryList extends GList<File> implements GhidraFileChooserDirectoryModelIf {
|
class DirectoryList extends GList<File> implements GhidraFileChooserDirectoryModelIf {
|
||||||
|
@ -184,12 +186,12 @@ class DirectoryList extends GList<File> implements GhidraFileChooserDirectoryMod
|
||||||
});
|
});
|
||||||
|
|
||||||
listEditor = new JPanel(new BorderLayout());
|
listEditor = new JPanel(new BorderLayout());
|
||||||
listEditor.setBorder(BorderFactory.createLineBorder(Color.GRAY));
|
listEditor.setBorder(BorderFactory.createLineBorder(Java.BORDER));
|
||||||
|
|
||||||
listEditor.add(listEditorLabel, BorderLayout.WEST);
|
listEditor.add(listEditorLabel, BorderLayout.WEST);
|
||||||
listEditor.add(listEditorField, BorderLayout.CENTER);
|
listEditor.add(listEditorField, BorderLayout.CENTER);
|
||||||
|
|
||||||
listEditor.setBackground(Color.WHITE);
|
listEditor.setBackground(Colors.BACKGROUND);
|
||||||
listEditorField.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
listEditorField.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
||||||
|
|
||||||
add(listEditor);
|
add(listEditor);
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.filechooser;
|
package docking.widgets.filechooser;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -23,8 +22,8 @@ import java.io.File;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
|
||||||
public class FileChooserToggleButton extends JToggleButton {
|
public class FileChooserToggleButton extends JToggleButton {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -50,7 +49,7 @@ public class FileChooserToggleButton extends JToggleButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initBorder() {
|
private void initBorder() {
|
||||||
setForeground(Color.WHITE);
|
setForeground(Colors.BACKGROUND);
|
||||||
setOpaque(true);
|
setOpaque(true);
|
||||||
setHorizontalTextPosition(SwingConstants.CENTER);
|
setHorizontalTextPosition(SwingConstants.CENTER);
|
||||||
setVerticalTextPosition(SwingConstants.BOTTOM);
|
setVerticalTextPosition(SwingConstants.BOTTOM);
|
||||||
|
@ -63,15 +62,13 @@ public class FileChooserToggleButton extends JToggleButton {
|
||||||
addMouseListener(new ButtonMouseListener());
|
addMouseListener(new ButtonMouseListener());
|
||||||
|
|
||||||
// works in conjunction with the mouse listener to properly set the border
|
// works in conjunction with the mouse listener to properly set the border
|
||||||
addChangeListener( new ChangeListener() {
|
addChangeListener(e -> {
|
||||||
public void stateChanged( ChangeEvent e ) {
|
|
||||||
if (isSelected()) {
|
if (isSelected()) {
|
||||||
setBorder(LOWERED_BORDER);
|
setBorder(LOWERED_BORDER);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setBorder(NO_BORDER);
|
setBorder(NO_BORDER);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setFocusable(false); // this prevents the focus box from being drawn over the button
|
setFocusable(false); // this prevents the focus box from being drawn over the button
|
||||||
|
|
|
@ -24,6 +24,7 @@ import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.table.TableCellEditor;
|
import javax.swing.table.TableCellEditor;
|
||||||
|
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Java;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
import ghidra.util.filechooser.GhidraFileChooserModel;
|
import ghidra.util.filechooser.GhidraFileChooserModel;
|
||||||
|
|
||||||
|
@ -100,12 +101,7 @@ class FileEditor extends AbstractCellEditor implements TableCellEditor {
|
||||||
// make sure the name field gets the focus, not the container
|
// make sure the name field gets the focus, not the container
|
||||||
@Override
|
@Override
|
||||||
public void requestFocus() {
|
public void requestFocus() {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> nameField.requestFocus());
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
nameField.requestFocus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -115,7 +111,7 @@ class FileEditor extends AbstractCellEditor implements TableCellEditor {
|
||||||
// match the spacing of non-editing cells
|
// match the spacing of non-editing cells
|
||||||
editor.setBorder(
|
editor.setBorder(
|
||||||
BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0),
|
BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0),
|
||||||
BorderFactory.createLineBorder(Color.GRAY)));
|
BorderFactory.createLineBorder(Java.BORDER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleDoubleClick(Point p) {
|
private void handleDoubleClick(Point p) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ import docking.widgets.label.GDLabel;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
import docking.widgets.list.GListCellRenderer;
|
import docking.widgets.list.GListCellRenderer;
|
||||||
import generic.theme.GColor;
|
import generic.theme.GColor;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.framework.OperatingSystem;
|
import ghidra.framework.OperatingSystem;
|
||||||
import ghidra.framework.Platform;
|
import ghidra.framework.Platform;
|
||||||
import ghidra.framework.preferences.Preferences;
|
import ghidra.framework.preferences.Preferences;
|
||||||
|
@ -366,7 +367,7 @@ public class GhidraFileChooser extends DialogComponentProvider implements FileFi
|
||||||
|
|
||||||
JPanel panel = new JPanel(new BorderLayout());
|
JPanel panel = new JPanel(new BorderLayout());
|
||||||
panel.setBorder(BorderFactory.createLoweredBevelBorder());
|
panel.setBorder(BorderFactory.createLoweredBevelBorder());
|
||||||
panel.setBackground(BACKGROUND_COLOR.darker());
|
panel.setBackground(Palette.DARK_GRAY);
|
||||||
panel.add(shortCutPanel, BorderLayout.NORTH);
|
panel.add(shortCutPanel, BorderLayout.NORTH);
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.function.Function;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.widgets.AbstractGCellRenderer;
|
import docking.widgets.AbstractGCellRenderer;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a common implementation of a list renderer, for use in both JList and JComboBox.
|
* Provides a common implementation of a list renderer, for use in both JList and JComboBox.
|
||||||
|
@ -94,7 +95,7 @@ public class GListCellRenderer<E> extends AbstractGCellRenderer implements ListC
|
||||||
dropLocation.getIndex() == index);
|
dropLocation.getIndex() == index);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
if (isDropRow) {
|
if (isDropRow) {
|
||||||
setBackground(Color.CYAN);
|
setBackground(Palette.CYAN);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setBackground(getOSDependentBackgroundColor(list, index));
|
setBackground(getOSDependentBackgroundColor(list, index));
|
||||||
|
|
|
@ -29,6 +29,7 @@ import docking.widgets.filechooser.GhidraFileChooser;
|
||||||
import docking.widgets.filechooser.GhidraFileChooserMode;
|
import docking.widgets.filechooser.GhidraFileChooserMode;
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
import generic.jar.ResourceFile;
|
import generic.jar.ResourceFile;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Tables;
|
||||||
import generic.util.Path;
|
import generic.util.Path;
|
||||||
import ghidra.framework.options.SaveState;
|
import ghidra.framework.options.SaveState;
|
||||||
import ghidra.framework.preferences.Preferences;
|
import ghidra.framework.preferences.Preferences;
|
||||||
|
@ -52,7 +53,6 @@ public class PathManager {
|
||||||
private JButton downButton;
|
private JButton downButton;
|
||||||
private JButton addButton;
|
private JButton addButton;
|
||||||
private JButton removeButton;
|
private JButton removeButton;
|
||||||
private Color selectionColor;
|
|
||||||
private GhidraFileChooser fileChooser;
|
private GhidraFileChooser fileChooser;
|
||||||
private String preferenceForLastSelectedDir = Preferences.LAST_IMPORT_DIRECTORY;
|
private String preferenceForLastSelectedDir = Preferences.LAST_IMPORT_DIRECTORY;
|
||||||
private String title = "Select File";
|
private String title = "Select File";
|
||||||
|
@ -102,8 +102,8 @@ public class PathManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new file path and set its enablement
|
* Add a new file path and set its enablement
|
||||||
* @param file
|
* @param file the file whose path to use
|
||||||
* @param enabled
|
* @param enabled true if enabled
|
||||||
* @return true if the enabled path did not already exist
|
* @return true if the enabled path did not already exist
|
||||||
*/
|
*/
|
||||||
public boolean addPath(ResourceFile file, boolean enabled) {
|
public boolean addPath(ResourceFile file, boolean enabled) {
|
||||||
|
@ -127,9 +127,6 @@ public class PathManager {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the paths.
|
|
||||||
*/
|
|
||||||
public void setPaths(List<Path> paths) {
|
public void setPaths(List<Path> paths) {
|
||||||
pathModel.setPaths(paths);
|
pathModel.setPaths(paths);
|
||||||
}
|
}
|
||||||
|
@ -164,8 +161,6 @@ public class PathManager {
|
||||||
private void create(List<Path> paths) {
|
private void create(List<Path> paths) {
|
||||||
panel = new JPanel(new BorderLayout(5, 5));
|
panel = new JPanel(new BorderLayout(5, 5));
|
||||||
|
|
||||||
selectionColor = new Color(204, 204, 255);
|
|
||||||
|
|
||||||
if (allowOrdering) {
|
if (allowOrdering) {
|
||||||
upButton = new JButton(ResourceManager.loadImage("images/up.png"));
|
upButton = new JButton(ResourceManager.loadImage("images/up.png"));
|
||||||
upButton.setName("UpArrow");
|
upButton.setName("UpArrow");
|
||||||
|
@ -215,8 +210,6 @@ public class PathManager {
|
||||||
|
|
||||||
pathTable = new GTable(pathModel);
|
pathTable = new GTable(pathModel);
|
||||||
pathTable.setName("PATH_TABLE");
|
pathTable.setName("PATH_TABLE");
|
||||||
pathTable.setSelectionBackground(selectionColor);
|
|
||||||
pathTable.setSelectionForeground(Color.BLACK);
|
|
||||||
pathTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
pathTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||||
|
|
||||||
//make the 'enabled' column very skinny...
|
//make the 'enabled' column very skinny...
|
||||||
|
@ -240,7 +233,8 @@ public class PathManager {
|
||||||
if (column == PathManagerModel.COLUMN_PATH) {
|
if (column == PathManagerModel.COLUMN_PATH) {
|
||||||
Path path = (Path) value;
|
Path path = (Path) value;
|
||||||
if (!isValidPath(path)) {
|
if (!isValidPath(path)) {
|
||||||
renderer.setForeground(Color.RED);
|
renderer.setForeground(data.isSelected() ? Tables.FG_ERROR_SELECTED
|
||||||
|
: Tables.FG_ERROR_UNSELECTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return renderer;
|
return renderer;
|
||||||
|
|
|
@ -27,6 +27,7 @@ import docking.widgets.OptionDialog;
|
||||||
import docking.widgets.filechooser.GhidraFileChooser;
|
import docking.widgets.filechooser.GhidraFileChooser;
|
||||||
import docking.widgets.filechooser.GhidraFileChooserMode;
|
import docking.widgets.filechooser.GhidraFileChooserMode;
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Tables;
|
||||||
import ghidra.framework.preferences.Preferences;
|
import ghidra.framework.preferences.Preferences;
|
||||||
import ghidra.util.filechooser.GhidraFileChooserModel;
|
import ghidra.util.filechooser.GhidraFileChooserModel;
|
||||||
import ghidra.util.filechooser.GhidraFileFilter;
|
import ghidra.util.filechooser.GhidraFileFilter;
|
||||||
|
@ -54,7 +55,6 @@ public class PathnameTablePanel extends JPanel {
|
||||||
private JButton addButton;
|
private JButton addButton;
|
||||||
private JButton removeButton;
|
private JButton removeButton;
|
||||||
private JButton resetButton;
|
private JButton resetButton;
|
||||||
private Color selectionColor;
|
|
||||||
private GhidraFileChooser fileChooser;
|
private GhidraFileChooser fileChooser;
|
||||||
private String preferenceForLastSelectedDir = Preferences.LAST_IMPORT_DIRECTORY;
|
private String preferenceForLastSelectedDir = Preferences.LAST_IMPORT_DIRECTORY;
|
||||||
private String title = "Select File";
|
private String title = "Select File";
|
||||||
|
@ -134,9 +134,6 @@ public class PathnameTablePanel extends JPanel {
|
||||||
this.addToTop = addToTop;
|
this.addToTop = addToTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return paths in the table.
|
|
||||||
*/
|
|
||||||
public String[] getPaths() {
|
public String[] getPaths() {
|
||||||
String[] paths = new String[tableModel.getRowCount()];
|
String[] paths = new String[tableModel.getRowCount()];
|
||||||
for (int i = 0; i < paths.length; i++) {
|
for (int i = 0; i < paths.length; i++) {
|
||||||
|
@ -145,16 +142,10 @@ public class PathnameTablePanel extends JPanel {
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the paths.
|
|
||||||
*/
|
|
||||||
public void setPaths(String[] paths) {
|
public void setPaths(String[] paths) {
|
||||||
tableModel.setPaths(paths);
|
tableModel.setPaths(paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the table in this path name panel.
|
|
||||||
*/
|
|
||||||
public JTable getTable() {
|
public JTable getTable() {
|
||||||
return pathnameTable;
|
return pathnameTable;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +159,6 @@ public class PathnameTablePanel extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void create() {
|
private void create() {
|
||||||
selectionColor = new Color(204, 204, 255);
|
|
||||||
|
|
||||||
upButton = new JButton(ResourceManager.loadImage("images/up.png"));
|
upButton = new JButton(ResourceManager.loadImage("images/up.png"));
|
||||||
upButton.setName("UpArrow");
|
upButton.setName("UpArrow");
|
||||||
|
@ -222,8 +212,6 @@ public class PathnameTablePanel extends JPanel {
|
||||||
pathnameTable.setShowGrid(false);
|
pathnameTable.setShowGrid(false);
|
||||||
|
|
||||||
pathnameTable.setPreferredScrollableViewportSize(new Dimension(330, 200));
|
pathnameTable.setPreferredScrollableViewportSize(new Dimension(330, 200));
|
||||||
pathnameTable.setSelectionBackground(selectionColor);
|
|
||||||
pathnameTable.setSelectionForeground(Color.BLACK);
|
|
||||||
pathnameTable.setTableHeader(null);
|
pathnameTable.setTableHeader(null);
|
||||||
pathnameTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
pathnameTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||||
JScrollPane scrollPane = new JScrollPane(pathnameTable);
|
JScrollPane scrollPane = new JScrollPane(pathnameTable);
|
||||||
|
@ -265,10 +253,7 @@ public class PathnameTablePanel extends JPanel {
|
||||||
public Component getTableCellRendererComponent(GTableCellRenderingData data) {
|
public Component getTableCellRendererComponent(GTableCellRenderingData data) {
|
||||||
|
|
||||||
JLabel label = (JLabel) super.getTableCellRendererComponent(data);
|
JLabel label = (JLabel) super.getTableCellRendererComponent(data);
|
||||||
|
|
||||||
JTable table = data.getTable();
|
|
||||||
Object value = data.getValue();
|
Object value = data.getValue();
|
||||||
boolean isSelected = data.isSelected();
|
|
||||||
|
|
||||||
String pathName = (String) value;
|
String pathName = (String) value;
|
||||||
|
|
||||||
|
@ -282,8 +267,10 @@ public class PathnameTablePanel extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
label.setText(pathName.toString());
|
label.setText(pathName.toString());
|
||||||
Color fg = isSelected ? table.getSelectionForeground() : table.getForeground();
|
if (!fileExists) {
|
||||||
label.setForeground(!fileExists ? Color.RED : fg);
|
label.setForeground(data.isSelected() ? Tables.FG_ERROR_SELECTED
|
||||||
|
: Tables.FG_ERROR_UNSELECTED);
|
||||||
|
}
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import javax.swing.table.TableCellRenderer;
|
||||||
import javax.swing.table.TableModel;
|
import javax.swing.table.TableModel;
|
||||||
|
|
||||||
import docking.widgets.AbstractGCellRenderer;
|
import docking.widgets.AbstractGCellRenderer;
|
||||||
|
import generic.theme.GColor;
|
||||||
import ghidra.docking.settings.*;
|
import ghidra.docking.settings.*;
|
||||||
import ghidra.util.*;
|
import ghidra.util.*;
|
||||||
import ghidra.util.exception.AssertException;
|
import ghidra.util.exception.AssertException;
|
||||||
|
@ -46,6 +47,8 @@ public class GTableCellRenderer extends AbstractGCellRenderer implements TableCe
|
||||||
protected static final FloatingPointPrecisionSettingsDefinition FLOATING_POINT_PRECISION_SETTING =
|
protected static final FloatingPointPrecisionSettingsDefinition FLOATING_POINT_PRECISION_SETTING =
|
||||||
FloatingPointPrecisionSettingsDefinition.DEF;
|
FloatingPointPrecisionSettingsDefinition.DEF;
|
||||||
|
|
||||||
|
private static final Color BG_DRAG = new GColor("color.bg.table.row.drag");
|
||||||
|
|
||||||
private static DecimalFormat decimalFormat;
|
private static DecimalFormat decimalFormat;
|
||||||
private static Map<Integer, DecimalFormat> decimalFormatCache;
|
private static Map<Integer, DecimalFormat> decimalFormatCache;
|
||||||
|
|
||||||
|
@ -157,7 +160,7 @@ public class GTableCellRenderer extends AbstractGCellRenderer implements TableCe
|
||||||
setForegroundColor(table, model, value);
|
setForegroundColor(table, model, value);
|
||||||
|
|
||||||
if (row == dropRow) {
|
if (row == dropRow) {
|
||||||
setBackground(Color.CYAN);
|
setBackground(BG_DRAG);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setBackground(getOSDependentBackgroundColor(table, row));
|
setBackground(getOSDependentBackgroundColor(table, row));
|
||||||
|
|
|
@ -23,9 +23,12 @@ import javax.swing.*;
|
||||||
import javax.swing.table.*;
|
import javax.swing.table.*;
|
||||||
|
|
||||||
import docking.DialogComponentProvider;
|
import docking.DialogComponentProvider;
|
||||||
|
import generic.theme.GColor;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
|
|
||||||
public class SelectColumnsDialog extends DialogComponentProvider {
|
public class SelectColumnsDialog extends DialogComponentProvider {
|
||||||
|
|
||||||
|
private static final Color BG_NON_DEFAULT = new GColor("color.fg.disabled");
|
||||||
private static final String DISCOVERED_TABLE_COLUMN_NAME = "Non-default";
|
private static final String DISCOVERED_TABLE_COLUMN_NAME = "Non-default";
|
||||||
|
|
||||||
private GTable ghidraTable;
|
private GTable ghidraTable;
|
||||||
|
@ -150,6 +153,7 @@ public class SelectColumnsDialog extends DialogComponentProvider {
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
||||||
private class ColumnSelectorStringRenderer extends GTableCellRenderer {
|
private class ColumnSelectorStringRenderer extends GTableCellRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getTableCellRendererComponent(GTableCellRenderingData data) {
|
public Component getTableCellRendererComponent(GTableCellRenderingData data) {
|
||||||
|
|
||||||
|
@ -164,7 +168,7 @@ public class SelectColumnsDialog extends DialogComponentProvider {
|
||||||
|
|
||||||
TableColumnWrapper tableColumnWrapper = columnList.get(row);
|
TableColumnWrapper tableColumnWrapper = columnList.get(row);
|
||||||
if (!tableColumnWrapper.isDefault()) {
|
if (!tableColumnWrapper.isDefault()) {
|
||||||
c.setBackground(c.getBackground().darker());
|
c.setBackground(BG_NON_DEFAULT);
|
||||||
c.setOpaque(true);
|
c.setOpaque(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +192,7 @@ public class SelectColumnsDialog extends DialogComponentProvider {
|
||||||
|
|
||||||
TableColumnWrapper tableColumnWrapper = columnList.get(row);
|
TableColumnWrapper tableColumnWrapper = columnList.get(row);
|
||||||
if (!tableColumnWrapper.isDefault()) {
|
if (!tableColumnWrapper.isDefault()) {
|
||||||
c.setBackground(c.getBackground().darker());
|
c.setBackground(BG_NON_DEFAULT);
|
||||||
c.setOpaque(true);
|
c.setOpaque(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ import docking.widgets.table.GTableFilterPanel;
|
||||||
import docking.widgets.table.RowObjectFilterModel;
|
import docking.widgets.table.RowObjectFilterModel;
|
||||||
import docking.widgets.table.columnfilter.*;
|
import docking.widgets.table.columnfilter.*;
|
||||||
import docking.widgets.table.constrainteditor.ColumnConstraintEditor;
|
import docking.widgets.table.constrainteditor.ColumnConstraintEditor;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Java;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
|
@ -369,7 +371,7 @@ public class ColumnFilterDialog<R> extends DialogComponentProvider
|
||||||
|
|
||||||
private GLabel createLogicalOperationLabel(LogicOperation op) {
|
private GLabel createLogicalOperationLabel(LogicOperation op) {
|
||||||
GLabel label = new GLabel("<" + op + ">", SwingConstants.CENTER);
|
GLabel label = new GLabel("<" + op + ">", SwingConstants.CENTER);
|
||||||
label.setForeground(Color.GRAY);
|
label.setForeground(Messages.HINT);
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +383,7 @@ public class ColumnFilterDialog<R> extends DialogComponentProvider
|
||||||
headerPanel.add(new GLabel("Filter Value", SwingConstants.CENTER));
|
headerPanel.add(new GLabel("Filter Value", SwingConstants.CENTER));
|
||||||
|
|
||||||
headerPanel.setBorder(new CompoundBorder(
|
headerPanel.setBorder(new CompoundBorder(
|
||||||
BorderFactory.createMatteBorder(0, 0, 1, 0, Color.DARK_GRAY.brighter().brighter()),
|
BorderFactory.createMatteBorder(0, 0, 1, 0, Java.BORDER),
|
||||||
BorderFactory.createEmptyBorder(4, 0, 4, 0)));
|
BorderFactory.createEmptyBorder(4, 0, 4, 0)));
|
||||||
return headerPanel;
|
return headerPanel;
|
||||||
}
|
}
|
||||||
|
@ -475,5 +477,4 @@ public class ColumnFilterDialog<R> extends DialogComponentProvider
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,10 +15,9 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.table.constraint.dialog;
|
package docking.widgets.table.constraint.dialog;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.BorderLayout;
|
||||||
import java.util.ArrayList;
|
import java.awt.Component;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.BevelBorder;
|
import javax.swing.border.BevelBorder;
|
||||||
|
@ -27,6 +26,7 @@ import docking.widgets.EmptyBorderButton;
|
||||||
import docking.widgets.combobox.GhidraComboBox;
|
import docking.widgets.combobox.GhidraComboBox;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import docking.widgets.list.GListCellRenderer;
|
import docking.widgets.list.GListCellRenderer;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.util.layout.VerticalLayout;
|
import ghidra.util.layout.VerticalLayout;
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class ColumnFilterPanel extends JPanel {
|
||||||
|
|
||||||
private Component createOrLabel() {
|
private Component createOrLabel() {
|
||||||
JLabel jLabel = new GDLabel("<OR>", SwingConstants.CENTER);
|
JLabel jLabel = new GDLabel("<OR>", SwingConstants.CENTER);
|
||||||
jLabel.setForeground(Color.GRAY);
|
jLabel.setForeground(Messages.HINT);
|
||||||
return jLabel;
|
return jLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@ package docking.widgets.table.constrainteditor;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
|
||||||
import javax.swing.UIManager;
|
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
import docking.widgets.table.constraint.ColumnConstraint;
|
import docking.widgets.table.constraint.ColumnConstraint;
|
||||||
|
import generic.theme.GColor;
|
||||||
import generic.theme.GThemeDefaults.Colors;
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.HTMLUtilities;
|
||||||
import ghidra.util.datastruct.WeakDataStructureFactory;
|
import ghidra.util.datastruct.WeakDataStructureFactory;
|
||||||
|
@ -44,9 +44,9 @@ public abstract class AbstractColumnConstraintEditor<T> implements ColumnConstra
|
||||||
private boolean validEditorValue = false;
|
private boolean validEditorValue = false;
|
||||||
|
|
||||||
/** Color indicating a valid value is defined by the editor widget(s) */
|
/** Color indicating a valid value is defined by the editor widget(s) */
|
||||||
protected static final Color VALID_INPUT_COLOR = UIManager.getColor("TextField.background");
|
protected static final Color VALID_INPUT_COLOR = Colors.BACKGROUND;
|
||||||
/** Color indicating a invalid value is defined by the editor widget(s) */
|
/** Color indicating a invalid value is defined by the editor widget(s) */
|
||||||
protected static final Color INVALID_INPUT_COLOR = new Color(255, 0, 51, 40);
|
protected static final Color INVALID_INPUT_COLOR = new GColor("docking.palette.mistyrose");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
|
@ -31,6 +31,7 @@ import docking.widgets.DropDownTextField;
|
||||||
import docking.widgets.DropDownTextFieldDataModel;
|
import docking.widgets.DropDownTextFieldDataModel;
|
||||||
import docking.widgets.list.GListCellRenderer;
|
import docking.widgets.list.GListCellRenderer;
|
||||||
import docking.widgets.table.constraint.*;
|
import docking.widgets.table.constraint.*;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.HTMLUtilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -214,7 +215,7 @@ public class AutocompletingStringConstraintEditor extends DataLoadingConstraintE
|
||||||
private String formatListValue(String value, boolean isSelected) {
|
private String formatListValue(String value, boolean isSelected) {
|
||||||
|
|
||||||
Matcher matcher = model.lastConstraint.getHighlightMatcher(value);
|
Matcher matcher = model.lastConstraint.getHighlightMatcher(value);
|
||||||
Color color = isSelected ? Color.YELLOW : Color.MAGENTA;
|
Color color = isSelected ? Palette.YELLOW : Palette.MAGENTA;
|
||||||
StringBuilder sb = new StringBuilder("<html>");
|
StringBuilder sb = new StringBuilder("<html>");
|
||||||
// find and highlight all instances of the user-defined pattern
|
// find and highlight all instances of the user-defined pattern
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.table.constrainteditor;
|
package docking.widgets.table.constrainteditor;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Component;
|
||||||
|
import java.awt.GridLayout;
|
||||||
import java.time.*;
|
import java.time.*;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
|
@ -28,6 +29,7 @@ import docking.widgets.table.constraint.ColumnConstraint;
|
||||||
import docking.widgets.table.constraint.RangeColumnConstraint;
|
import docking.widgets.table.constraint.RangeColumnConstraint;
|
||||||
import docking.widgets.table.constraint.provider.DateColumnConstraintProvider;
|
import docking.widgets.table.constraint.provider.DateColumnConstraintProvider;
|
||||||
import docking.widgets.textfield.LocalDateTextField;
|
import docking.widgets.textfield.LocalDateTextField;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.util.layout.VerticalLayout;
|
import ghidra.util.layout.VerticalLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,7 +111,7 @@ public class DateRangeConstraintEditor extends AbstractColumnConstraintEditor<Lo
|
||||||
panel.add(controlPanel);
|
panel.add(controlPanel);
|
||||||
|
|
||||||
infoLabel = new GDHtmlLabel();
|
infoLabel = new GDHtmlLabel();
|
||||||
infoLabel.setForeground(Color.GRAY);
|
infoLabel.setForeground(Messages.HINT);
|
||||||
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
panel.add(infoLabel);
|
panel.add(infoLabel);
|
||||||
|
|
||||||
|
@ -223,7 +225,9 @@ public class DateRangeConstraintEditor extends AbstractColumnConstraintEditor<Lo
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void markSpinnerAsValid(DateSpinner spinner, boolean valid) {
|
private static void markSpinnerAsValid(DateSpinner spinner, boolean valid) {
|
||||||
spinner.getDateField().getTextField().setBackground(
|
spinner.getDateField()
|
||||||
|
.getTextField()
|
||||||
|
.setBackground(
|
||||||
valid ? VALID_INPUT_COLOR : INVALID_INPUT_COLOR);
|
valid ? VALID_INPUT_COLOR : INVALID_INPUT_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.table.constrainteditor;
|
package docking.widgets.table.constrainteditor;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
@ -24,6 +23,7 @@ import javax.swing.event.ChangeListener;
|
||||||
|
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
import docking.widgets.table.constraint.ColumnConstraint;
|
import docking.widgets.table.constraint.ColumnConstraint;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.HTMLUtilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,7 +50,7 @@ public final class DummyConstraintEditor<T> implements ColumnConstraintEditor<T>
|
||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
|
|
||||||
JLabel errorLabel = new GDHtmlLabel(
|
JLabel errorLabel = new GDHtmlLabel(
|
||||||
"<html>" + HTMLUtilities.bold(HTMLUtilities.colorString(Color.RED, message)));
|
"<html>" + HTMLUtilities.bold(HTMLUtilities.colorString(Messages.ERROR, message)));
|
||||||
|
|
||||||
panel.add(errorLabel);
|
panel.add(errorLabel);
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
import docking.widgets.table.constraint.ColumnConstraint;
|
import docking.widgets.table.constraint.ColumnConstraint;
|
||||||
import docking.widgets.table.constraint.EnumColumnConstraint;
|
import docking.widgets.table.constraint.EnumColumnConstraint;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A constraint editor for enumerated-type values;
|
* A constraint editor for enumerated-type values;
|
||||||
|
@ -79,7 +80,7 @@ public class EnumConstraintEditor<T extends Enum<T>> extends AbstractColumnConst
|
||||||
outerPanel.add(panel, BorderLayout.CENTER);
|
outerPanel.add(panel, BorderLayout.CENTER);
|
||||||
|
|
||||||
infoLabel = new GDHtmlLabel("");
|
infoLabel = new GDHtmlLabel("");
|
||||||
infoLabel.setForeground(Color.GRAY);
|
infoLabel.setForeground(Messages.HINT);
|
||||||
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
outerPanel.add(infoLabel, BorderLayout.SOUTH);
|
outerPanel.add(infoLabel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.table.constrainteditor;
|
package docking.widgets.table.constrainteditor;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Component;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ import docking.widgets.spinner.IntegerSpinner;
|
||||||
import docking.widgets.table.constraint.ColumnConstraint;
|
import docking.widgets.table.constraint.ColumnConstraint;
|
||||||
import docking.widgets.table.constraint.SingleValueColumnConstraint;
|
import docking.widgets.table.constraint.SingleValueColumnConstraint;
|
||||||
import docking.widgets.textfield.IntegerTextField;
|
import docking.widgets.textfield.IntegerTextField;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A constraint editor for specifying comparison with a single integer-type value (Byte, Short,
|
* A constraint editor for specifying comparison with a single integer-type value (Byte, Short,
|
||||||
|
@ -73,7 +75,7 @@ public class IntegerConstraintEditor<T extends Number> extends AbstractColumnCon
|
||||||
panel.add(spinner.getSpinner(), BorderLayout.CENTER);
|
panel.add(spinner.getSpinner(), BorderLayout.CENTER);
|
||||||
statusLabel = new GDHtmlLabel();
|
statusLabel = new GDHtmlLabel();
|
||||||
panel.add(statusLabel, BorderLayout.SOUTH);
|
panel.add(statusLabel, BorderLayout.SOUTH);
|
||||||
statusLabel.setForeground(Color.RED);
|
statusLabel.setForeground(Messages.ERROR);
|
||||||
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.table.constrainteditor;
|
package docking.widgets.table.constrainteditor;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Component;
|
||||||
|
import java.awt.GridLayout;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
@ -24,6 +25,7 @@ import docking.widgets.label.GDHtmlLabel;
|
||||||
import docking.widgets.spinner.IntegerSpinner;
|
import docking.widgets.spinner.IntegerSpinner;
|
||||||
import docking.widgets.table.constraint.ColumnConstraint;
|
import docking.widgets.table.constraint.ColumnConstraint;
|
||||||
import docking.widgets.table.constraint.RangeColumnConstraint;
|
import docking.widgets.table.constraint.RangeColumnConstraint;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.util.layout.VerticalLayout;
|
import ghidra.util.layout.VerticalLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,7 +107,7 @@ public class IntegerRangeConstraintEditor<T extends Number>
|
||||||
panel.add(rangeControlPanel);
|
panel.add(rangeControlPanel);
|
||||||
|
|
||||||
infoLabel = new GDHtmlLabel();
|
infoLabel = new GDHtmlLabel();
|
||||||
infoLabel.setForeground(Color.GRAY);
|
infoLabel.setForeground(Messages.HINT);
|
||||||
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
panel.add(infoLabel);
|
panel.add(infoLabel);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.table.constrainteditor;
|
package docking.widgets.table.constrainteditor;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Component;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ import docking.DockingUtils;
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
import docking.widgets.table.constraint.ColumnConstraint;
|
import docking.widgets.table.constraint.ColumnConstraint;
|
||||||
import docking.widgets.table.constraint.StringColumnConstraint;
|
import docking.widgets.table.constraint.StringColumnConstraint;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A constraint editor for String-type values.
|
* A constraint editor for String-type values.
|
||||||
|
@ -56,7 +58,7 @@ public class StringConstraintEditor extends AbstractColumnConstraintEditor<Strin
|
||||||
panel.add(textField, BorderLayout.CENTER);
|
panel.add(textField, BorderLayout.CENTER);
|
||||||
|
|
||||||
infoLabel = new GDHtmlLabel("abc"); // temporary text in the label so that it sizes properly
|
infoLabel = new GDHtmlLabel("abc"); // temporary text in the label so that it sizes properly
|
||||||
infoLabel.setForeground(Color.RED);
|
infoLabel.setForeground(Messages.ERROR);
|
||||||
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
panel.add(infoLabel, BorderLayout.SOUTH);
|
panel.add(infoLabel, BorderLayout.SOUTH);
|
||||||
return panel;
|
return panel;
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.table.constrainteditor;
|
package docking.widgets.table.constrainteditor;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Component;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
@ -24,6 +25,7 @@ import docking.widgets.label.GDHtmlLabel;
|
||||||
import docking.widgets.table.constraint.ColumnConstraint;
|
import docking.widgets.table.constraint.ColumnConstraint;
|
||||||
import docking.widgets.table.constraint.SingleValueColumnConstraint;
|
import docking.widgets.table.constraint.SingleValueColumnConstraint;
|
||||||
import docking.widgets.textfield.IntegerTextField;
|
import docking.widgets.textfield.IntegerTextField;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A constraint editor for 64 bit unsigned numbers.
|
* A constraint editor for 64 bit unsigned numbers.
|
||||||
|
@ -60,7 +62,7 @@ public class UnsignedLongConstraintEditor extends AbstractColumnConstraintEditor
|
||||||
panel.add(field.getComponent(), BorderLayout.CENTER);
|
panel.add(field.getComponent(), BorderLayout.CENTER);
|
||||||
statusLabel = new GDHtmlLabel();
|
statusLabel = new GDHtmlLabel();
|
||||||
panel.add(statusLabel, BorderLayout.SOUTH);
|
panel.add(statusLabel, BorderLayout.SOUTH);
|
||||||
statusLabel.setForeground(Color.RED);
|
statusLabel.setForeground(Messages.ERROR);
|
||||||
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.table.constrainteditor;
|
package docking.widgets.table.constrainteditor;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Component;
|
||||||
|
import java.awt.GridLayout;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
@ -24,6 +25,7 @@ import docking.widgets.label.GDHtmlLabel;
|
||||||
import docking.widgets.table.constraint.ColumnConstraint;
|
import docking.widgets.table.constraint.ColumnConstraint;
|
||||||
import docking.widgets.table.constraint.RangeColumnConstraint;
|
import docking.widgets.table.constraint.RangeColumnConstraint;
|
||||||
import docking.widgets.textfield.IntegerTextField;
|
import docking.widgets.textfield.IntegerTextField;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.util.layout.VerticalLayout;
|
import ghidra.util.layout.VerticalLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +72,7 @@ public class UnsignedLongRangeConstraintEditor extends AbstractColumnConstraintE
|
||||||
panel.add(rangeControlPanel);
|
panel.add(rangeControlPanel);
|
||||||
|
|
||||||
infoLabel = new GDHtmlLabel();
|
infoLabel = new GDHtmlLabel();
|
||||||
infoLabel.setForeground(Color.GRAY);
|
infoLabel.setForeground(Messages.HINT);
|
||||||
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
panel.add(infoLabel);
|
panel.add(infoLabel);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,9 @@ import java.awt.*;
|
||||||
|
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
|
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple text area that shows a text hint when the field is empty.
|
* Simple text area that shows a text hint when the field is empty.
|
||||||
*
|
*
|
||||||
|
@ -32,16 +35,16 @@ public class HintTextArea extends JTextArea {
|
||||||
/**
|
/**
|
||||||
* Constructs the class with the hint text to be shown.
|
* Constructs the class with the hint text to be shown.
|
||||||
*
|
*
|
||||||
* @param hint
|
* @param hint the hint
|
||||||
*/
|
*/
|
||||||
public HintTextArea(final String hint) {
|
public HintTextArea(String hint) {
|
||||||
this.hint = hint;
|
this.hint = hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Need to override the setText method so we can set font attributes.
|
* Need to override the setText method so we can set font attributes.
|
||||||
*
|
*
|
||||||
* @param text
|
* @param text the text
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setText(String text) {
|
public void setText(String text) {
|
||||||
|
@ -56,7 +59,7 @@ public class HintTextArea extends JTextArea {
|
||||||
if (getText().isEmpty()) {
|
if (getText().isEmpty()) {
|
||||||
if (g instanceof Graphics2D) {
|
if (g instanceof Graphics2D) {
|
||||||
Graphics2D g2 = (Graphics2D) g;
|
Graphics2D g2 = (Graphics2D) g;
|
||||||
g2.setColor(Color.gray);
|
g2.setColor(Messages.HINT);
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
|
|
||||||
|
@ -67,16 +70,11 @@ public class HintTextArea extends JTextArea {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************************
|
|
||||||
* PRIVATE METHODS
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the text attributes to be used when NOT viewing the hint.
|
* Sets the text attributes to be used when NOT viewing the hint.
|
||||||
*/
|
*/
|
||||||
protected void setAttributes() {
|
protected void setAttributes() {
|
||||||
this.setFont(getFont().deriveFont(Font.PLAIN));
|
this.setFont(getFont().deriveFont(Font.PLAIN));
|
||||||
setForeground(Color.BLACK);
|
setForeground(Colors.FOREGROUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.tree.internal;
|
package docking.widgets.tree.internal;
|
||||||
|
|
||||||
import ghidra.framework.OperatingSystem;
|
|
||||||
import ghidra.framework.Platform;
|
|
||||||
import ghidra.util.Msg;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.datatransfer.Transferable;
|
import java.awt.datatransfer.Transferable;
|
||||||
import java.awt.dnd.*;
|
import java.awt.dnd.*;
|
||||||
|
@ -33,9 +29,15 @@ import javax.swing.SwingUtilities;
|
||||||
import javax.swing.tree.TreeCellRenderer;
|
import javax.swing.tree.TreeCellRenderer;
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import docking.widgets.tree.*;
|
import docking.widgets.tree.GTree;
|
||||||
|
import docking.widgets.tree.GTreeNode;
|
||||||
import docking.widgets.tree.support.GTreeDragNDropHandler;
|
import docking.widgets.tree.support.GTreeDragNDropHandler;
|
||||||
import docking.widgets.tree.support.GTreeNodeTransferable;
|
import docking.widgets.tree.support.GTreeNodeTransferable;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
import generic.theme.TempColorUtils;
|
||||||
|
import ghidra.framework.OperatingSystem;
|
||||||
|
import ghidra.framework.Platform;
|
||||||
|
import ghidra.util.Msg;
|
||||||
|
|
||||||
public class GTreeDragNDropAdapter implements DragSourceListener, DragGestureListener,
|
public class GTreeDragNDropAdapter implements DragSourceListener, DragGestureListener,
|
||||||
DropTargetListener {
|
DropTargetListener {
|
||||||
|
@ -155,13 +157,11 @@ public class GTreeDragNDropAdapter implements DragSourceListener, DragGestureLis
|
||||||
// now we will create a fade effect using an alpha composite and a gradient
|
// now we will create a fade effect using an alpha composite and a gradient
|
||||||
Graphics2D g2 = (Graphics2D) graphics;
|
Graphics2D g2 = (Graphics2D) graphics;
|
||||||
GradientPaint mask;
|
GradientPaint mask;
|
||||||
Color treeBackground = tree.getBackground();
|
Color treeBg = tree.getBackground();
|
||||||
Color transparentTreeBackground =
|
Color transparentTreeBackground = TempColorUtils.withAlpha(treeBg, 100);
|
||||||
new Color(treeBackground.getRed(), treeBackground.getGreen(), treeBackground.getBlue(),
|
|
||||||
100);
|
|
||||||
mask =
|
mask =
|
||||||
new GradientPaint(0, 0, transparentTreeBackground, 0, size.height >> 1, new Color(1.0f,
|
new GradientPaint(0, 0, transparentTreeBackground, 0, size.height >> 1,
|
||||||
1.0f, 1.0f, 0.0f));
|
Palette.NO_COLOR);
|
||||||
g2.setPaint(mask);
|
g2.setPaint(mask);
|
||||||
|
|
||||||
// Sets the alpha composite
|
// Sets the alpha composite
|
||||||
|
@ -214,14 +214,14 @@ public class GTreeDragNDropAdapter implements DragSourceListener, DragGestureLis
|
||||||
|
|
||||||
private List<GTreeNode> createSelectionList(TreePath[] selectionPaths) {
|
private List<GTreeNode> createSelectionList(TreePath[] selectionPaths) {
|
||||||
|
|
||||||
List<GTreeNode> list = new ArrayList<GTreeNode>();
|
List<GTreeNode> list = new ArrayList<>();
|
||||||
|
|
||||||
if (selectionPaths == null) {
|
if (selectionPaths == null) {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < selectionPaths.length; i++) {
|
for (TreePath selectionPath : selectionPaths) {
|
||||||
list.add((GTreeNode) selectionPaths[i].getLastPathComponent());
|
list.add((GTreeNode) selectionPath.getLastPathComponent());
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import generic.theme.GColor;
|
||||||
|
|
||||||
public class GTreeRenderer extends DefaultTreeCellRenderer implements GComponent {
|
public class GTreeRenderer extends DefaultTreeCellRenderer implements GComponent {
|
||||||
|
|
||||||
private static final Color VALID_DROP_TARGET_COLOR = new Color(200, 200, 255);
|
private static final Color VALID_DROP_TARGET_COLOR = new GColor("color.bg.tree.drag");
|
||||||
private static final int DEFAULT_MIN_ICON_WIDTH = 22;
|
private static final int DEFAULT_MIN_ICON_WIDTH = 22;
|
||||||
|
|
||||||
private Object dropTarget;
|
private Object dropTarget;
|
||||||
|
|
|
@ -27,6 +27,7 @@ import docking.DialogComponentProvider;
|
||||||
import docking.DockingWindowManager;
|
import docking.DockingWindowManager;
|
||||||
import docking.widgets.EmptyBorderButton;
|
import docking.widgets.EmptyBorderButton;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||||
import ghidra.util.*;
|
import ghidra.util.*;
|
||||||
import help.Help;
|
import help.Help;
|
||||||
import help.HelpService;
|
import help.HelpService;
|
||||||
|
@ -81,6 +82,7 @@ public class WizardManager extends DialogComponentProvider implements WizardPane
|
||||||
/**
|
/**
|
||||||
* @see java.awt.Window#dispose()
|
* @see java.awt.Window#dispose()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (currWizPanel != null) {
|
if (currWizPanel != null) {
|
||||||
currWizPanel.removeWizardPanelListener(this);
|
currWizPanel.removeWizardPanelListener(this);
|
||||||
|
@ -471,7 +473,7 @@ if (!visitedMap.containsKey(currWizPanel)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
titledBorder.setTitleFont(font.deriveFont(10f));
|
titledBorder.setTitleFont(font.deriveFont(10f));
|
||||||
titledBorder.setTitleColor(Color.BLUE);
|
titledBorder.setTitleColor(Messages.NORMAL);
|
||||||
titledBorder.setTitlePosition(TitledBorder.BOTTOM);
|
titledBorder.setTitlePosition(TitledBorder.BOTTOM);
|
||||||
titledBorder.setTitleJustification(TitledBorder.TRAILING);
|
titledBorder.setTitleJustification(TitledBorder.TRAILING);
|
||||||
|
|
||||||
|
|
|
@ -1,173 +0,0 @@
|
||||||
/* ###
|
|
||||||
* 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 ghidra.docking.util.painting;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.image.*;
|
|
||||||
|
|
||||||
import javax.swing.RepaintManager;
|
|
||||||
|
|
||||||
import ghidra.util.Msg;
|
|
||||||
import sun.awt.image.SurfaceManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A repaint manager that can be plugged-in to Java's {@link RepaintManager} in order to
|
|
||||||
* change how we paint colors.
|
|
||||||
*
|
|
||||||
* @see Graphics2D
|
|
||||||
*/
|
|
||||||
public class GRepaintManager extends RepaintManager {
|
|
||||||
|
|
||||||
private VolatileImageWrapper imageWrapper = new VolatileImageWrapper();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Image getVolatileOffscreenBuffer(Component c, int proposedWidth, int proposedHeight) {
|
|
||||||
Image image = super.getVolatileOffscreenBuffer(c, proposedWidth, proposedHeight);
|
|
||||||
|
|
||||||
if (!(image instanceof VolatileImage)) {
|
|
||||||
Msg.debug(this,
|
|
||||||
"Cannot install Graphics2D color inverter. Non-volatile image found: " +
|
|
||||||
image.getClass().getName());
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
imageWrapper.setImage((VolatileImage) image);
|
|
||||||
return imageWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class VolatileImageWrapper extends VolatileImage {
|
|
||||||
|
|
||||||
private Graphics2DWrapper wrapper = new Graphics2DWrapper();
|
|
||||||
private VolatileImage image = this;
|
|
||||||
|
|
||||||
void setImage(VolatileImage image) {
|
|
||||||
this.image = image;
|
|
||||||
SurfaceManager manager = SurfaceManager.getManager(image);
|
|
||||||
SurfaceManager.setManager(this, manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Graphics getGraphics() {
|
|
||||||
Graphics g = image.getGraphics();
|
|
||||||
wrapper.setDelegate((Graphics2D) g);
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BufferedImage getSnapshot() {
|
|
||||||
return image.getSnapshot();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWidth() {
|
|
||||||
return image.getWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHeight() {
|
|
||||||
return image.getHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Graphics2D createGraphics() {
|
|
||||||
return image.createGraphics();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int validate(GraphicsConfiguration gc) {
|
|
||||||
return image.validate(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean contentsLost() {
|
|
||||||
return image.contentsLost();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ImageCapabilities getCapabilities() {
|
|
||||||
return image.getCapabilities();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTransparency() {
|
|
||||||
if (image == null) {
|
|
||||||
return super.getTransparency();
|
|
||||||
}
|
|
||||||
return image.getTransparency();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWidth(ImageObserver observer) {
|
|
||||||
return image.getWidth(observer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return image.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHeight(ImageObserver observer) {
|
|
||||||
return image.getHeight(observer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ImageProducer getSource() {
|
|
||||||
return image.getSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
return image.equals(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getProperty(String name, ImageObserver observer) {
|
|
||||||
return image.getProperty(name, observer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Image getScaledInstance(int width, int height, int hints) {
|
|
||||||
return image.getScaledInstance(width, height, hints);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void flush() {
|
|
||||||
image.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return image.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ImageCapabilities getCapabilities(GraphicsConfiguration gc) {
|
|
||||||
return image.getCapabilities(gc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAccelerationPriority(float priority) {
|
|
||||||
image.setAccelerationPriority(priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getAccelerationPriority() {
|
|
||||||
return image.getAccelerationPriority();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,573 +0,0 @@
|
||||||
/* ###
|
|
||||||
* 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 ghidra.docking.util.painting;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.MultipleGradientPaint.CycleMethod;
|
|
||||||
import java.awt.RenderingHints.Key;
|
|
||||||
import java.awt.font.FontRenderContext;
|
|
||||||
import java.awt.font.GlyphVector;
|
|
||||||
import java.awt.geom.AffineTransform;
|
|
||||||
import java.awt.geom.Point2D;
|
|
||||||
import java.awt.image.*;
|
|
||||||
import java.awt.image.renderable.RenderableImage;
|
|
||||||
import java.text.AttributedCharacterIterator;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple wrapper object that changes colors passed to {@link Graphics2D}.
|
|
||||||
*/
|
|
||||||
public class Graphics2DWrapper extends Graphics2D {
|
|
||||||
|
|
||||||
private Graphics2D delegate;
|
|
||||||
|
|
||||||
public Graphics2DWrapper() {
|
|
||||||
// delegate set later
|
|
||||||
}
|
|
||||||
|
|
||||||
private Graphics2DWrapper(Graphics2D delegate) {
|
|
||||||
setDelegate(delegate);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDelegate(Graphics2D delegate) {
|
|
||||||
this.delegate = delegate;
|
|
||||||
|
|
||||||
setColor(delegate.getColor());
|
|
||||||
setBackground(delegate.getBackground());
|
|
||||||
setPaint(delegate.getPaint());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return delegate.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
return delegate.equals(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Graphics create() {
|
|
||||||
return new Graphics2DWrapper((Graphics2D) delegate.create());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Graphics create(int x, int y, int width, int height) {
|
|
||||||
return new Graphics2DWrapper((Graphics2D) delegate.create(x, y, width, height));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getColor() {
|
|
||||||
//
|
|
||||||
// Clients will call this method to later restore this Graphic's color. So, we must
|
|
||||||
// revert the color or it will get restored incorrectly.
|
|
||||||
//
|
|
||||||
Color alt = delegate.getColor();
|
|
||||||
Color orig = getComplementaryColor(alt);
|
|
||||||
return orig;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Color getComplementaryColor(Color c) {
|
|
||||||
|
|
||||||
if (c == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Color alt = new Color(255 - c.getRed(), 255 - c.getGreen(), 255 - c.getBlue());
|
|
||||||
return alt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBackground(Color c) {
|
|
||||||
Color alt = getComplementaryColor(c);
|
|
||||||
delegate.setBackground(alt);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Color getBackground() {
|
|
||||||
//
|
|
||||||
// Clients will call this method to later restore this Graphic's color. So, we must
|
|
||||||
// revert the color or it will get restored incorrectly.
|
|
||||||
//
|
|
||||||
Color alt = delegate.getBackground();
|
|
||||||
Color orig = getComplementaryColor(alt);
|
|
||||||
return orig;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setColor(Color c) {
|
|
||||||
Color alt = getComplementaryColor(c);
|
|
||||||
delegate.setColor(alt);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Paint getPaint() {
|
|
||||||
Paint alt = delegate.getPaint();
|
|
||||||
|
|
||||||
if (alt instanceof Color) {
|
|
||||||
Color c = (Color) alt;
|
|
||||||
Color orig = getComplementaryColor(c);
|
|
||||||
return orig;
|
|
||||||
}
|
|
||||||
else if (alt instanceof GradientPaint) {
|
|
||||||
GradientPaint gp = (GradientPaint) alt;
|
|
||||||
Color alt1 = getComplementaryColor(gp.getColor1());
|
|
||||||
Color alt2 = getComplementaryColor(gp.getColor2());
|
|
||||||
GradientPaint orig =
|
|
||||||
new GradientPaint(gp.getPoint1(), alt1, gp.getPoint2(), alt2, gp.isCyclic());
|
|
||||||
return orig;
|
|
||||||
}
|
|
||||||
else if (alt instanceof LinearGradientPaint) {
|
|
||||||
|
|
||||||
LinearGradientPaint gp = (LinearGradientPaint) alt;
|
|
||||||
Color[] colors = gp.getColors();
|
|
||||||
float[] fractions = gp.getFractions();
|
|
||||||
Point2D start = gp.getStartPoint();
|
|
||||||
Point2D end = gp.getEndPoint();
|
|
||||||
CycleMethod cycleMethod = gp.getCycleMethod();
|
|
||||||
LinearGradientPaint orig =
|
|
||||||
new LinearGradientPaint(start, end, fractions, colors, cycleMethod);
|
|
||||||
return orig;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Else case from setPaint()
|
|
||||||
}
|
|
||||||
|
|
||||||
return alt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPaint(Paint paint) {
|
|
||||||
|
|
||||||
if (paint instanceof Color) {
|
|
||||||
Color c = (Color) paint;
|
|
||||||
Color alt = getComplementaryColor(c);
|
|
||||||
delegate.setPaint(alt);
|
|
||||||
}
|
|
||||||
else if (paint instanceof GradientPaint) {
|
|
||||||
GradientPaint gp = (GradientPaint) paint;
|
|
||||||
Color alt1 = getComplementaryColor(gp.getColor1());
|
|
||||||
Color alt2 = getComplementaryColor(gp.getColor2());
|
|
||||||
GradientPaint alt =
|
|
||||||
new GradientPaint(gp.getPoint1(), alt1, gp.getPoint2(), alt2, gp.isCyclic());
|
|
||||||
delegate.setPaint(alt);
|
|
||||||
}
|
|
||||||
else if (paint instanceof LinearGradientPaint) {
|
|
||||||
|
|
||||||
LinearGradientPaint gp = (LinearGradientPaint) paint;
|
|
||||||
Color[] colors = gp.getColors();
|
|
||||||
float[] fractions = gp.getFractions();
|
|
||||||
Point2D start = gp.getStartPoint();
|
|
||||||
Point2D end = gp.getEndPoint();
|
|
||||||
CycleMethod cycleMethod = gp.getCycleMethod();
|
|
||||||
LinearGradientPaint alt =
|
|
||||||
new LinearGradientPaint(start, end, fractions, colors, cycleMethod);
|
|
||||||
delegate.setPaint(alt);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
System.err.println("G2DWrapper - non-Color Paint: " + paint.getClass().getSimpleName());
|
|
||||||
delegate.setPaint(paint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPaintMode() {
|
|
||||||
delegate.setPaintMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setXORMode(Color c1) {
|
|
||||||
delegate.setXORMode(c1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Font getFont() {
|
|
||||||
return delegate.getFont();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFont(Font font) {
|
|
||||||
delegate.setFont(font);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FontMetrics getFontMetrics() {
|
|
||||||
return delegate.getFontMetrics();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FontMetrics getFontMetrics(Font f) {
|
|
||||||
return delegate.getFontMetrics(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Rectangle getClipBounds() {
|
|
||||||
return delegate.getClipBounds();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clipRect(int x, int y, int width, int height) {
|
|
||||||
delegate.clipRect(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setClip(int x, int y, int width, int height) {
|
|
||||||
delegate.setClip(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Shape getClip() {
|
|
||||||
return delegate.getClip();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setClip(Shape clip) {
|
|
||||||
delegate.setClip(clip);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void copyArea(int x, int y, int width, int height, int dx, int dy) {
|
|
||||||
delegate.copyArea(x, y, width, height, dx, dy);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawLine(int x1, int y1, int x2, int y2) {
|
|
||||||
delegate.drawLine(x1, y1, x2, y2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fillRect(int x, int y, int width, int height) {
|
|
||||||
delegate.fillRect(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawRect(int x, int y, int width, int height) {
|
|
||||||
delegate.drawRect(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void draw3DRect(int x, int y, int width, int height, boolean raised) {
|
|
||||||
delegate.draw3DRect(x, y, width, height, raised);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clearRect(int x, int y, int width, int height) {
|
|
||||||
delegate.clearRect(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
|
|
||||||
delegate.drawRoundRect(x, y, width, height, arcWidth, arcHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fill3DRect(int x, int y, int width, int height, boolean raised) {
|
|
||||||
delegate.fill3DRect(x, y, width, height, raised);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
|
|
||||||
delegate.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void draw(Shape s) {
|
|
||||||
delegate.draw(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
|
|
||||||
return delegate.drawImage(img, xform, obs);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
|
|
||||||
delegate.drawImage(img, op, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawOval(int x, int y, int width, int height) {
|
|
||||||
delegate.drawOval(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
|
|
||||||
delegate.drawRenderedImage(img, xform);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fillOval(int x, int y, int width, int height) {
|
|
||||||
delegate.fillOval(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
|
|
||||||
delegate.drawArc(x, y, width, height, startAngle, arcAngle);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
|
|
||||||
delegate.drawRenderableImage(img, xform);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawString(String str, int x, int y) {
|
|
||||||
delegate.drawString(str, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
|
|
||||||
delegate.fillArc(x, y, width, height, startAngle, arcAngle);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawString(String str, float x, float y) {
|
|
||||||
delegate.drawString(str, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {
|
|
||||||
delegate.drawPolyline(xPoints, yPoints, nPoints);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawString(AttributedCharacterIterator iterator, int x, int y) {
|
|
||||||
delegate.drawString(iterator, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) {
|
|
||||||
delegate.drawPolygon(xPoints, yPoints, nPoints);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawString(AttributedCharacterIterator iterator, float x, float y) {
|
|
||||||
delegate.drawString(iterator, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawPolygon(Polygon p) {
|
|
||||||
delegate.drawPolygon(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) {
|
|
||||||
delegate.fillPolygon(xPoints, yPoints, nPoints);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawGlyphVector(GlyphVector g, float x, float y) {
|
|
||||||
delegate.drawGlyphVector(g, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fillPolygon(Polygon p) {
|
|
||||||
delegate.fillPolygon(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fill(Shape s) {
|
|
||||||
delegate.fill(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
|
|
||||||
return delegate.hit(rect, s, onStroke);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawChars(char[] data, int offset, int length, int x, int y) {
|
|
||||||
delegate.drawChars(data, offset, length, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GraphicsConfiguration getDeviceConfiguration() {
|
|
||||||
return delegate.getDeviceConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setComposite(Composite comp) {
|
|
||||||
delegate.setComposite(comp);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawBytes(byte[] data, int offset, int length, int x, int y) {
|
|
||||||
delegate.drawBytes(data, offset, length, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean drawImage(Image img, int x, int y, ImageObserver observer) {
|
|
||||||
|
|
||||||
return delegate.drawImage(img, x, y, observer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setStroke(Stroke s) {
|
|
||||||
delegate.setStroke(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRenderingHint(Key hintKey, Object hintValue) {
|
|
||||||
delegate.setRenderingHint(hintKey, hintValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getRenderingHint(Key hintKey) {
|
|
||||||
return delegate.getRenderingHint(hintKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean drawImage(Image img, int x, int y, int width, int height,
|
|
||||||
ImageObserver observer) {
|
|
||||||
return delegate.drawImage(img, x, y, width, height, observer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRenderingHints(Map<?, ?> hints) {
|
|
||||||
delegate.setRenderingHints(hints);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addRenderingHints(Map<?, ?> hints) {
|
|
||||||
delegate.addRenderingHints(hints);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RenderingHints getRenderingHints() {
|
|
||||||
return delegate.getRenderingHints();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) {
|
|
||||||
return delegate.drawImage(img, x, y, bgcolor, observer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void translate(int x, int y) {
|
|
||||||
delegate.translate(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void translate(double tx, double ty) {
|
|
||||||
delegate.translate(tx, ty);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void rotate(double theta) {
|
|
||||||
delegate.rotate(theta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor,
|
|
||||||
ImageObserver observer) {
|
|
||||||
return delegate.drawImage(img, x, y, width, height, bgcolor, observer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void rotate(double theta, double x, double y) {
|
|
||||||
delegate.rotate(theta, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void scale(double sx, double sy) {
|
|
||||||
delegate.scale(sx, sy);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void shear(double shx, double shy) {
|
|
||||||
delegate.shear(shx, shy);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
|
|
||||||
int sx2, int sy2, ImageObserver observer) {
|
|
||||||
return delegate.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void transform(AffineTransform Tx) {
|
|
||||||
delegate.transform(Tx);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setTransform(AffineTransform Tx) {
|
|
||||||
delegate.setTransform(Tx);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AffineTransform getTransform() {
|
|
||||||
return delegate.getTransform();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
|
|
||||||
int sx2, int sy2, Color bgcolor, ImageObserver observer) {
|
|
||||||
return delegate.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Composite getComposite() {
|
|
||||||
return delegate.getComposite();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Stroke getStroke() {
|
|
||||||
return delegate.getStroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clip(Shape s) {
|
|
||||||
delegate.clip(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FontRenderContext getFontRenderContext() {
|
|
||||||
return delegate.getFontRenderContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispose() {
|
|
||||||
delegate.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void finalize() {
|
|
||||||
delegate.finalize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return delegate.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Rectangle getClipRect() {
|
|
||||||
return delegate.getClipBounds();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hitClip(int x, int y, int width, int height) {
|
|
||||||
return delegate.hitClip(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Rectangle getClipBounds(Rectangle r) {
|
|
||||||
return delegate.getClipBounds(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -15,7 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package resources;
|
package resources;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Component;
|
||||||
|
import java.awt.Graphics;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ import javax.swing.Icon;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
|
import generic.theme.GThemeDefaults.Colors;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
import resources.icons.RotateIcon;
|
import resources.icons.RotateIcon;
|
||||||
import resources.icons.TranslateIcon;
|
import resources.icons.TranslateIcon;
|
||||||
|
@ -202,7 +204,7 @@ public class Icons {
|
||||||
@Override
|
@Override
|
||||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||||
base.paintIcon(c, g, x, y);
|
base.paintIcon(c, g, x, y);
|
||||||
g.setColor(new Color(50, 50, 50));
|
g.setColor(Colors.BACKGROUND);
|
||||||
g.fillRect(x + 6, y + 14, 2, 2);
|
g.fillRect(x + 6, y + 14, 2, 2);
|
||||||
g.fillRect(x + 9, y + 14, 2, 2);
|
g.fillRect(x + 9, y + 14, 2, 2);
|
||||||
g.fillRect(x + 12, y + 14, 2, 2);
|
g.fillRect(x + 12, y + 14, 2, 2);
|
||||||
|
|
|
@ -37,6 +37,8 @@ import generic.theme.builtin.NimbusTheme;
|
||||||
|
|
||||||
public class ThemeUtilsTest extends AbstractDockingTest {
|
public class ThemeUtilsTest extends AbstractDockingTest {
|
||||||
|
|
||||||
|
private Color testColor = Color.RED;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
GTheme nimbusTheme = new NimbusTheme();
|
GTheme nimbusTheme = new NimbusTheme();
|
||||||
|
@ -74,7 +76,7 @@ public class ThemeUtilsTest extends AbstractDockingTest {
|
||||||
@Test
|
@Test
|
||||||
public void testImportThemeWithCurrentChangesCancelled() throws IOException {
|
public void testImportThemeWithCurrentChangesCancelled() throws IOException {
|
||||||
assertEquals("Nimbus Theme", Gui.getActiveTheme().getName());
|
assertEquals("Nimbus Theme", Gui.getActiveTheme().getName());
|
||||||
Gui.setColor("Panel.background", Color.RED);
|
Gui.setColor("Panel.background", testColor);
|
||||||
assertTrue(Gui.hasThemeChanges());
|
assertTrue(Gui.hasThemeChanges());
|
||||||
|
|
||||||
File themeFile = createThemeFile("Bob");
|
File themeFile = createThemeFile("Bob");
|
||||||
|
@ -92,7 +94,7 @@ public class ThemeUtilsTest extends AbstractDockingTest {
|
||||||
assertEquals("Nimbus Theme", Gui.getActiveTheme().getName());
|
assertEquals("Nimbus Theme", Gui.getActiveTheme().getName());
|
||||||
|
|
||||||
// make a change in the current theme, so you get asked to save
|
// make a change in the current theme, so you get asked to save
|
||||||
Gui.setColor("Panel.background", Color.RED);
|
Gui.setColor("Panel.background", testColor);
|
||||||
assertTrue(Gui.hasThemeChanges());
|
assertTrue(Gui.hasThemeChanges());
|
||||||
|
|
||||||
File themeFile = createThemeFile("Bob");
|
File themeFile = createThemeFile("Bob");
|
||||||
|
@ -115,7 +117,7 @@ public class ThemeUtilsTest extends AbstractDockingTest {
|
||||||
assertEquals("Nimbus Theme", Gui.getActiveTheme().getName());
|
assertEquals("Nimbus Theme", Gui.getActiveTheme().getName());
|
||||||
|
|
||||||
// make a change in the current theme, so you get asked to save
|
// make a change in the current theme, so you get asked to save
|
||||||
Gui.setColor("Panel.background", Color.RED);
|
Gui.setColor("Panel.background", testColor);
|
||||||
assertTrue(Gui.hasThemeChanges());
|
assertTrue(Gui.hasThemeChanges());
|
||||||
|
|
||||||
File bobThemeFile = createThemeFile("Bob");
|
File bobThemeFile = createThemeFile("Bob");
|
||||||
|
@ -191,7 +193,7 @@ public class ThemeUtilsTest extends AbstractDockingTest {
|
||||||
private File createZipThemeFile(String themeName) throws IOException {
|
private File createZipThemeFile(String themeName) throws IOException {
|
||||||
File file = createTempFile("Test_Theme", ".theme.zip");
|
File file = createTempFile("Test_Theme", ".theme.zip");
|
||||||
GTheme outputTheme = new GTheme(file, themeName, LafType.METAL, false);
|
GTheme outputTheme = new GTheme(file, themeName, LafType.METAL, false);
|
||||||
outputTheme.addColor(new ColorValue("Panel.Background", Color.RED));
|
outputTheme.addColor(new ColorValue("Panel.Background", testColor));
|
||||||
outputTheme.saveToZip(file, false);
|
outputTheme.saveToZip(file, false);
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.fieldpanel;
|
package docking.widgets.fieldpanel;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import generic.test.AbstractGenericTest;
|
import generic.test.AbstractGenericTest;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
public class AttributedStringTest extends AbstractGenericTest {
|
public class AttributedStringTest extends AbstractGenericTest {
|
||||||
FontMetrics fm;
|
FontMetrics fm;
|
||||||
|
@ -45,14 +46,16 @@ public class AttributedStringTest extends AbstractGenericTest {
|
||||||
public void testSubstring() {
|
public void testSubstring() {
|
||||||
FieldElement[] strings =
|
FieldElement[] strings =
|
||||||
new FieldElement[] {
|
new FieldElement[] {
|
||||||
new TextFieldElement(new AttributedString("This is string", Color.BLACK, fm), 0, 0), // 14 chars
|
new TextFieldElement(new AttributedString("This is string", Palette.BLACK, fm), 0,
|
||||||
new TextFieldElement(new AttributedString("to test", Color.RED, fm), 0, 0), // 7 chars
|
0), // 14 chars
|
||||||
new TextFieldElement(new AttributedString("the substring of ", Color.BLACK, fm), 0,
|
new TextFieldElement(new AttributedString("to test", Palette.RED, fm), 0, 0), // 7 chars
|
||||||
|
new TextFieldElement(new AttributedString("the substring of ", Palette.BLACK, fm),
|
||||||
|
0,
|
||||||
0), // 17 chars
|
0), // 17 chars
|
||||||
new TextFieldElement(new AttributedString(" .... ", Color.BLACK, fm), 0, 0), // 8 chars
|
new TextFieldElement(new AttributedString(" .... ", Palette.BLACK, fm), 0, 0), // 8 chars
|
||||||
new TextFieldElement(
|
new TextFieldElement(
|
||||||
new AttributedString("the CompositeAttributedString", Color.BLUE, fm), 0, 0), // 29 chars
|
new AttributedString("the CompositeAttributedString", Palette.BLUE, fm), 0, 0), // 29 chars
|
||||||
new TextFieldElement(new AttributedString("class.", Color.BLACK, fm), 0, 0) };
|
new TextFieldElement(new AttributedString("class.", Palette.BLACK, fm), 0, 0) };
|
||||||
FieldElement compositeString = new CompositeFieldElement(strings);
|
FieldElement compositeString = new CompositeFieldElement(strings);
|
||||||
|
|
||||||
FieldElement substring = compositeString.substring(0);
|
FieldElement substring = compositeString.substring(0);
|
||||||
|
@ -83,18 +86,21 @@ public class AttributedStringTest extends AbstractGenericTest {
|
||||||
// runtime ArrayIndexOutOfBoundsException 7/11/06
|
// runtime ArrayIndexOutOfBoundsException 7/11/06
|
||||||
strings = new FieldElement[] {
|
strings = new FieldElement[] {
|
||||||
new TextFieldElement(
|
new TextFieldElement(
|
||||||
new AttributedString("This is an annotated comment: ", Color.BLUE, fm), 0, 0),
|
new AttributedString("This is an annotated comment: ", Palette.BLUE, fm), 0, 0),
|
||||||
new TextFieldElement(new AttributedString("RegSetValueExW", Color.BLUE, fm), 0, 0),
|
new TextFieldElement(new AttributedString("RegSetValueExW", Palette.BLUE, fm), 0, 0),
|
||||||
new TextFieldElement(new AttributedString(
|
new TextFieldElement(new AttributedString(
|
||||||
" This is an annotated comment with symbol name: ", Color.RED, fm), 0, 0),
|
" This is an annotated comment with symbol name: ", Palette.RED, fm), 0, 0),
|
||||||
new TextFieldElement(new AttributedString("No symbol: RegSetValueExW", Color.RED, fm),
|
new TextFieldElement(new AttributedString("No symbol: RegSetValueExW", Palette.RED, fm),
|
||||||
0, 0),
|
0, 0),
|
||||||
new TextFieldElement(new AttributedString(" Bad annotation: ", Color.BLUE, fm), 0, 0),
|
new TextFieldElement(new AttributedString(" Bad annotation: ", Palette.BLUE, fm), 0,
|
||||||
|
0),
|
||||||
new TextFieldElement(
|
new TextFieldElement(
|
||||||
new AttributedString("Invalid Annotation: {@cowhide smile}:", Color.RED, fm), 0, 0),
|
new AttributedString("Invalid Annotation: {@cowhide smile}:", Palette.RED, fm), 0,
|
||||||
new TextFieldElement(new AttributedString(" ", Color.BLUE, fm), 0, 0),
|
0),
|
||||||
new TextFieldElement(new AttributedString("{@cowhide smile}", Color.BLUE, fm), 0, 0),
|
new TextFieldElement(new AttributedString(" ", Palette.BLUE, fm), 0, 0),
|
||||||
new TextFieldElement(new AttributedString("Invalid Annotation: {@sym}", Color.BLUE, fm),
|
new TextFieldElement(new AttributedString("{@cowhide smile}", Palette.BLUE, fm), 0, 0),
|
||||||
|
new TextFieldElement(
|
||||||
|
new AttributedString("Invalid Annotation: {@sym}", Palette.BLUE, fm),
|
||||||
0, 0) };
|
0, 0) };
|
||||||
FieldElement compositeString2 = new CompositeFieldElement(strings);
|
FieldElement compositeString2 = new CompositeFieldElement(strings);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package docking.widgets.fieldpanel;
|
package docking.widgets.fieldpanel;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.internal.ColorRangeMap;
|
import docking.widgets.fieldpanel.internal.ColorRangeMap;
|
||||||
import generic.test.AbstractGenericTest;
|
import generic.test.AbstractGenericTest;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
public class ColorRangeMapTest extends AbstractGenericTest {
|
public class ColorRangeMapTest extends AbstractGenericTest {
|
||||||
public ColorRangeMapTest() {
|
public ColorRangeMapTest() {
|
||||||
|
@ -32,31 +33,35 @@ public class ColorRangeMapTest extends AbstractGenericTest {
|
||||||
@Test
|
@Test
|
||||||
public void testPaint1() {
|
public void testPaint1() {
|
||||||
ColorRangeMap map = new ColorRangeMap();
|
ColorRangeMap map = new ColorRangeMap();
|
||||||
map.color(10, 10, Color.BLUE);
|
map.color(10, 10, Palette.BLUE);
|
||||||
assertEquals(Color.WHITE, map.getColor(0, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(0, Palette.WHITE));
|
||||||
assertEquals(Color.WHITE, map.getColor(9, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(9, Palette.WHITE));
|
||||||
assertEquals(Color.BLUE, map.getColor(10, Color.WHITE));
|
assertColorsEqual(Palette.BLUE, map.getColor(10, Palette.WHITE));
|
||||||
assertEquals(Color.WHITE, map.getColor(11, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(11, Palette.WHITE));
|
||||||
assertEquals(Color.WHITE, map.getColor(100, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(100, Palette.WHITE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCopy() {
|
public void testCopy() {
|
||||||
ColorRangeMap map = new ColorRangeMap();
|
ColorRangeMap map = new ColorRangeMap();
|
||||||
map.color(10, 10, Color.BLUE);
|
map.color(10, 10, Palette.BLUE);
|
||||||
assertEquals(Color.WHITE, map.getColor(0, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(0, Palette.WHITE));
|
||||||
assertEquals(Color.WHITE, map.getColor(9, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(9, Palette.WHITE));
|
||||||
assertEquals(Color.BLUE, map.getColor(10, Color.WHITE));
|
assertColorsEqual(Palette.BLUE, map.getColor(10, Palette.WHITE));
|
||||||
assertEquals(Color.WHITE, map.getColor(11, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(11, Palette.WHITE));
|
||||||
assertEquals(Color.WHITE, map.getColor(100, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(100, Palette.WHITE));
|
||||||
|
|
||||||
map = map.copy();
|
map = map.copy();
|
||||||
|
|
||||||
assertEquals(Color.WHITE, map.getColor(0, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(0, Palette.WHITE));
|
||||||
assertEquals(Color.WHITE, map.getColor(9, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(9, Palette.WHITE));
|
||||||
assertEquals(Color.BLUE, map.getColor(10, Color.WHITE));
|
assertColorsEqual(Palette.BLUE, map.getColor(10, Palette.WHITE));
|
||||||
assertEquals(Color.WHITE, map.getColor(11, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(11, Palette.WHITE));
|
||||||
assertEquals(Color.WHITE, map.getColor(100, Color.WHITE));
|
assertColorsEqual(Palette.WHITE, map.getColor(100, Palette.WHITE));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertColorsEqual(Color c1, Color c2) {
|
||||||
|
assertEquals(c1.getRGB(), c2.getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.junit.Test;
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.*;
|
import docking.widgets.fieldpanel.support.*;
|
||||||
import generic.test.AbstractGenericTest;
|
import generic.test.AbstractGenericTest;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
public class FlowLayoutTextFieldTest extends AbstractGenericTest {
|
public class FlowLayoutTextFieldTest extends AbstractGenericTest {
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ public class FlowLayoutTextFieldTest extends AbstractGenericTest {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
||||||
HighlightFactory factory = (field, text, cursorTextOffset) -> {
|
HighlightFactory factory = (field, text, cursorTextOffset) -> {
|
||||||
return new Highlight[] { new Highlight(4, 4, Color.YELLOW) };
|
return new Highlight[] { new Highlight(4, 4, Palette.YELLOW) };
|
||||||
};
|
};
|
||||||
|
|
||||||
Font font = new Font("Times New Roman", 0, 14);
|
Font font = new Font("Times New Roman", 0, 14);
|
||||||
|
@ -63,12 +64,12 @@ public class FlowLayoutTextFieldTest extends AbstractGenericTest {
|
||||||
Wow
|
Wow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
elements.add(new TextFieldElement(new AttributedString("Hello ", Color.BLUE, fm), 0, 0));
|
elements.add(new TextFieldElement(new AttributedString("Hello ", Palette.BLUE, fm), 0, 0));
|
||||||
elements.add(new TextFieldElement(
|
elements.add(new TextFieldElement(
|
||||||
new AttributedString("World ", Color.RED, fm, true, Color.BLUE), 1, 0));
|
new AttributedString("World ", Palette.RED, fm, true, Palette.BLUE), 1, 0));
|
||||||
elements.add(
|
elements.add(
|
||||||
new TextFieldElement(new AttributedString(CLIPPED_STRING, Color.GREEN, fm), 2, 0));
|
new TextFieldElement(new AttributedString(CLIPPED_STRING, Palette.GREEN, fm), 2, 0));
|
||||||
elements.add(new TextFieldElement(new AttributedString("Wow! ", Color.GRAY, fm), 3, 0));
|
elements.add(new TextFieldElement(new AttributedString("Wow! ", Palette.GRAY, fm), 3, 0));
|
||||||
|
|
||||||
textField = new FlowLayoutTextField(elements, 100, 100, 3, factory);
|
textField = new FlowLayoutTextField(elements, 100, 100, 3, factory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.junit.Test;
|
||||||
import docking.widgets.fieldpanel.field.*;
|
import docking.widgets.fieldpanel.field.*;
|
||||||
import docking.widgets.fieldpanel.support.*;
|
import docking.widgets.fieldpanel.support.*;
|
||||||
import generic.test.AbstractGenericTest;
|
import generic.test.AbstractGenericTest;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
public class VerticalLayoutTextFieldTest extends AbstractGenericTest {
|
public class VerticalLayoutTextFieldTest extends AbstractGenericTest {
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ public class VerticalLayoutTextFieldTest extends AbstractGenericTest {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
||||||
HighlightFactory factory = (f, text, cursorTextOffset) -> {
|
HighlightFactory factory = (f, text, cursorTextOffset) -> {
|
||||||
return new Highlight[] { new Highlight(4, 4, Color.YELLOW) };
|
return new Highlight[] { new Highlight(4, 4, Palette.YELLOW) };
|
||||||
};
|
};
|
||||||
|
|
||||||
Font font = new Font("Times New Roman", 0, 14);
|
Font font = new Font("Times New Roman", 0, 14);
|
||||||
|
@ -48,12 +49,12 @@ public class VerticalLayoutTextFieldTest extends AbstractGenericTest {
|
||||||
|
|
||||||
List<FieldElement> elements = new ArrayList<>();
|
List<FieldElement> elements = new ArrayList<>();
|
||||||
|
|
||||||
elements.add(new TextFieldElement(new AttributedString("Hello", Color.BLUE, fm), 0, 0));
|
elements.add(new TextFieldElement(new AttributedString("Hello", Palette.BLUE, fm), 0, 0));
|
||||||
elements.add(new TextFieldElement(
|
elements.add(new TextFieldElement(
|
||||||
new AttributedString("World", Color.RED, fm, true, Color.BLUE), 1, 0));
|
new AttributedString("World", Palette.RED, fm, true, Palette.BLUE), 1, 0));
|
||||||
elements.add(
|
elements.add(
|
||||||
new TextFieldElement(new AttributedString(CLIPPED_STRING, Color.GREEN, fm), 2, 0));
|
new TextFieldElement(new AttributedString(CLIPPED_STRING, Palette.GREEN, fm), 2, 0));
|
||||||
elements.add(new TextFieldElement(new AttributedString("Wow!", Color.GRAY, fm), 3, 0));
|
elements.add(new TextFieldElement(new AttributedString("Wow!", Palette.GRAY, fm), 3, 0));
|
||||||
|
|
||||||
field = new VerticalLayoutTextField(elements, 100, 100, 5, factory);
|
field = new VerticalLayoutTextField(elements, 100, 100, 5, factory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
import docking.widgets.fieldpanel.support.*;
|
import docking.widgets.fieldpanel.support.*;
|
||||||
import generic.test.AbstractGenericTest;
|
import generic.test.AbstractGenericTest;
|
||||||
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
|
|
||||||
public class CompositeVerticalLayoutTextFieldTest extends AbstractGenericTest {
|
public class CompositeVerticalLayoutTextFieldTest extends AbstractGenericTest {
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ public class CompositeVerticalLayoutTextFieldTest extends AbstractGenericTest {
|
||||||
List<FieldElement> elements = new ArrayList<>();
|
List<FieldElement> elements = new ArrayList<>();
|
||||||
int row = 0;
|
int row = 0;
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
elements.add(createRow(row++, line, Color.BLUE));
|
elements.add(createRow(row++, line, Palette.BLUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TextField> fields = new ArrayList<>();
|
List<TextField> fields = new ArrayList<>();
|
||||||
|
@ -83,7 +84,7 @@ public class CompositeVerticalLayoutTextFieldTest extends AbstractGenericTest {
|
||||||
List<FieldElement> elements = new ArrayList<>();
|
List<FieldElement> elements = new ArrayList<>();
|
||||||
int row = 0;
|
int row = 0;
|
||||||
for (String line : lines) {
|
for (String line : lines) {
|
||||||
elements.add(createRow(row++, line, Color.BLUE));
|
elements.add(createRow(row++, line, Palette.BLUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TextField> fields = new ArrayList<>();
|
List<TextField> fields = new ArrayList<>();
|
||||||
|
@ -114,12 +115,12 @@ public class CompositeVerticalLayoutTextFieldTest extends AbstractGenericTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextField wrappedField(int row, String text) {
|
private TextField wrappedField(int row, String text) {
|
||||||
FieldElement element = createRow(row, text, Color.BLUE);
|
FieldElement element = createRow(row, text, Palette.BLUE);
|
||||||
return new WrappingVerticalLayoutTextField(element, startX, width, maxLines, hlFactory);
|
return new WrappingVerticalLayoutTextField(element, startX, width, maxLines, hlFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextField clippedField(int row, String text) {
|
private TextField clippedField(int row, String text) {
|
||||||
FieldElement element = createRow(row, text, Color.BLUE);
|
FieldElement element = createRow(row, text, Palette.BLUE);
|
||||||
return new ClippingTextField(startX, width, element, hlFactory);
|
return new ClippingTextField(startX, width, element, hlFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,12 @@ public class GThemeDefaults {
|
||||||
// generic color concepts
|
// generic color concepts
|
||||||
//@formatter:off
|
//@formatter:off
|
||||||
public static final GColor BACKGROUND = new GColor("color.bg");
|
public static final GColor BACKGROUND = new GColor("color.bg");
|
||||||
|
public static final GColor BACKGROUND_TOOLTIP = new GColor("color.bg.tooltip");
|
||||||
public static final GColor CURSOR = new GColor("color.cursor.focused");
|
public static final GColor CURSOR = new GColor("color.cursor.focused");
|
||||||
public static final GColor DISABLED = new GColor("color.palette.disabled");
|
public static final GColor DISABLED = new GColor("color.palette.disabled");
|
||||||
public static final GColor ERROR = new GColor("color.fg.error"); // TODO replace most uses of this with Messages.ERROR
|
public static final GColor ERROR = new GColor("color.fg.error"); // TODO replace most uses of this with Messages.ERROR
|
||||||
public static final GColor FOREGROUND = new GColor("color.fg");
|
public static final GColor FOREGROUND = new GColor("color.fg");
|
||||||
public static final GColor FOREGROUND_DISABLED = new GColor("color.fg.disabled");
|
public static final GColor FOREGROUND_DISABLED = new GColor("color.fg.disabled");
|
||||||
public static final GColor TOOLTIP_BACKGROUND = new GColor("color.bg.tooltip");
|
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
public static class Java {
|
public static class Java {
|
||||||
|
@ -94,7 +94,7 @@ public class GThemeDefaults {
|
||||||
public static final GColor GOLD = getColor("gold");
|
public static final GColor GOLD = getColor("gold");
|
||||||
public static final GColor GRAY = getColor("gray");
|
public static final GColor GRAY = getColor("gray");
|
||||||
public static final GColor GREEN = getColor("green");
|
public static final GColor GREEN = getColor("green");
|
||||||
public static final GColor LAVENDER = getColor("lavander");
|
public static final GColor LAVENDER = getColor("lavender");
|
||||||
public static final GColor LIGHT_GRAY = getColor("lightgray");
|
public static final GColor LIGHT_GRAY = getColor("lightgray");
|
||||||
public static final GColor LIME = getColor("lime");
|
public static final GColor LIME = getColor("lime");
|
||||||
public static final GColor MAGENTA = getColor("magenta");
|
public static final GColor MAGENTA = getColor("magenta");
|
||||||
|
|
|
@ -17,6 +17,8 @@ package generic.theme;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
|
import ghidra.util.WebColors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class to serve as a placeholder for migrating code. After the migration is complete, uses
|
* A class to serve as a placeholder for migrating code. After the migration is complete, uses
|
||||||
* of this class can be removed, with the original code being restored in the process.
|
* of this class can be removed, with the original code being restored in the process.
|
||||||
|
@ -47,10 +49,10 @@ public class TempColorUtils {
|
||||||
return new Color(c.getRed(), c.getGreen(), c.getBlue(), a);
|
return new Color(c.getRed(), c.getGreen(), c.getBlue(), a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Color blend1(Color primary, Color secondary) {
|
public static Color blend1(Color c1, Color c2) {
|
||||||
int red = (primary.getRed() * 2 + secondary.getRed()) / 3;
|
int red = (c1.getRed() * 2 + c2.getRed()) / 3;
|
||||||
int green = (primary.getGreen() * 2 + secondary.getGreen()) / 3;
|
int green = (c1.getGreen() * 2 + c2.getGreen()) / 3;
|
||||||
int blue = (primary.getBlue() * 2 + secondary.getBlue()) / 3;
|
int blue = (c1.getBlue() * 2 + c2.getBlue()) / 3;
|
||||||
return new Color(red, green, blue);
|
return new Color(red, green, blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,4 +62,22 @@ public class TempColorUtils {
|
||||||
int blue = (c.getBlue() + 3 * value) / 4;
|
int blue = (c.getBlue() + 3 * value) / 4;
|
||||||
return new Color(red, green, blue);
|
return new Color(red, green, blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Color blend3(Color c1, Color c2) {
|
||||||
|
int red = (c1.getRed() + c2.getRed()) / 2;
|
||||||
|
int green = (c1.getGreen() + c2.getGreen()) / 2;
|
||||||
|
int blue = (c1.getBlue() + c2.getBlue()) / 2;
|
||||||
|
return new Color(red, green, blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color blend4(Color c1, Color c2) {
|
||||||
|
int red = (c1.getRed() * 3 + c2.getRed()) / 4;
|
||||||
|
int green = (c1.getGreen() * 3 + c2.getGreen()) / 4;
|
||||||
|
int blue = (c1.getBlue() * 3 + c2.getBlue()) / 4;
|
||||||
|
return new Color(red, green, blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toString(Color c) {
|
||||||
|
return WebColors.toString(c, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue