mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-20 10:37:27 +08:00
GP-1981 - Theming - Docking Module
This commit is contained in:
+2
-2
@@ -46,8 +46,8 @@ import ghidra.util.bean.opteditor.OptionsVetoException;
|
||||
public abstract class AbstractReferenceHover extends AbstractConfigurableHover {
|
||||
|
||||
private static final int WINDOW_OFFSET = 50;
|
||||
private static final Color BACKGROUND_COLOR = Colors.TOOLTIP_BACKGROUND;
|
||||
private static final Color FG_COLOR_NOT_IN_MEMORY = new GColor("color.fg.disabled");
|
||||
private static final Color BACKGROUND_COLOR = Colors.BACKGROUND_TOOLTIP;
|
||||
private static final Color FG_COLOR_NOT_IN_MEMORY = new GColor("color.fg.hint");
|
||||
|
||||
private CodeFormatService codeFormatService;
|
||||
private ListingPanel panel;
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import ghidra.app.plugin.core.console.CodeCompletion;
|
||||
public class CodeCompletionWindow extends JDialog {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/* 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 JTextPane outputTextField;
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ import ghidra.program.util.ProgramSelection;
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ color.palette.blue = blue
|
||||
color.palette.crimson = crimson
|
||||
color.palette.cyan = cyan
|
||||
color.palette.darkblue = DarkBlue
|
||||
color.palette.darkgray = DarkGray
|
||||
color.palette.darkkhaki = DarkKhaki
|
||||
color.palette.darkred = DarkRed
|
||||
color.palette.dodgerblue = DodgerBlue
|
||||
@@ -20,6 +21,8 @@ color.palette.lime = lime
|
||||
color.palette.lightgray = rgb(192, 192, 192)
|
||||
color.palette.lightgreen = rgb(127, 255, 127)
|
||||
color.palette.lightred = rgb(255, 127, 127)
|
||||
color.palette.lightskyblue = lightskyblue
|
||||
color.palette.lightsteelblue = lightsteelblue
|
||||
color.palette.magenta = magenta
|
||||
color.palette.mistyrose = mistyrose
|
||||
color.palette.olive = olive
|
||||
|
||||
@@ -6,8 +6,9 @@ color.fg.error = red
|
||||
color.fg.disabled = lightGray
|
||||
color.bg.uneditable = system.color.bg.application // TODO see if there exists an LaF setting for this
|
||||
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.h2 = #984C4C
|
||||
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.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.fg.header.active = black
|
||||
color.fg.header.inactive = black
|
||||
@@ -37,6 +40,7 @@ color.cursor.focused = red
|
||||
color.cursor.unfocused = pink
|
||||
|
||||
color.bg.table.grid = gray
|
||||
color.bg.table.row.drag = color.palette.lavender
|
||||
color.bg.table.row = color.bg
|
||||
color.bg.table.row.alt = rgb(237,243,254)
|
||||
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.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.filterfield = color.bg.filtered
|
||||
@@ -66,9 +71,6 @@ color.bg.selection.help = lightSteelBlue
|
||||
color.border.bevel.highlight = lightGray
|
||||
color.border.bevel.shadow = gray
|
||||
|
||||
// extensions
|
||||
|
||||
color.bg.splash = color.bg
|
||||
color.bg.filechooser = color.bg
|
||||
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.path = #5BA5E3
|
||||
|
||||
color.bg.splashscreen = black
|
||||
|
||||
color.bg.header.active = #788CBD
|
||||
color.bg.header.inactive = dimGray
|
||||
color.fg.header.active = lightGray
|
||||
|
||||
@@ -33,6 +33,7 @@ import docking.menu.DialogToolbarButton;
|
||||
import docking.util.AnimationUtils;
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.AssertException;
|
||||
import ghidra.util.task.*;
|
||||
@@ -918,7 +919,7 @@ public class DialogComponentProvider
|
||||
statusLabel = new GDHtmlLabel(" ");
|
||||
statusLabel.setName("statusLabel");
|
||||
statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
statusLabel.setForeground(Color.blue);
|
||||
statusLabel.setForeground(Messages.NORMAL);
|
||||
statusLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
|
||||
statusLabel.addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.jdesktop.animation.timing.TimingTargetAdapter;
|
||||
import org.jdesktop.animation.timing.interpolation.PropertySetter;
|
||||
|
||||
import docking.util.AnimationUtils;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.util.WindowUtilities;
|
||||
import generic.util.image.ImageUtils;
|
||||
import ghidra.framework.OperatingSystem;
|
||||
@@ -538,7 +539,7 @@ public class DockableHeader extends GenericHeader
|
||||
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
|
||||
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||
|
||||
Color background = new Color(218, 232, 250);
|
||||
Color background = Palette.getColor("aliceblue");
|
||||
g.setColor(background);
|
||||
|
||||
Rectangle othersBounds = null;
|
||||
|
||||
@@ -37,6 +37,7 @@ import docking.widgets.list.GList;
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import docking.widgets.table.GTableCellRenderer;
|
||||
import docking.widgets.tree.support.GTreeRenderer;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.theme.Gui;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import resources.ResourceManager;
|
||||
@@ -349,7 +350,7 @@ public class DockingUtils {
|
||||
c.setBorder(BorderFactory.createEmptyBorder());
|
||||
}
|
||||
|
||||
c.setBackground(new Color(0, 0, 0, 0));
|
||||
c.setBackground(Palette.NO_COLOR);
|
||||
}
|
||||
|
||||
/** Hides any open tooltip window */
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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.ChangeListener;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
|
||||
/**
|
||||
* A re-usable floating text edit window.
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ public class EditWindow extends JWindow {
|
||||
private Component comp;
|
||||
private Rectangle rect;
|
||||
private EditListener listener;
|
||||
|
||||
|
||||
private AssociatedComponentListener compListener = new AssociatedComponentListener();
|
||||
|
||||
/**
|
||||
@@ -46,7 +47,7 @@ public class EditWindow extends JWindow {
|
||||
this.mgr = mgr;
|
||||
create();
|
||||
}
|
||||
|
||||
|
||||
Component getAssociatedComponent() {
|
||||
return comp;
|
||||
}
|
||||
@@ -55,7 +56,7 @@ public class EditWindow extends JWindow {
|
||||
* @see java.awt.Window#isActive()
|
||||
*/
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
@@ -63,16 +64,16 @@ public class EditWindow extends JWindow {
|
||||
* @see java.awt.Component#setVisible(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setVisible(boolean state) {
|
||||
|
||||
public void setVisible(boolean state) {
|
||||
|
||||
active = state;
|
||||
super.setVisible(state);
|
||||
|
||||
|
||||
if (!state) {
|
||||
if (comp != null) {
|
||||
comp.removeComponentListener(compListener);
|
||||
if (comp instanceof JTabbedPane) {
|
||||
((JTabbedPane)comp).removeChangeListener(compListener);
|
||||
((JTabbedPane) comp).removeChangeListener(compListener);
|
||||
}
|
||||
Frame frame = mgr.getRootFrame();
|
||||
frame.removeComponentListener(compListener);
|
||||
@@ -81,7 +82,7 @@ public class EditWindow extends JWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void close() {
|
||||
setVisible(false);
|
||||
dispose();
|
||||
@@ -90,55 +91,55 @@ public class EditWindow extends JWindow {
|
||||
void show(String defaultText, Component c, Rectangle r, EditListener editListener) {
|
||||
|
||||
if (comp != null) {
|
||||
setVisible(false);
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
if (c == null || !c.isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.comp = c;
|
||||
this.rect = r;
|
||||
this.listener = editListener;
|
||||
|
||||
|
||||
comp.addComponentListener(compListener);
|
||||
|
||||
|
||||
if (comp instanceof JTabbedPane) {
|
||||
((JTabbedPane)comp).addChangeListener(compListener);
|
||||
((JTabbedPane) comp).addChangeListener(compListener);
|
||||
}
|
||||
|
||||
|
||||
Frame frame = mgr.getRootFrame();
|
||||
frame.addComponentListener(compListener);
|
||||
|
||||
setLocation();
|
||||
|
||||
|
||||
textField.setText(defaultText != null ? defaultText : "");
|
||||
Dimension d = textField.getPreferredSize();
|
||||
textField.setPreferredSize(new Dimension(rect.width, d.height));
|
||||
pack();
|
||||
|
||||
|
||||
setVisible(true);
|
||||
|
||||
|
||||
toFront();
|
||||
textField.requestFocus();
|
||||
textField.selectAll();
|
||||
textField.requestFocus();
|
||||
textField.selectAll();
|
||||
}
|
||||
|
||||
|
||||
private void setLocation() {
|
||||
Point p = comp.getLocationOnScreen();
|
||||
setLocation(p.x+rect.x+3, p.y+rect.y);
|
||||
setLocation(p.x + rect.x + 3, p.y + rect.y);
|
||||
}
|
||||
|
||||
|
||||
private void create() {
|
||||
textField = new JTextField(" ");
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
Color bgColor = new Color(255, 255, 195);
|
||||
Color bgColor = Colors.BACKGROUND_TOOLTIP;
|
||||
panel.setBackground(bgColor);
|
||||
panel.add(textField, BorderLayout.CENTER);
|
||||
panel.add(textField, BorderLayout.CENTER);
|
||||
|
||||
textField.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
close();
|
||||
}
|
||||
@@ -146,51 +147,53 @@ public class EditWindow extends JWindow {
|
||||
});
|
||||
textField.addFocusListener(new FocusAdapter() {
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
if ( !e.isTemporary() ) {
|
||||
close();
|
||||
}
|
||||
public void focusLost(FocusEvent e) {
|
||||
if (!e.isTemporary()) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
});
|
||||
textField.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (listener != null) {
|
||||
String text = textField.getText();
|
||||
EditListener l = listener;
|
||||
close();
|
||||
l.editCompleted(text);
|
||||
}
|
||||
textField.addActionListener(e -> {
|
||||
if (listener != null) {
|
||||
String text = textField.getText();
|
||||
EditListener l = listener;
|
||||
close();
|
||||
l.editCompleted(text);
|
||||
}
|
||||
});
|
||||
|
||||
getContentPane().add(panel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
||||
private class AssociatedComponentListener implements ComponentListener, ChangeListener {
|
||||
|
||||
|
||||
/*
|
||||
* @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
|
||||
*/
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
|
||||
*/
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
|
||||
*/
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
|
||||
*/
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e) {
|
||||
if (comp != null && comp.isVisible()) {
|
||||
setLocation();
|
||||
@@ -200,6 +203,7 @@ public class EditWindow extends JWindow {
|
||||
/*
|
||||
* @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent)
|
||||
*/
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
close();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@ import docking.util.AnimationUtils;
|
||||
import docking.widgets.VariableHeightPanel;
|
||||
import docking.widgets.label.GDLabel;
|
||||
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?
|
||||
public class GenericHeader extends JPanel {
|
||||
@@ -71,7 +74,7 @@ public class GenericHeader extends JPanel {
|
||||
BorderLayout layout = new BorderLayout();
|
||||
layout.setVgap(1);
|
||||
setLayout(layout);
|
||||
setBorder(BorderFactory.createLineBorder(Color.GRAY));
|
||||
setBorder(BorderFactory.createLineBorder(Palette.GRAY));
|
||||
setFocusable(false);
|
||||
|
||||
titlePanel = new TitlePanel();
|
||||
@@ -209,7 +212,7 @@ public class GenericHeader extends JPanel {
|
||||
|
||||
private void constructMultiLinePanel() {
|
||||
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(titlePanel, BorderLayout.CENTER);
|
||||
add(menuCloseToolbar, BorderLayout.EAST);
|
||||
@@ -297,11 +300,7 @@ public class GenericHeader extends JPanel {
|
||||
|
||||
TitleFlasher() {
|
||||
animator = PropertySetter.createAnimator(1000, this, "color", NON_FOCUS_START_COLOR,
|
||||
NON_FOCUS_START_COLOR, Color.YELLOW, 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.setAcceleration(0.2f);
|
||||
animator.setDeceleration(0.8f);
|
||||
@@ -350,7 +349,7 @@ public class GenericHeader extends JPanel {
|
||||
setFocusable(false);
|
||||
titleLabel = new GDLabel();
|
||||
titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 6, 0, 0));
|
||||
titleLabel.setForeground(Color.BLACK);
|
||||
titleLabel.setForeground(Colors.FOREGROUND);
|
||||
titleLabel.setFocusable(false);
|
||||
add(titleLabel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@ import org.jdesktop.animation.timing.Animator;
|
||||
import docking.util.AnimationUtils;
|
||||
import docking.widgets.EmptyBorderButton;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.Gui;
|
||||
import generic.theme.TempColorUtils;
|
||||
import generic.util.WindowUtilities;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.layout.HorizontalLayout;
|
||||
@@ -196,7 +199,7 @@ public class StatusBar extends JPanel {
|
||||
String updatedText = fixupMultilineText(text);
|
||||
statusLabel.setText(updatedText);
|
||||
statusLabel.setToolTipText(getToolTipText());
|
||||
statusLabel.setForeground(Color.BLACK);
|
||||
statusLabel.setForeground(Colors.FOREGROUND);
|
||||
|
||||
if (StringUtils.isBlank(updatedText)) {
|
||||
return;
|
||||
@@ -304,24 +307,40 @@ public class StatusBar extends JPanel {
|
||||
private FadeTimer() {
|
||||
super(5000, null);
|
||||
addActionListener(this);
|
||||
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));
|
||||
fadeColorMap.put(new Color(32, 32, 32), new Color(64, 64, 64));
|
||||
fadeColorMap.put(new Color(64, 64, 64), new Color(80, 80, 80));
|
||||
fadeColorMap.put(new Color(80, 80, 80), new Color(96, 96, 96));
|
||||
fadeColorMap.put(new Color(96, 96, 96), new Color(112, 112, 112));
|
||||
fadeColorMap.put(new Color(112, 112, 112), new Color(128, 128, 128));
|
||||
|
||||
int value = 0;
|
||||
int delta = 16;
|
||||
if (Gui.getActiveTheme().useDarkDefaults()) {
|
||||
value = 128;
|
||||
delta = -16;
|
||||
}
|
||||
|
||||
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
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
Color nextFadeColor = fadeColorMap.get(statusLabel.getForeground());
|
||||
|
||||
if (nextFadeColor != null) {
|
||||
|
||||
statusLabel.setForeground(nextFadeColor);
|
||||
}
|
||||
else {
|
||||
@@ -385,7 +404,7 @@ public class StatusBar extends JPanel {
|
||||
int red = color.getRed();
|
||||
int green = color.getGreen();
|
||||
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() {
|
||||
|
||||
@@ -27,6 +27,7 @@ import docking.KeyEntryTextField;
|
||||
import docking.action.*;
|
||||
import docking.tool.ToolConstants;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import generic.util.action.ReservedKeyBindings;
|
||||
import ghidra.util.HelpLocation;
|
||||
import resources.ResourceManager;
|
||||
@@ -172,7 +173,7 @@ public class KeyEntryDialog extends DialogComponentProvider {
|
||||
textAttrSet = new SimpleAttributeSet();
|
||||
textAttrSet.addAttribute(StyleConstants.FontFamily, "Tahoma");
|
||||
textAttrSet.addAttribute(StyleConstants.FontSize, Integer.valueOf(11));
|
||||
textAttrSet.addAttribute(StyleConstants.Foreground, Color.BLUE);
|
||||
textAttrSet.addAttribute(StyleConstants.Foreground, Messages.NORMAL);
|
||||
|
||||
tabAttrSet = new SimpleAttributeSet();
|
||||
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);
|
||||
try {
|
||||
doc.insertString(0, "Actions mapped to " + ksName + "\n\n", textAttrSet);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DockingActionIf a = list.get(i);
|
||||
|
||||
for (DockingActionIf a : list) {
|
||||
String collisionStr = "\t" + a.getName() + " (" + a.getOwnerDescription() + ")\n";
|
||||
int offset = doc.getLength();
|
||||
doc.insertString(offset, collisionStr, textAttrSet);
|
||||
|
||||
@@ -16,12 +16,14 @@
|
||||
package docking.framework;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
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
|
||||
@@ -29,7 +31,6 @@ import docking.DockingWindowManager;
|
||||
* initialization is complete, the splash screen is dismissed.
|
||||
*/
|
||||
public class AboutDialog extends DialogComponentProvider {
|
||||
private static final Color DEFAULT_BACKGROUND_COLOR = new Color(243, 250, 255);
|
||||
|
||||
public AboutDialog() {
|
||||
super(ApplicationInformationDisplayFactory.createAboutTitle(), true, false, true, false);
|
||||
@@ -57,7 +58,7 @@ public class AboutDialog extends DialogComponentProvider {
|
||||
private JPanel createMainPanel() {
|
||||
JPanel mainPanel = new JPanel(new BorderLayout());
|
||||
mainPanel.setBorder(BorderFactory.createRaisedBevelBorder());
|
||||
mainPanel.setBackground(DEFAULT_BACKGROUND_COLOR);
|
||||
mainPanel.setBackground(Colors.BACKGROUND);
|
||||
mainPanel.add(createInfoComponent(), BorderLayout.CENTER);
|
||||
return mainPanel;
|
||||
}
|
||||
@@ -67,6 +68,10 @@ public class AboutDialog extends DialogComponentProvider {
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -23,6 +23,8 @@ import javax.swing.*;
|
||||
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.framework.Application;
|
||||
import ghidra.framework.PluggableServiceRegistry;
|
||||
import ghidra.util.HelpLocation;
|
||||
@@ -115,12 +117,11 @@ public class ApplicationInformationDisplayFactory {
|
||||
final JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.setPreferredSize(new Dimension(400, 400));
|
||||
|
||||
Color background = Color.BLACK;
|
||||
|
||||
Color background = new GColor("color.bg.splashscreen");
|
||||
panel.setBackground(background);
|
||||
|
||||
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);
|
||||
nameLabel.setFont(newFont);
|
||||
nameLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
@@ -24,7 +24,6 @@ import javax.swing.border.BevelBorder;
|
||||
|
||||
import docking.*;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import generic.theme.GColor;
|
||||
import generic.util.WindowUtilities;
|
||||
import ghidra.framework.Application;
|
||||
@@ -38,6 +37,8 @@ import utility.application.ApplicationLayout;
|
||||
*/
|
||||
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 DockingFrame hiddenFrame;
|
||||
private static JLabel statusLabel;
|
||||
@@ -285,8 +286,7 @@ public class SplashScreen extends JWindow {
|
||||
|
||||
private JPanel createMainPanel() {
|
||||
JPanel mainPanel = new JPanel(new BorderLayout());
|
||||
mainPanel.setBackground(new GColor("color.bg.splash"));
|
||||
mainPanel.add(createTitlePanel(), BorderLayout.NORTH);
|
||||
mainPanel.setBackground(BG_COLOR);
|
||||
mainPanel.add(createContentPanel(), BorderLayout.CENTER);
|
||||
return mainPanel;
|
||||
}
|
||||
@@ -299,38 +299,12 @@ public class SplashScreen extends JWindow {
|
||||
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() {
|
||||
Font f = new Font("serif", Font.BOLD, 12);
|
||||
statusLabel = new GDLabel(" Loading...");
|
||||
statusLabel.setFont(f);
|
||||
|
||||
statusLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 2, 10));
|
||||
statusLabel.setBackground(new GColor("color.bg.splash"));
|
||||
statusLabel.setOpaque(true);
|
||||
return statusLabel;
|
||||
}
|
||||
|
||||
@@ -37,8 +37,10 @@ import org.jdesktop.animation.timing.TimingTargetAdapter;
|
||||
import docking.framework.ApplicationInformationDisplayFactory;
|
||||
import docking.util.AnimationPainter;
|
||||
import docking.util.AnimationUtils;
|
||||
import generic.theme.GColor;
|
||||
import ghidra.framework.preferences.Preferences;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.Swing;
|
||||
import ghidra.util.bean.GGlassPane;
|
||||
import resources.ResourceManager;
|
||||
|
||||
@@ -498,7 +500,7 @@ public class GHelpBroker extends DefaultHelpBroker {
|
||||
//
|
||||
// Unusual Code: Not yet rendered! Try again.
|
||||
//
|
||||
SwingUtilities.invokeLater(() -> doCalloutReference(area, numberOfCalls));
|
||||
Swing.runLater(() -> doCalloutReference(area, numberOfCalls));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -653,7 +655,7 @@ public class GHelpBroker extends DefaultHelpBroker {
|
||||
|
||||
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;
|
||||
|
||||
LocationHintPainter(Shape paintShape) {
|
||||
@@ -705,11 +707,11 @@ public class GHelpBroker extends DefaultHelpBroker {
|
||||
/*
|
||||
// Debug
|
||||
Shape box = scaler.createTransformedShape(b);
|
||||
g2d.setColor(Color.GREEN);
|
||||
g2d.setColor(Palette.GREEN);
|
||||
g2d.fill(box);
|
||||
|
||||
box = transform.createTransformedShape(box);
|
||||
g2d.setColor(Color.YELLOW);
|
||||
g2d.setColor(Palette.YELLOW);
|
||||
g2d.fill(box);
|
||||
*/
|
||||
|
||||
|
||||
+2
-1
@@ -30,6 +30,7 @@ import docking.*;
|
||||
import docking.action.*;
|
||||
import docking.widgets.EmptyBorderButton;
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.util.Swing;
|
||||
import resources.ResourceManager;
|
||||
|
||||
@@ -251,7 +252,7 @@ public class MultipleActionDockingToolbarButton extends EmptyBorderButton {
|
||||
return; // shouldn't happen
|
||||
}
|
||||
|
||||
g.setColor(Color.BLACK);
|
||||
g.setColor(Colors.FOREGROUND);
|
||||
int iconWidth = baseIcon.getIconWidth();
|
||||
int iconHeight = baseIcon.getIconHeight();
|
||||
int insetsPadding = insets.left + insets.right; // the insets of the left icon and the arrow (between the two)
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import resources.ResourceManager;
|
||||
|
||||
/**
|
||||
@@ -99,7 +100,7 @@ public class ButtonPanelFactory {
|
||||
public final static Icon BROWSE_ICON = new Icon() {
|
||||
@Override
|
||||
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 + 4, 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 javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.DockingWindowManager;
|
||||
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,
|
||||
@@ -35,9 +36,6 @@ import docking.widgets.label.GDHtmlLabel;
|
||||
*/
|
||||
public class ColorEditor extends PropertyEditorSupport {
|
||||
|
||||
private static final String LIGHT_COLOR = "SILVER";
|
||||
private static final String DARK_COLOR = "BLACK";
|
||||
|
||||
private static GhidraColorChooser colorChooser;
|
||||
|
||||
private JLabel previewLabel = new GDHtmlLabel();
|
||||
@@ -88,14 +86,9 @@ public class ColorEditor extends PropertyEditorSupport {
|
||||
}
|
||||
|
||||
private void updateColor(Color newColor) {
|
||||
String colorString = LIGHT_COLOR;
|
||||
|
||||
// change the color to a darker value if the color being set is light
|
||||
int colorValue = newColor.getRed() + newColor.getGreen() + newColor.getBlue();
|
||||
if (colorValue > 400) { // arbitrary threshold determined by trial-and-error
|
||||
colorString = DARK_COLOR;
|
||||
}
|
||||
|
||||
String colorString = TempColorUtils.toString(ColorUtils.contrastForegroundColor(newColor));
|
||||
previewLabel.setText(
|
||||
"<HTML><CENTER><I><FONT SIZE=2 COLOR=" + colorString + ">click</FONT></I></CENTER>");
|
||||
|
||||
@@ -118,14 +111,12 @@ public class ColorEditor extends PropertyEditorSupport {
|
||||
gfx.setColor(color);
|
||||
}
|
||||
else {
|
||||
gfx.setColor(Color.black);
|
||||
gfx.setColor(Palette.BLACK);
|
||||
}
|
||||
gfx.fillRect(box.x, box.y, box.width, box.height);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class EditorProvider extends DialogComponentProvider {
|
||||
private class EditorProvider extends DialogComponentProvider {
|
||||
EditorProvider(JPanel contentPanel) {
|
||||
super("Color Editor", true);
|
||||
|
||||
@@ -141,7 +132,7 @@ public class ColorEditor extends PropertyEditorSupport {
|
||||
}
|
||||
}
|
||||
|
||||
class ColorEditorPanel extends JPanel {
|
||||
private class ColorEditorPanel extends JPanel {
|
||||
|
||||
ColorEditorPanel() {
|
||||
|
||||
@@ -152,15 +143,13 @@ public class ColorEditor extends PropertyEditorSupport {
|
||||
}
|
||||
|
||||
add(colorChooser, BorderLayout.CENTER);
|
||||
colorChooser.getSelectionModel().addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
lastUserSelectedColor = colorChooser.getColor();
|
||||
// This could be a ColorUIResource, but Options only support storing Color.
|
||||
lastUserSelectedColor =
|
||||
new Color(lastUserSelectedColor.getRed(), lastUserSelectedColor.getGreen(),
|
||||
lastUserSelectedColor.getBlue(), lastUserSelectedColor.getAlpha());
|
||||
}
|
||||
colorChooser.getSelectionModel().addChangeListener(e -> {
|
||||
|
||||
// This could be a ColorUIResource, but Options only support storing Color. So,
|
||||
// manually create a new Color object to avoid saving a ColorUIResource.
|
||||
Color c = colorChooser.getColor();
|
||||
lastUserSelectedColor = TempColorUtils.fromRgba(c.getRed(), c.getGreen(),
|
||||
c.getBlue(), c.getAlpha());
|
||||
});
|
||||
colorChooser.setColor(color);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package docking.options.editor;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
|
||||
@@ -55,7 +54,6 @@ public class OptionsDialog extends DialogComponentProvider {
|
||||
new OptionsPropertyChangeListener());
|
||||
|
||||
setTitle(title);
|
||||
setBackground(Color.lightGray);
|
||||
|
||||
addWorkPanel(panel);
|
||||
addOKButton();
|
||||
@@ -67,6 +65,7 @@ public class OptionsDialog extends DialogComponentProvider {
|
||||
setFocusComponent(panel.getFocusComponent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
panel.dispose();
|
||||
}
|
||||
|
||||
+13
-7
@@ -21,11 +21,14 @@ import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.colorchooser.AbstractColorChooserPanel;
|
||||
|
||||
import docking.widgets.label.GHtmlLabel;
|
||||
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;
|
||||
|
||||
public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
@@ -66,6 +69,7 @@ public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
return Integer.parseInt((String) value);
|
||||
}
|
||||
catch (NumberFormatException nfe) {
|
||||
// return default value
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
@@ -118,8 +122,7 @@ public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
recentSwatchListener = new RecentSwatchListener();
|
||||
recentSwatchPanel.addMouseListener(recentSwatchListener);
|
||||
|
||||
Border border =
|
||||
new CompoundBorder(new LineBorder(Color.black), new LineBorder(Color.white));
|
||||
LineBorder border = new LineBorder(Java.BORDER);
|
||||
swatchPanel.setBorder(border);
|
||||
gbc.weightx = 1.0;
|
||||
gbc.gridwidth = 2;
|
||||
@@ -182,6 +185,7 @@ public class SettableColorSwatchChooserPanel extends AbstractColorChooserPanel {
|
||||
|
||||
@Override
|
||||
public void updateChooser() {
|
||||
// stub
|
||||
}
|
||||
|
||||
class HistorySwatchListener extends MouseAdapter {
|
||||
@@ -222,7 +226,7 @@ class SwatchPanel extends JPanel {
|
||||
initColors();
|
||||
setToolTipText(""); // register for events
|
||||
setOpaque(true);
|
||||
setBackground(Color.white);
|
||||
setBackground(Colors.BACKGROUND);
|
||||
setRequestFocusEnabled(false);
|
||||
}
|
||||
|
||||
@@ -232,6 +236,7 @@ class SwatchPanel extends JPanel {
|
||||
}
|
||||
|
||||
protected void initValues() {
|
||||
// stub
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -251,7 +256,7 @@ class SwatchPanel extends JPanel {
|
||||
}
|
||||
int y = row * (swatchSize.height + gap.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,
|
||||
y + swatchSize.height - 1);
|
||||
g.drawLine(x, y + swatchSize.height - 1, x + swatchSize.width - 1,
|
||||
@@ -268,7 +273,7 @@ class SwatchPanel extends JPanel {
|
||||
}
|
||||
|
||||
protected void initColors() {
|
||||
|
||||
// stub
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -384,7 +389,8 @@ class MainSwatchPanel extends SwatchPanel {
|
||||
colors = new Color[numColors];
|
||||
for (int i = 0; i < numColors; 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 docking.util.GraphicsUtils;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
|
||||
/**
|
||||
* An icon that paints the given number
|
||||
*/
|
||||
public class NumberIcon implements Icon {
|
||||
|
||||
private static final Color BORDER_COLOR = Palette.getColor("lightskyblue");
|
||||
private String number;
|
||||
private float bestFontSize = -1;
|
||||
|
||||
@@ -42,9 +45,9 @@ public class NumberIcon implements Icon {
|
||||
|
||||
@Override
|
||||
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.setColor(new Color(0xb5d5ff));
|
||||
g.setColor(BORDER_COLOR);
|
||||
g.drawRect(x, y, getIconWidth(), getIconHeight());
|
||||
|
||||
float fontSize = getMaxFontSize(g, getIconWidth() - 1, getIconHeight());
|
||||
@@ -66,7 +69,7 @@ public class NumberIcon implements Icon {
|
||||
int halfTextWidth = textWidth >> 1;
|
||||
int baselineX = x + (halfWidth - halfTextWidth);
|
||||
|
||||
g.setColor(Color.BLACK);
|
||||
g.setColor(Colors.FOREGROUND);
|
||||
JComponent jc = null;
|
||||
if (c instanceof JComponent) {
|
||||
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.interpolation.PropertySetter;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Java;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.util.WindowUtilities;
|
||||
import generic.util.image.ImageUtils;
|
||||
import ghidra.util.Msg;
|
||||
@@ -392,12 +394,11 @@ public class AnimationUtils {
|
||||
|
||||
@Override
|
||||
public void paint(GGlassPane glassPane, Graphics g) {
|
||||
Color gray = Color.GRAY;
|
||||
Color gray = Palette.GRAY;
|
||||
// double darknessFudge = .95;
|
||||
// double progress = percentComplete * darknessFudge; // emphasis starts at 1
|
||||
// int alpha = Math.min(255, (int) (255 * progress));
|
||||
// gray = new Color(gray.getRed(), gray.getGreen(), gray.getBlue(), alpha);
|
||||
gray = new Color(gray.getRed(), gray.getGreen(), gray.getBlue());
|
||||
// gray = ColorUtils.fromRgba(gray.getRed(), gray.getGreen(), gray.getBlue(), alpha);
|
||||
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
Composite originaComposite = g2d.getComposite();
|
||||
@@ -819,7 +820,7 @@ public class AnimationUtils {
|
||||
@Override
|
||||
public void paint(GGlassPane glassPane, Graphics g) {
|
||||
|
||||
Color background = new Color(218, 232, 250);
|
||||
Color background = Palette.getColor("lightsteelblue");
|
||||
g.setColor(background);
|
||||
|
||||
Rectangle defaultBounds = component.getBounds();
|
||||
@@ -877,7 +878,7 @@ public class AnimationUtils {
|
||||
double cx = emphasizedBounds.getCenterX();
|
||||
double cy = emphasizedBounds.getCenterY();
|
||||
g2d.rotate(rad, cx, cy);
|
||||
g.setColor(Color.BLACK);
|
||||
g.setColor(Java.BORDER);
|
||||
|
||||
int iw = emphasizedBounds.width;
|
||||
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.VolatileImage;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.util.image.ImageUtils;
|
||||
|
||||
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;
|
||||
|
||||
public Image createCallout(CalloutComponentInfo calloutInfo) {
|
||||
@@ -111,13 +112,13 @@ public class Callout {
|
||||
//
|
||||
// Debug
|
||||
//
|
||||
// g2d.setColor(Color.RED);
|
||||
// g2d.setColor(Palette.RED);
|
||||
// g2d.draw(fullBounds);
|
||||
//
|
||||
// g2d.setColor(Color.CYAN);
|
||||
// g2d.setColor(Palette.CYAN);
|
||||
// g2d.draw(calloutBounds);
|
||||
//
|
||||
// g2d.setColor(Color.BLUE);
|
||||
// g2d.setColor(Palette.BLUE);
|
||||
// g2d.draw(cBounds);
|
||||
|
||||
// return image;
|
||||
@@ -189,7 +190,7 @@ public class Callout {
|
||||
createCalloutImage(calloutInfo, componentLocation, calloutBounds, calloutDrawingArea);
|
||||
|
||||
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
|
||||
@@ -214,7 +215,8 @@ public class Callout {
|
||||
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();
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
@@ -228,30 +230,30 @@ public class Callout {
|
||||
//
|
||||
// Debug
|
||||
//
|
||||
// g2d.setColor(Color.RED);
|
||||
// g2d.setColor(Palette.RED);
|
||||
// g2d.draw(fullBounds);
|
||||
//
|
||||
// g2d.setColor(Color.CYAN);
|
||||
// g2d.setColor(Palette.CYAN);
|
||||
// g2d.draw(calloutBounds);
|
||||
//
|
||||
// g2d.setColor(Color.BLUE);
|
||||
// g2d.setColor(Palette.BLUE);
|
||||
// g2d.draw(componentBounds);
|
||||
//
|
||||
// g2d.setColor(Color.MAGENTA);
|
||||
// g2d.setColor(Palette.MAGENTA);
|
||||
// g2d.draw(completeBounds);
|
||||
//
|
||||
// g2d.setColor(Color.GRAY);
|
||||
// g2d.setColor(Palette.GRAY);
|
||||
// g2d.draw(dropShadowBounds);
|
||||
//
|
||||
// Point cLocation = componentBounds.getLocation();
|
||||
// Point convertedCLocation = calloutInfo.convertPointToParent(cLocation);
|
||||
// g2d.setColor(Color.PINK);
|
||||
// g2d.setColor(Palette.PINK);
|
||||
// componentBounds.setLocation(convertedCLocation);
|
||||
// g2d.draw(componentBounds);
|
||||
//
|
||||
// Point convertedFBLocation = calloutInfo.convertPointToParent(fullBounds.getLocation());
|
||||
// fullBounds.setLocation(convertedFBLocation);
|
||||
// g2d.setColor(Color.ORANGE);
|
||||
// g2d.setColor(Palette.ORANGE);
|
||||
// g2d.draw(fullBounds);
|
||||
|
||||
return image;
|
||||
@@ -404,7 +406,7 @@ public class Callout {
|
||||
// render the clip shape into the image
|
||||
g.setComposite(AlphaComposite.Src);
|
||||
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g.setColor(Color.WHITE);
|
||||
g.setColor(Palette.WHITE);
|
||||
|
||||
g.fill(imageShape);
|
||||
|
||||
|
||||
@@ -23,9 +23,11 @@ import java.awt.image.*;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
|
||||
public class DropShadow {
|
||||
|
||||
private Color shadowColor = new Color(0x000000);
|
||||
private Color shadowColor = Palette.BLACK;
|
||||
private float shadowOpacity = 0.85f;
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -40,7 +42,7 @@ public class DropShadow {
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
Color background = Color.WHITE;
|
||||
Color background = Palette.WHITE;
|
||||
g.setColor(background);
|
||||
Dimension size = getSize();
|
||||
g.fillRect(0, 0, size.width, size.height);
|
||||
@@ -59,14 +61,14 @@ public class DropShadow {
|
||||
g2d.setComposite(AlphaComposite.Src);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
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);
|
||||
|
||||
// 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
|
||||
// be zero, so nothing is rendered in those areas.
|
||||
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.dispose();
|
||||
|
||||
@@ -77,7 +79,7 @@ public class DropShadow {
|
||||
graphics.dispose();
|
||||
image = bufferedImage;
|
||||
|
||||
shadow = ds.createDrowShadow(bufferedImage, 5);
|
||||
shadow = ds.createDropShadow(bufferedImage, 5);
|
||||
|
||||
// }
|
||||
|
||||
@@ -206,7 +208,7 @@ public class DropShadow {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public Image createDrowShadow(BufferedImage image, int shadowSize) {
|
||||
public Image createDropShadow(BufferedImage image, int shadowSize) {
|
||||
BufferedImage subject = prepareImage(image, shadowSize);
|
||||
|
||||
// BufferedImage shadow =
|
||||
|
||||
@@ -23,6 +23,7 @@ import javax.swing.border.Border;
|
||||
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
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.
|
||||
@@ -57,7 +58,7 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel {
|
||||
public AbstractGCellRenderer() {
|
||||
noFocusBorder = BorderFactory.createEmptyBorder(0, 5, 0, 5);
|
||||
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);
|
||||
setBorder(noFocusBorder);
|
||||
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ public class DropDownMultiSelectionTextField<T> extends DropDownSelectionTextFie
|
||||
previewList = new JList<>();
|
||||
}
|
||||
previewList.setOpaque(true);
|
||||
previewList.setBackground(TOOLTIP_WINDOW_BGCOLOR);
|
||||
previewList.setBackground(PREVIEW_WINDOW_BGCOLOR);
|
||||
previewList.setFocusable(false);
|
||||
previewList.setModel(new DefaultListModel<String>());
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import docking.widgets.list.GList;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.util.WindowUtilities;
|
||||
import ghidra.util.StringUtilities;
|
||||
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 MIN_HEIGHT = 300;
|
||||
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 matchingWindow; // delayed initialization for parenting
|
||||
@@ -155,7 +156,7 @@ public class DropDownTextField<T> extends JTextField implements GComponent {
|
||||
protected void setPreviewPaneAttributes() {
|
||||
previewLabel = new GDHtmlLabel();
|
||||
previewLabel.setOpaque(true);
|
||||
previewLabel.setBackground(TOOLTIP_WINDOW_BGCOLOR);
|
||||
previewLabel.setBackground(PREVIEW_WINDOW_BGCOLOR);
|
||||
previewLabel.setVerticalAlignment(SwingConstants.TOP);
|
||||
previewLabel.setFocusable(false);
|
||||
}
|
||||
@@ -342,7 +343,7 @@ public class DropDownTextField<T> extends JTextField implements GComponent {
|
||||
updateWindowLocation();
|
||||
showMatchingWindow();
|
||||
|
||||
getPreviewPaneComponent().setBackground(TOOLTIP_WINDOW_BGCOLOR);
|
||||
getPreviewPaneComponent().setBackground(PREVIEW_WINDOW_BGCOLOR);
|
||||
toolTipWindow.setVisible(hasPreview());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import javax.swing.*;
|
||||
import javax.swing.Timer;
|
||||
|
||||
import docking.widgets.shapes.*;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.util.WindowUtilities;
|
||||
import ghidra.util.bean.GGlassPane;
|
||||
import ghidra.util.bean.GGlassPanePainter;
|
||||
@@ -337,7 +338,7 @@ public class PopupWindow {
|
||||
Point p = new Point(r.getLocation());
|
||||
SwingUtilities.convertPointFromScreen(p, glassPane);
|
||||
|
||||
Color c = new Color(50, 50, 200, 125);
|
||||
Color c = Palette.LAVENDER;
|
||||
g.setColor(c);
|
||||
g.fillRect(p.x, p.y, r.width, r.height);
|
||||
}
|
||||
@@ -346,7 +347,7 @@ public class PopupWindow {
|
||||
if (sourceEvent != null) {
|
||||
Point p = sourceEvent.getPoint();
|
||||
p = SwingUtilities.convertPoint(sourceEvent.getComponent(), p.x, p.y, glassPane);
|
||||
g.setColor(Color.RED);
|
||||
g.setColor(Palette.RED);
|
||||
int offset = 10;
|
||||
g.fillRect(p.x - offset, p.y - offset, (offset * 2), (offset * 2));
|
||||
}
|
||||
|
||||
+4
-3
@@ -30,6 +30,7 @@ import docking.widgets.EmptyBorderButton;
|
||||
import docking.widgets.checkbox.GCheckBox;
|
||||
import docking.widgets.label.GDHtmlLabel;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.layout.PairLayout;
|
||||
@@ -121,12 +122,12 @@ public class ConditionTestPanel extends JPanel {
|
||||
private void updateOverallProgress() {
|
||||
overallProgressBar.setMaxProgress(conditionTestModel.getTestCount());
|
||||
overallProgressBar.setProgress(conditionTestModel.getCompletedTestCount());
|
||||
Color color = Color.GREEN;
|
||||
Color color = Palette.GREEN;
|
||||
if (conditionTestModel.getErrorCount() > 0) {
|
||||
color = Color.RED;
|
||||
color = Palette.RED;
|
||||
}
|
||||
else if (conditionTestModel.getWarningCount() > 0) {
|
||||
color = Color.YELLOW;
|
||||
color = Palette.YELLOW;
|
||||
}
|
||||
overallProgressBar.setColor(color);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ import docking.widgets.fieldpanel.support.*;
|
||||
import docking.widgets.indexedscrollpane.IndexScrollListener;
|
||||
import docking.widgets.indexedscrollpane.IndexedScrollable;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import generic.theme.TempColorUtils;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.SystemUtilities;
|
||||
|
||||
@@ -1152,10 +1154,7 @@ public class FieldPanel extends JPanel
|
||||
}
|
||||
|
||||
private Color blend(Color primary, Color secondary) {
|
||||
int red = (primary.getRed() * 3 + secondary.getRed()) / 4;
|
||||
int green = (primary.getGreen() * 3 + secondary.getGreen()) / 4;
|
||||
int blue = (primary.getBlue() * 3 + secondary.getBlue()) / 4;
|
||||
return new Color(red, green, blue);
|
||||
return TempColorUtils.blend4(primary, secondary);
|
||||
}
|
||||
|
||||
private void paintLayoutBackground(Graphics g, Rectangle rect, AnchoredLayout layout,
|
||||
@@ -1185,7 +1184,7 @@ public class FieldPanel extends JPanel
|
||||
Color defaultBackgroundColor = backgroundColorModel.getDefaultBackgroundColor();
|
||||
g.setColor(defaultBackgroundColor);
|
||||
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());
|
||||
Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
+4
-1
@@ -23,6 +23,7 @@ import docking.widgets.fieldpanel.internal.FieldBackgroundColorManager;
|
||||
import docking.widgets.fieldpanel.internal.PaintContext;
|
||||
import docking.widgets.fieldpanel.support.DefaultRowColLocation;
|
||||
import docking.widgets.fieldpanel.support.RowColLocation;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* field always returns false since there is no text.
|
||||
* @returns true if the cursor is allowed past the last character
|
||||
*/
|
||||
public boolean isAllowCursorAtEnd() {
|
||||
return false;
|
||||
@@ -168,6 +170,7 @@ public class EmptyTextField implements Field {
|
||||
* @param color the new foreground color.
|
||||
*/
|
||||
public void setForeground(Color color) {
|
||||
// cannot change foreground
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,7 +181,7 @@ public class EmptyTextField implements Field {
|
||||
* was called.
|
||||
*/
|
||||
public Color getForeground() {
|
||||
return Color.WHITE;
|
||||
return Palette.NO_COLOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -21,6 +21,7 @@ import java.awt.Graphics;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
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
|
||||
@@ -68,7 +69,7 @@ public class StrutFieldElement implements FieldElement {
|
||||
|
||||
@Override
|
||||
public Color getColor(int charIndex) {
|
||||
return Color.BLACK;
|
||||
return Colors.FOREGROUND;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
-6
@@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,10 +15,10 @@
|
||||
*/
|
||||
package docking.widgets.fieldpanel.internal;
|
||||
|
||||
import ghidra.util.datastruct.*;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import generic.theme.TempColorUtils;
|
||||
import ghidra.util.datastruct.*;
|
||||
|
||||
public class ColorRangeMap {
|
||||
private RangeMap map;
|
||||
@@ -30,7 +29,7 @@ public class ColorRangeMap {
|
||||
public ColorRangeMap() {
|
||||
map = new RangeMap();
|
||||
valueRange = map.getValueRange(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void color(long start, long end, Color c) {
|
||||
@@ -38,14 +37,17 @@ public class ColorRangeMap {
|
||||
map.paintRange(start, end, colorValue);
|
||||
valueRange = map.getValueRange(0);
|
||||
}
|
||||
|
||||
public void clear(long start, long end) {
|
||||
map.paintRange(start, end, 0);
|
||||
valueRange = map.getValueRange(0);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
map.clear();
|
||||
valueRange = map.getValueRange(0);
|
||||
}
|
||||
|
||||
public Color getColor(long index, Color defaultColor) {
|
||||
if (!valueRange.contains(index)) {
|
||||
valueRange = map.getValueRange(index);
|
||||
@@ -56,18 +58,20 @@ public class ColorRangeMap {
|
||||
}
|
||||
return getColor(valueRange.getValue());
|
||||
}
|
||||
|
||||
private Color getColor(int colorValue) {
|
||||
if (lastColorValue == colorValue) {
|
||||
return lastColor;
|
||||
}
|
||||
lastColorValue = colorValue;
|
||||
lastColor = new Color(colorValue);
|
||||
lastColor = TempColorUtils.fromRgb(colorValue);
|
||||
return lastColor;
|
||||
}
|
||||
|
||||
public ColorRangeMap copy() {
|
||||
ColorRangeMap newMap = new ColorRangeMap();
|
||||
IndexRangeIterator it = map.getIndexRangeIterator(-1);
|
||||
while(it.hasNext()) {
|
||||
while (it.hasNext()) {
|
||||
IndexRange ir = it.next();
|
||||
int colorValue = map.getValue(ir.getStart());
|
||||
newMap.map.paintRange(ir.getStart(), ir.getEnd(), colorValue);
|
||||
|
||||
+5
-6
@@ -18,6 +18,8 @@ package docking.widgets.fieldpanel.internal;
|
||||
import java.awt.Color;
|
||||
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import generic.theme.TempColorUtils;
|
||||
|
||||
/**
|
||||
* Miscellaneous information needed by fields to paint.
|
||||
@@ -50,7 +52,7 @@ public class PaintContext {
|
||||
focusedCursorColor = new GColor("color.cursor.focused");
|
||||
notFocusedCursorColor = new GColor("color.cursor.unfocused");
|
||||
cursorColor = focusedCursorColor;
|
||||
invisibleCursorColor = new Color(255, 0, 0, 1);
|
||||
invisibleCursorColor = Palette.NO_COLOR;
|
||||
}
|
||||
|
||||
public PaintContext(PaintContext other) {
|
||||
@@ -128,10 +130,7 @@ public class PaintContext {
|
||||
}
|
||||
|
||||
private void adjustSelectedHighlightColor() {
|
||||
int red = (selectionColor.getRed() + highlightColor.getRed()) / 2;
|
||||
int green = (selectionColor.getGreen() + highlightColor.getGreen()) / 2;
|
||||
int blue = (selectionColor.getBlue() + highlightColor.getBlue()) / 2;
|
||||
selectedHighlightColor = new Color(red, green, blue);
|
||||
selectedHighlightColor = TempColorUtils.blend3(selectionColor, highlightColor);
|
||||
}
|
||||
|
||||
public void setBackgroundColor(Color c) {
|
||||
@@ -144,7 +143,7 @@ public class PaintContext {
|
||||
|
||||
public void setCursorColor(Color c) {
|
||||
cursorColor = c;
|
||||
invisibleCursorColor = new Color(c.getRed(), c.getGreen(), c.getBlue(), 1);
|
||||
invisibleCursorColor = Palette.NO_COLOR;
|
||||
}
|
||||
|
||||
public boolean cursorHidden() {
|
||||
|
||||
+5
-3
@@ -28,12 +28,13 @@ import docking.widgets.fieldpanel.listener.IndexMapper;
|
||||
import docking.widgets.fieldpanel.listener.LayoutModelListener;
|
||||
import docking.widgets.fieldpanel.support.*;
|
||||
import docking.widgets.indexedscrollpane.IndexedScrollPane;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
|
||||
public class TestBigLayoutModel implements LayoutModel {
|
||||
private static final Highlight[] NO_HIGHLIGHTS = new Highlight[0];
|
||||
private static final HighlightFactory hlFactory =
|
||||
(field, text, cursorTextOffset) -> NO_HIGHLIGHTS;
|
||||
ArrayList<LayoutModelListener> listeners = new ArrayList<LayoutModelListener>();
|
||||
ArrayList<LayoutModelListener> listeners = new ArrayList<>();
|
||||
|
||||
FontMetrics fm;
|
||||
// BigInteger numIndexes = BigInteger.valueOf(1000000000000000L);
|
||||
@@ -83,9 +84,10 @@ public class TestBigLayoutModel implements LayoutModel {
|
||||
}
|
||||
String text = name + ": This is line " + index +
|
||||
" 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 =
|
||||
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),
|
||||
new ClippingTextField(330, 100, fe2, hlFactory));
|
||||
|
||||
|
||||
+4
-2
@@ -31,6 +31,8 @@ import docking.widgets.AutoLookup;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.list.GList;
|
||||
import docking.widgets.list.GListAutoLookup;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import generic.theme.GThemeDefaults.Colors.Java;
|
||||
import ghidra.util.exception.AssertException;
|
||||
|
||||
class DirectoryList extends GList<File> implements GhidraFileChooserDirectoryModelIf {
|
||||
@@ -184,12 +186,12 @@ class DirectoryList extends GList<File> implements GhidraFileChooserDirectoryMod
|
||||
});
|
||||
|
||||
listEditor = new JPanel(new BorderLayout());
|
||||
listEditor.setBorder(BorderFactory.createLineBorder(Color.GRAY));
|
||||
listEditor.setBorder(BorderFactory.createLineBorder(Java.BORDER));
|
||||
|
||||
listEditor.add(listEditorLabel, BorderLayout.WEST);
|
||||
listEditor.add(listEditorField, BorderLayout.CENTER);
|
||||
|
||||
listEditor.setBackground(Color.WHITE);
|
||||
listEditor.setBackground(Colors.BACKGROUND);
|
||||
listEditorField.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
||||
|
||||
add(listEditor);
|
||||
|
||||
+60
-63
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package docking.widgets.filechooser;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
@@ -23,58 +22,56 @@ import java.io.File;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
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 {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
static final Border RAISED_BORDER = BorderFactory.createCompoundBorder(
|
||||
BorderFactory.createRaisedBevelBorder(),
|
||||
BorderFactory.createEmptyBorder(1,1,1,1));
|
||||
static final Border RAISED_BORDER = BorderFactory.createCompoundBorder(
|
||||
BorderFactory.createRaisedBevelBorder(),
|
||||
BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
|
||||
static final Border NO_BORDER = new EmptyBorder(RAISED_BORDER.getBorderInsets(new JButton()));
|
||||
static final Border NO_BORDER = new EmptyBorder(RAISED_BORDER.getBorderInsets(new JButton()));
|
||||
|
||||
static final Border LOWERED_BORDER = BorderFactory.createCompoundBorder(
|
||||
BorderFactory.createLoweredBevelBorder(),
|
||||
BorderFactory.createEmptyBorder(1,1,1,1));
|
||||
static final Border LOWERED_BORDER = BorderFactory.createCompoundBorder(
|
||||
BorderFactory.createLoweredBevelBorder(),
|
||||
BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
|
||||
public FileChooserToggleButton(String text) {
|
||||
super(text);
|
||||
initBorder();
|
||||
}
|
||||
|
||||
|
||||
public FileChooserToggleButton(Action action) {
|
||||
super(action);
|
||||
initBorder();
|
||||
}
|
||||
|
||||
private void initBorder() {
|
||||
setForeground(Color.WHITE);
|
||||
setOpaque(true);
|
||||
setForeground(Colors.BACKGROUND);
|
||||
setOpaque(true);
|
||||
setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
setVerticalTextPosition(SwingConstants.BOTTOM);
|
||||
clearBorder();
|
||||
|
||||
clearBorder();
|
||||
|
||||
// prevents the WinXP LNF from painting its awkward borders
|
||||
setContentAreaFilled( false );
|
||||
|
||||
setContentAreaFilled(false);
|
||||
|
||||
// changes the border on hover and click
|
||||
addMouseListener(new ButtonMouseListener());
|
||||
|
||||
|
||||
// works in conjunction with the mouse listener to properly set the border
|
||||
addChangeListener( new ChangeListener() {
|
||||
public void stateChanged( ChangeEvent e ) {
|
||||
if ( isSelected() ) {
|
||||
setBorder( LOWERED_BORDER );
|
||||
}
|
||||
else {
|
||||
setBorder( NO_BORDER );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
setFocusable( false ); // this prevents the focus box from being drawn over the button
|
||||
addChangeListener(e -> {
|
||||
if (isSelected()) {
|
||||
setBorder(LOWERED_BORDER);
|
||||
}
|
||||
else {
|
||||
setBorder(NO_BORDER);
|
||||
}
|
||||
});
|
||||
|
||||
setFocusable(false); // this prevents the focus box from being drawn over the button
|
||||
}
|
||||
|
||||
void clearBorder() {
|
||||
@@ -83,52 +80,52 @@ public class FileChooserToggleButton extends JToggleButton {
|
||||
|
||||
/** Returns the directory with which this button is associated. */
|
||||
File getFile() {
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
private class ButtonMouseListener extends MouseAdapter {
|
||||
private boolean inside = false;
|
||||
|
||||
private Border defaultBorder;
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent me) {
|
||||
if ( isSelected() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
defaultBorder = getBorder();
|
||||
public void mouseEntered(MouseEvent me) {
|
||||
if (isSelected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
defaultBorder = getBorder();
|
||||
setBorder(RAISED_BORDER);
|
||||
inside = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent me) {
|
||||
if ( isSelected() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent me) {
|
||||
if (isSelected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
inside = false;
|
||||
restoreBorder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if ( isSelected() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (isSelected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.getButton() == MouseEvent.BUTTON1) {
|
||||
setBorder(LOWERED_BORDER);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if ( isSelected() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (isSelected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (inside) {
|
||||
setBorder(RAISED_BORDER);
|
||||
}
|
||||
@@ -136,14 +133,14 @@ public class FileChooserToggleButton extends JToggleButton {
|
||||
restoreBorder();
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreBorder() {
|
||||
if ( defaultBorder != null ) {
|
||||
setBorder(defaultBorder);
|
||||
}
|
||||
else {
|
||||
setBorder( NO_BORDER );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreBorder() {
|
||||
if (defaultBorder != null) {
|
||||
setBorder(defaultBorder);
|
||||
}
|
||||
else {
|
||||
setBorder(NO_BORDER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
|
||||
import docking.widgets.label.GDLabel;
|
||||
import generic.theme.GThemeDefaults.Colors.Java;
|
||||
import ghidra.util.Msg;
|
||||
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
|
||||
@Override
|
||||
public void requestFocus() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
nameField.requestFocus();
|
||||
}
|
||||
});
|
||||
SwingUtilities.invokeLater(() -> nameField.requestFocus());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -115,7 +111,7 @@ class FileEditor extends AbstractCellEditor implements TableCellEditor {
|
||||
// match the spacing of non-editing cells
|
||||
editor.setBorder(
|
||||
BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0),
|
||||
BorderFactory.createLineBorder(Color.GRAY)));
|
||||
BorderFactory.createLineBorder(Java.BORDER)));
|
||||
}
|
||||
|
||||
private void handleDoubleClick(Point p) {
|
||||
|
||||
+2
-1
@@ -37,6 +37,7 @@ import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.framework.OperatingSystem;
|
||||
import ghidra.framework.Platform;
|
||||
import ghidra.framework.preferences.Preferences;
|
||||
@@ -366,7 +367,7 @@ public class GhidraFileChooser extends DialogComponentProvider implements FileFi
|
||||
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.setBorder(BorderFactory.createLoweredBevelBorder());
|
||||
panel.setBackground(BACKGROUND_COLOR.darker());
|
||||
panel.setBackground(Palette.DARK_GRAY);
|
||||
panel.add(shortCutPanel, BorderLayout.NORTH);
|
||||
return panel;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.function.Function;
|
||||
import javax.swing.*;
|
||||
|
||||
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.
|
||||
@@ -94,7 +95,7 @@ public class GListCellRenderer<E> extends AbstractGCellRenderer implements ListC
|
||||
dropLocation.getIndex() == index);
|
||||
// @formatter:on
|
||||
if (isDropRow) {
|
||||
setBackground(Color.CYAN);
|
||||
setBackground(Palette.CYAN);
|
||||
}
|
||||
else {
|
||||
setBackground(getOSDependentBackgroundColor(list, index));
|
||||
|
||||
+5
-11
@@ -29,6 +29,7 @@ import docking.widgets.filechooser.GhidraFileChooser;
|
||||
import docking.widgets.filechooser.GhidraFileChooserMode;
|
||||
import docking.widgets.table.*;
|
||||
import generic.jar.ResourceFile;
|
||||
import generic.theme.GThemeDefaults.Colors.Tables;
|
||||
import generic.util.Path;
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.framework.preferences.Preferences;
|
||||
@@ -52,7 +53,6 @@ public class PathManager {
|
||||
private JButton downButton;
|
||||
private JButton addButton;
|
||||
private JButton removeButton;
|
||||
private Color selectionColor;
|
||||
private GhidraFileChooser fileChooser;
|
||||
private String preferenceForLastSelectedDir = Preferences.LAST_IMPORT_DIRECTORY;
|
||||
private String title = "Select File";
|
||||
@@ -102,8 +102,8 @@ public class PathManager {
|
||||
|
||||
/**
|
||||
* Add a new file path and set its enablement
|
||||
* @param file
|
||||
* @param enabled
|
||||
* @param file the file whose path to use
|
||||
* @param enabled true if enabled
|
||||
* @return true if the enabled path did not already exist
|
||||
*/
|
||||
public boolean addPath(ResourceFile file, boolean enabled) {
|
||||
@@ -127,9 +127,6 @@ public class PathManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the paths.
|
||||
*/
|
||||
public void setPaths(List<Path> paths) {
|
||||
pathModel.setPaths(paths);
|
||||
}
|
||||
@@ -164,8 +161,6 @@ public class PathManager {
|
||||
private void create(List<Path> paths) {
|
||||
panel = new JPanel(new BorderLayout(5, 5));
|
||||
|
||||
selectionColor = new Color(204, 204, 255);
|
||||
|
||||
if (allowOrdering) {
|
||||
upButton = new JButton(ResourceManager.loadImage("images/up.png"));
|
||||
upButton.setName("UpArrow");
|
||||
@@ -215,8 +210,6 @@ public class PathManager {
|
||||
|
||||
pathTable = new GTable(pathModel);
|
||||
pathTable.setName("PATH_TABLE");
|
||||
pathTable.setSelectionBackground(selectionColor);
|
||||
pathTable.setSelectionForeground(Color.BLACK);
|
||||
pathTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||
|
||||
//make the 'enabled' column very skinny...
|
||||
@@ -240,7 +233,8 @@ public class PathManager {
|
||||
if (column == PathManagerModel.COLUMN_PATH) {
|
||||
Path path = (Path) value;
|
||||
if (!isValidPath(path)) {
|
||||
renderer.setForeground(Color.RED);
|
||||
renderer.setForeground(data.isSelected() ? Tables.FG_ERROR_SELECTED
|
||||
: Tables.FG_ERROR_UNSELECTED);
|
||||
}
|
||||
}
|
||||
return renderer;
|
||||
|
||||
+5
-18
@@ -27,6 +27,7 @@ import docking.widgets.OptionDialog;
|
||||
import docking.widgets.filechooser.GhidraFileChooser;
|
||||
import docking.widgets.filechooser.GhidraFileChooserMode;
|
||||
import docking.widgets.table.*;
|
||||
import generic.theme.GThemeDefaults.Colors.Tables;
|
||||
import ghidra.framework.preferences.Preferences;
|
||||
import ghidra.util.filechooser.GhidraFileChooserModel;
|
||||
import ghidra.util.filechooser.GhidraFileFilter;
|
||||
@@ -54,7 +55,6 @@ public class PathnameTablePanel extends JPanel {
|
||||
private JButton addButton;
|
||||
private JButton removeButton;
|
||||
private JButton resetButton;
|
||||
private Color selectionColor;
|
||||
private GhidraFileChooser fileChooser;
|
||||
private String preferenceForLastSelectedDir = Preferences.LAST_IMPORT_DIRECTORY;
|
||||
private String title = "Select File";
|
||||
@@ -134,9 +134,6 @@ public class PathnameTablePanel extends JPanel {
|
||||
this.addToTop = addToTop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return paths in the table.
|
||||
*/
|
||||
public String[] getPaths() {
|
||||
String[] paths = new String[tableModel.getRowCount()];
|
||||
for (int i = 0; i < paths.length; i++) {
|
||||
@@ -145,16 +142,10 @@ public class PathnameTablePanel extends JPanel {
|
||||
return paths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the paths.
|
||||
*/
|
||||
public void setPaths(String[] paths) {
|
||||
tableModel.setPaths(paths);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the table in this path name panel.
|
||||
*/
|
||||
public JTable getTable() {
|
||||
return pathnameTable;
|
||||
}
|
||||
@@ -168,7 +159,6 @@ public class PathnameTablePanel extends JPanel {
|
||||
}
|
||||
|
||||
private void create() {
|
||||
selectionColor = new Color(204, 204, 255);
|
||||
|
||||
upButton = new JButton(ResourceManager.loadImage("images/up.png"));
|
||||
upButton.setName("UpArrow");
|
||||
@@ -222,8 +212,6 @@ public class PathnameTablePanel extends JPanel {
|
||||
pathnameTable.setShowGrid(false);
|
||||
|
||||
pathnameTable.setPreferredScrollableViewportSize(new Dimension(330, 200));
|
||||
pathnameTable.setSelectionBackground(selectionColor);
|
||||
pathnameTable.setSelectionForeground(Color.BLACK);
|
||||
pathnameTable.setTableHeader(null);
|
||||
pathnameTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||
JScrollPane scrollPane = new JScrollPane(pathnameTable);
|
||||
@@ -265,10 +253,7 @@ public class PathnameTablePanel extends JPanel {
|
||||
public Component getTableCellRendererComponent(GTableCellRenderingData data) {
|
||||
|
||||
JLabel label = (JLabel) super.getTableCellRendererComponent(data);
|
||||
|
||||
JTable table = data.getTable();
|
||||
Object value = data.getValue();
|
||||
boolean isSelected = data.isSelected();
|
||||
|
||||
String pathName = (String) value;
|
||||
|
||||
@@ -282,8 +267,10 @@ public class PathnameTablePanel extends JPanel {
|
||||
}
|
||||
|
||||
label.setText(pathName.toString());
|
||||
Color fg = isSelected ? table.getSelectionForeground() : table.getForeground();
|
||||
label.setForeground(!fileExists ? Color.RED : fg);
|
||||
if (!fileExists) {
|
||||
label.setForeground(data.isSelected() ? Tables.FG_ERROR_SELECTED
|
||||
: Tables.FG_ERROR_UNSELECTED);
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
+4
-1
@@ -27,6 +27,7 @@ import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
import docking.widgets.AbstractGCellRenderer;
|
||||
import generic.theme.GColor;
|
||||
import ghidra.docking.settings.*;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.AssertException;
|
||||
@@ -46,6 +47,8 @@ public class GTableCellRenderer extends AbstractGCellRenderer implements TableCe
|
||||
protected static final FloatingPointPrecisionSettingsDefinition FLOATING_POINT_PRECISION_SETTING =
|
||||
FloatingPointPrecisionSettingsDefinition.DEF;
|
||||
|
||||
private static final Color BG_DRAG = new GColor("color.bg.table.row.drag");
|
||||
|
||||
private static DecimalFormat decimalFormat;
|
||||
private static Map<Integer, DecimalFormat> decimalFormatCache;
|
||||
|
||||
@@ -157,7 +160,7 @@ public class GTableCellRenderer extends AbstractGCellRenderer implements TableCe
|
||||
setForegroundColor(table, model, value);
|
||||
|
||||
if (row == dropRow) {
|
||||
setBackground(Color.CYAN);
|
||||
setBackground(BG_DRAG);
|
||||
}
|
||||
else {
|
||||
setBackground(getOSDependentBackgroundColor(table, row));
|
||||
|
||||
+6
-2
@@ -23,9 +23,12 @@ import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import generic.theme.GColor;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
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 GTable ghidraTable;
|
||||
@@ -150,6 +153,7 @@ public class SelectColumnsDialog extends DialogComponentProvider {
|
||||
//==================================================================================================
|
||||
|
||||
private class ColumnSelectorStringRenderer extends GTableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(GTableCellRenderingData data) {
|
||||
|
||||
@@ -164,7 +168,7 @@ public class SelectColumnsDialog extends DialogComponentProvider {
|
||||
|
||||
TableColumnWrapper tableColumnWrapper = columnList.get(row);
|
||||
if (!tableColumnWrapper.isDefault()) {
|
||||
c.setBackground(c.getBackground().darker());
|
||||
c.setBackground(BG_NON_DEFAULT);
|
||||
c.setOpaque(true);
|
||||
}
|
||||
|
||||
@@ -188,7 +192,7 @@ public class SelectColumnsDialog extends DialogComponentProvider {
|
||||
|
||||
TableColumnWrapper tableColumnWrapper = columnList.get(row);
|
||||
if (!tableColumnWrapper.isDefault()) {
|
||||
c.setBackground(c.getBackground().darker());
|
||||
c.setBackground(BG_NON_DEFAULT);
|
||||
c.setOpaque(true);
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -33,6 +33,8 @@ import docking.widgets.table.GTableFilterPanel;
|
||||
import docking.widgets.table.RowObjectFilterModel;
|
||||
import docking.widgets.table.columnfilter.*;
|
||||
import docking.widgets.table.constrainteditor.ColumnConstraintEditor;
|
||||
import generic.theme.GThemeDefaults.Colors.Java;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import generic.util.WindowUtilities;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.Msg;
|
||||
@@ -369,7 +371,7 @@ public class ColumnFilterDialog<R> extends DialogComponentProvider
|
||||
|
||||
private GLabel createLogicalOperationLabel(LogicOperation op) {
|
||||
GLabel label = new GLabel("<" + op + ">", SwingConstants.CENTER);
|
||||
label.setForeground(Color.GRAY);
|
||||
label.setForeground(Messages.HINT);
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -381,7 +383,7 @@ public class ColumnFilterDialog<R> extends DialogComponentProvider
|
||||
headerPanel.add(new GLabel("Filter Value", SwingConstants.CENTER));
|
||||
|
||||
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)));
|
||||
return headerPanel;
|
||||
}
|
||||
@@ -475,5 +477,4 @@ public class ColumnFilterDialog<R> extends DialogComponentProvider
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -15,10 +15,9 @@
|
||||
*/
|
||||
package docking.widgets.table.constraint.dialog;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.BevelBorder;
|
||||
@@ -27,6 +26,7 @@ import docking.widgets.EmptyBorderButton;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import generic.theme.GThemeDefaults.Colors.Messages;
|
||||
import ghidra.util.layout.VerticalLayout;
|
||||
import resources.ResourceManager;
|
||||
|
||||
@@ -116,7 +116,7 @@ class ColumnFilterPanel extends JPanel {
|
||||
|
||||
private Component createOrLabel() {
|
||||
JLabel jLabel = new GDLabel("<OR>", SwingConstants.CENTER);
|
||||
jLabel.setForeground(Color.GRAY);
|
||||
jLabel.setForeground(Messages.HINT);
|
||||
return jLabel;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -18,11 +18,11 @@ package docking.widgets.table.constrainteditor;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.widgets.table.constraint.ColumnConstraint;
|
||||
import generic.theme.GColor;
|
||||
import generic.theme.GThemeDefaults.Colors;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.datastruct.WeakDataStructureFactory;
|
||||
@@ -44,9 +44,9 @@ public abstract class AbstractColumnConstraintEditor<T> implements ColumnConstra
|
||||
private boolean validEditorValue = false;
|
||||
|
||||
/** 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) */
|
||||
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.
|
||||
|
||||
+2
-1
@@ -31,6 +31,7 @@ import docking.widgets.DropDownTextField;
|
||||
import docking.widgets.DropDownTextFieldDataModel;
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import docking.widgets.table.constraint.*;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
/**
|
||||
@@ -214,7 +215,7 @@ public class AutocompletingStringConstraintEditor extends DataLoadingConstraintE
|
||||
private String formatListValue(String value, boolean isSelected) {
|
||||
|
||||
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>");
|
||||
// find and highlight all instances of the user-defined pattern
|
||||
while (matcher.find()) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user