- | Block Separator Color |
- Used to render gaps in memory, i.e., separators between memory blocks |
+ Block Separator Color |
+ Used to render gaps in memory, i.e., separators between memory blocks |
-
- | Current View Cursor Color |
- Used in the view that has focus |
-
-
- | Cursor Color |
- Used in the views that do not have focus |
-
-
- | Edit Cursor Color |
- Used to indicate changed bytes in memory; this color is
- used as the cursor color in those views that support editing |
-
-
- | Font |
- Font specified for all views |
-
-
-
- | Highlight Cursor Line |
- Highlights the line containing the cursor |
-
-
-
- | Highlight Cursor Line Color |
- The color of the highlight for the line containing the cursor |
-
-
-
- | Non-Focus Cursor Color |
- The cursor color when the Byte Viewer is not focuses |
-
-
- | Middle-Mouse Color |
- The color when the user middle-mouses in the Byte Viewer |
+ Edit Text Color |
+ Used to indicate changed bytes in memory. |
+
+
+ | Cursor Color Focused |
+ Used in the view that has focus |
+
+
+ | Cursor Color Unfocused |
+ Used in the views that do not have focus |
+
+
+ | Cursor Color Focused Edit |
+ Used in the view that has focus when in edit mode |
+
+
+ | Cursor Color Unfocused Edit |
+ Used in the views that do not have focus when in edit mode |
+
+
+ | Font |
+ Font specified for all views |
+
+
+ | Highlight Cursor Line |
+ Highlights the line containing the cursor |
+
+
+ | Highlight Cursor Line Color |
+ The color of the highlight for the line containing the cursor |
+
+
+ | Middle-Mouse Color |
+ The color when the user middle-mouses in the Byte Viewer |
diff --git a/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/The_Byte_Viewer.htm b/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/The_Byte_Viewer.htm
index daf7be9f7f..be229f4040 100644
--- a/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/The_Byte_Viewer.htm
+++ b/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/The_Byte_Viewer.htm
@@ -103,7 +103,7 @@
This format shows eight-byte numbers represented as an 16-digit hex number.
This view supports editing. When a byte
@@ -219,11 +219,11 @@
Cursor Colors
The format view that currently has focus shows its cursor in magenta. (Cursor colors can be changed via the black. (Cursor colors can be changed via the Options dialog) If
the byte editing is enabled and the view that is in focus supports
editing,
- then the cursor is red.
+ then the cursor is red.
diff --git a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponent.java b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponent.java
index 58136f0c14..0bf5c2b979 100644
--- a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponent.java
+++ b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponent.java
@@ -20,8 +20,6 @@ import java.awt.FontMetrics;
import java.awt.event.*;
import java.math.BigInteger;
-import javax.swing.SwingUtilities;
-
import docking.DockingUtils;
import docking.widgets.EventTrigger;
import docking.widgets.fieldpanel.FieldPanel;
@@ -33,6 +31,7 @@ import generic.theme.GColor;
import ghidra.app.plugin.core.format.*;
import ghidra.program.model.address.*;
import ghidra.util.Msg;
+import ghidra.util.Swing;
import help.Help;
import help.HelpService;
@@ -52,11 +51,17 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
private ProgramByteBlockSet blockSet;
private boolean consumeKeyStrokes;
- private boolean editMode; // true if this component is in edit mode;
- // cursor is different color.
- private Color editColor;
- private Color currentCursorColor;
- private Color currentCursorLineColor;
+ private boolean editMode; // true if this component is in edit mode; cursor is different color.
+
+ //@formatter:off
+ private Color editedTextColor = ByteViewerComponentProvider.EDITED_TEXT_COLOR;
+ private Color focusedEditCursorColor = ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_EDIT;
+ private Color unfocusedEditCursorColor = ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_EDIT;
+ private Color focusedNonEditCursorColor = ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT;
+ private Color unfocusedNonEditCursorColor = ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_NON_EDIT;
+ private Color currentCursorLineColor = ByteViewerComponentProvider.CURRENT_LINE_COLOR;
+ //@formatter:on
+
private ByteViewerLayoutModel layoutModel;
private boolean doingRefresh;
private boolean doingEdit;
@@ -151,9 +156,6 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
}
}
- /**
- * Called from the parent FieldPanel whenever the cursor position changes.
- */
@Override
public void fieldLocationChanged(FieldLocation loc, Field field, EventTrigger trigger) {
fieldLocationChanged(loc, field, false, trigger == EventTrigger.GUI_ACTION);
@@ -174,10 +176,10 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
//Set this component as the current view in the panel
panel.setCurrentView(ByteViewerComponent.this);
}
- // do the color update later because the field panel
- // listener is called after this one, and sets the
+
+ // Update later because the field panel listener is called after this one, and sets the
// colors incorrectly
- SwingUtilities.invokeLater(updateColorRunner);
+ Swing.runLater(updateColorRunner);
lastFieldLoc = loc;
@@ -308,7 +310,7 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
getToolkit().beep();
}
}
- catch (ByteBlockAccessException exc) {
+ catch (ByteBlockAccessException | NumberFormatException exc) {
panel.setStatusMessage("Editing not allowed: " + exc.getMessage());
getToolkit().beep();
@@ -358,19 +360,6 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
layoutModel.setIndexMap(indexMap);
}
- /**
- * Set the color used to denote changes in the byte block.
- * @param c the color for unsaved changed byte values
- */
- void setEditColor(Color c) {
- editColor = c;
- for (FieldFactory fieldFactorie : fieldFactories) {
- fieldFactorie.setEditColor(c);
- }
- layoutModel.layoutChanged();
- updateColor();
- }
-
void setHighlightButton(int highlightButton) {
this.highlightButton = highlightButton;
}
@@ -379,25 +368,6 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
highlightProvider.setHighlightColor(color);
}
- /**
- * Set the color for the component that has focus.
- *
- * @param c the color to set
- */
- void setCurrentCursorColor(Color c) {
- currentCursorColor = c;
- updateColor();
- }
-
- /**
- * Set the background color for the line containing the cursor.
- *
- * @param c the color to set
- */
- void setCurrentCursorLineColor(Color c) {
- currentCursorLineColor = c;
- }
-
/**
* Set the color for showing gaps in indexes.
*
@@ -414,8 +384,8 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
* Get the color of unsaved byte changes
* @return the color of unsaved byte changes
*/
- Color getEditColor() {
- return editColor;
+ Color getEditedTextColor() {
+ return editedTextColor;
}
void setIndexMap(IndexMap map) {
@@ -677,20 +647,26 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
return;
}
this.editMode = editMode;
- updateColor();
+ updateFocusedColor();
+ udpateNonFocusedColor();
}
- private void updateColor() {
+ private void updateFocusedColor() {
if (panel.getCurrentComponent() == this) {
if (editMode) {
- setFocusedCursorColor(editColor);
+ setFocusedCursorColor(focusedEditCursorColor);
}
else {
- setFocusedCursorColor(currentCursorColor);
+ setFocusedCursorColor(focusedNonEditCursorColor);
}
}
}
+ private void udpateNonFocusedColor() {
+ Color c = editMode ? unfocusedEditCursorColor : unfocusedNonEditCursorColor;
+ setNonFocusCursorColor(c);
+ }
+
boolean getEditMode() {
return editMode;
}
@@ -735,12 +711,12 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
createFields();
setCursorOn(true);
- editColor = ByteViewerComponentProvider.CHANGED_VALUE_COLOR;
- currentCursorColor = ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR;
- setNonFocusCursorColor(ByteViewerComponentProvider.CURSOR_NOT_FOCUSED_COLOR);
- setFocusedCursorColor(currentCursorColor);
+ editedTextColor = ByteViewerComponentProvider.EDITED_TEXT_COLOR;
- updateColorRunner = () -> updateColor();
+ setNonFocusCursorColor(ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_NON_EDIT);
+ setFocusedCursorColor(ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT);
+
+ updateColorRunner = () -> updateFocusedColor();
addMouseListener(new MouseAdapter() {
@Override
@@ -779,7 +755,7 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
fieldFactories[i] =
new FieldFactory(model, bytesPerLine, fieldOffset, fm, highlightProvider);
fieldOffset += model.getUnitByteSize();
- fieldFactories[i].setEditColor(editColor);
+ fieldFactories[i].setEditColor(editedTextColor);
fieldFactories[i].setIndexMap(indexMap);
}
layoutModel.setFactorys(fieldFactories, model, charWidth);
@@ -979,4 +955,5 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
}
}
+
}
diff --git a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponentProvider.java b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponentProvider.java
index a5845f8d69..184d303d45 100644
--- a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponentProvider.java
+++ b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponentProvider.java
@@ -25,7 +25,8 @@ import java.util.List;
import javax.swing.JComponent;
import docking.action.ToggleDockingAction;
-import generic.theme.*;
+import generic.theme.GColor;
+import generic.theme.GIcon;
import ghidra.GhidraOptions;
import ghidra.GhidraOptions.CURSOR_MOUSE_BUTTON_NAMES;
import ghidra.app.plugin.core.format.*;
@@ -63,10 +64,12 @@ public abstract class ByteViewerComponentProvider extends ComponentProviderAdapt
static final String CURSOR = "byteviewer.color.cursor";
static final GColor SEPARATOR_COLOR = new GColor("color.fg.byteviewer.separator");
- static final GColor CHANGED_VALUE_COLOR = new GColor("color.fg.byteviewer.changed");
- static final GColor CURSOR_ACTIVE_COLOR = new GColor("color.cursor.byteviewer.focused.active");
- static final GColor CURSOR_NON_ACTIVE_COLOR = new GColor("color.cursor.byteviewer.focused.not.active");
- static final GColor CURSOR_NOT_FOCUSED_COLOR = new GColor("color.cursor.byteviewer.unfocused");
+
+ static final GColor EDITED_TEXT_COLOR = new GColor("color.fg.byteviewer.changed");
+ static final GColor CURSOR_COLOR_FOCUSED_EDIT = new GColor("color.cursor.byteviewer.focused.edit");
+ static final GColor CURSOR_COLOR_UNFOCUSED_EDIT = new GColor("color.cursor.byteviewer.unfocused.edit");
+ static final GColor CURSOR_COLOR_FOCUSED_NON_EDIT = new GColor("color.cursor.byteviewer.focused.non.edit");
+ static final GColor CURSOR_COLOR_UNFOCUSED_NON_EDIT = new GColor("color.cursor.byteviewer.unfocused.non.edit");
static final GColor CURRENT_LINE_COLOR = GhidraOptions.DEFAULT_CURSOR_LINE_COLOR;
//@formatter:on
@@ -74,10 +77,11 @@ public abstract class ByteViewerComponentProvider extends ComponentProviderAdapt
static final String INDEX_COLUMN_NAME = "Addresses";
static final String SEPARATOR_COLOR_OPTION_NAME = "Block Separator Color";
- static final String CHANGED_VALUE_COLOR_OPTION_NAME = "Changed Values Color";
- static final String CURSOR_ACTIVE_COLOR_OPTION_NAME = "Active Cursor Color";
- static final String CURSOR_NON_ACTIVE_COLOR_OPTION_NAME = "Non-Active Cursor Color";
- static final String CURSOR_NOT_FOCUSED_COLOR_OPTION_NAME = "Non-Focused Cursor Color";
+ static final String EDIT_TEXT_COLOR_OPTION_NAME = "Edited Text Color";
+ static final String CURSOR_FOCUSED_COLOR_OPTION_NAME = "Cursor Color Focused";
+ static final String CURSOR_UNFOCUSED_COLOR_OPTION_NAME = "Cursor Color Unfocused";
+ static final String CURSOR_FOCUSED_EDIT_COLOR_OPTION_NAME = "Cursor Color Focused Edit";
+ static final String CURSOR_UNFOCUSED_EDIT_COLOR_OPTION_NAME = "Cursor Color Unfocused Edit";
static final String OPTION_FONT = "Font";
@@ -185,9 +189,6 @@ public abstract class ByteViewerComponentProvider extends ComponentProviderAdapt
CURSOR_MOUSE_BUTTON_NAMES mouseButton = (CURSOR_MOUSE_BUTTON_NAMES) newValue;
panel.setHighlightButton(mouseButton.getMouseEventID());
}
- else if (optionName.equals(OPTION_HIGHLIGHT_MIDDLE_MOUSE_NAME)) {
- panel.setMouseButtonHighlightColor((Color) newValue);
- }
}
}
@@ -206,19 +207,25 @@ public abstract class ByteViewerComponentProvider extends ComponentProviderAdapt
opt.registerThemeColorBinding(SEPARATOR_COLOR_OPTION_NAME, SEPARATOR_COLOR.getId(), help,
"Color used for separator shown between memory blocks.");
- opt.registerThemeColorBinding(CHANGED_VALUE_COLOR_OPTION_NAME, CHANGED_VALUE_COLOR.getId(),
+ opt.registerThemeColorBinding(EDIT_TEXT_COLOR_OPTION_NAME, EDITED_TEXT_COLOR.getId(),
new HelpLocation("ByteViewerPlugin", "EditColor"),
"Color of changed bytes when editing.");
- opt.registerThemeColorBinding(CURSOR_ACTIVE_COLOR_OPTION_NAME, CURSOR_ACTIVE_COLOR.getId(),
- help, "Color of cursor in the active view.");
+ opt.registerThemeColorBinding(CURSOR_FOCUSED_COLOR_OPTION_NAME,
+ CURSOR_COLOR_FOCUSED_NON_EDIT.getId(),
+ help, "Color of cursor in the focused view.");
- opt.registerThemeColorBinding(CURSOR_NON_ACTIVE_COLOR_OPTION_NAME,
- CURSOR_NON_ACTIVE_COLOR.getId(), help, "Color of cursor in the non-active views.");
+ opt.registerThemeColorBinding(CURSOR_UNFOCUSED_COLOR_OPTION_NAME,
+ CURSOR_COLOR_UNFOCUSED_NON_EDIT.getId(), help,
+ "Color of cursor in the unfocused views.");
- opt.registerThemeColorBinding(CURSOR_NOT_FOCUSED_COLOR_OPTION_NAME,
- CURSOR_NOT_FOCUSED_COLOR.getId(), help,
- "Color of cursor when the byteview does not have focus.");
+ opt.registerThemeColorBinding(CURSOR_FOCUSED_EDIT_COLOR_OPTION_NAME,
+ CURSOR_COLOR_FOCUSED_EDIT.getId(), help,
+ "Color of the cursor in the focused view when editing.");
+
+ opt.registerThemeColorBinding(CURSOR_UNFOCUSED_EDIT_COLOR_OPTION_NAME,
+ CURSOR_COLOR_UNFOCUSED_EDIT.getId(), help,
+ "Color of the cursor in the unfocused view when editing.");
opt.registerThemeColorBinding(CURRENT_LINE_COLOR_OPTION_NAME,
GhidraOptions.DEFAULT_CURSOR_LINE_COLOR.getId(), help,
@@ -238,16 +245,6 @@ public abstract class ByteViewerComponentProvider extends ComponentProviderAdapt
opt.getColor(OPTION_HIGHLIGHT_MIDDLE_MOUSE_NAME, HIGHLIGHT_MIDDLE_MOUSE_COLOR);
panel.setMouseButtonHighlightColor(middleMouseColor);
- panel.setCurrentCursorColor(CURSOR_ACTIVE_COLOR);
- panel.setNonFocusCursorColor(CURSOR_NOT_FOCUSED_COLOR);
- panel.setCursorColor(CURSOR_NON_ACTIVE_COLOR);
- panel.setCurrentCursorLineColor(CURRENT_LINE_COLOR);
-
- Font font = Gui.getFont(DEFAULT_FONT_ID);
- FontMetrics fm = panel.getFontMetrics(font);
-
- panel.restoreConfigState(fm, CHANGED_VALUE_COLOR);
-
opt.addOptionsChangeListener(this);
// cursor highlight options
@@ -308,8 +305,8 @@ public abstract class ByteViewerComponentProvider extends ComponentProviderAdapt
return offset;
}
- Color getCursorColor() {
- return CURSOR_NON_ACTIVE_COLOR;
+ Color getFocusedNonEditCursorColor() {
+ return CURSOR_COLOR_FOCUSED_NON_EDIT;
}
int getGroupSize() {
@@ -530,4 +527,5 @@ public abstract class ByteViewerComponentProvider extends ComponentProviderAdapt
public void removeDisplayListener(AddressSetDisplayListener listener) {
panel.removeDisplayListener(listener);
}
+
}
diff --git a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerPanel.java b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerPanel.java
index 3cdefa6907..56f1d59270 100644
--- a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerPanel.java
+++ b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerPanel.java
@@ -63,16 +63,13 @@ public class ByteViewerPanel extends JPanel implements LayoutModel, LayoutListen
private IndexMap indexMap; // maps indexes to the correct block and offset
private int blockOffset;
private ByteViewerComponent currentView;
- private Color editColor;
- private Color currentCursorColor;
- private Color currentCursorLineColor;
+
private Color highlightColor;
private int highlightButton;
private List layoutListeners = new ArrayList<>(1);
- private boolean addingView; // don't respond to cursor location
- // changes while this flag is true
- private final ByteViewerComponentProvider provider;
+ private boolean addingView; // don't respond to cursor location changes while this flag is true
+ private final ByteViewerComponentProvider provider;
private List displayListeners = new ArrayList<>();
private ByteViewerIndexedView indexedView;
@@ -83,7 +80,6 @@ public class ByteViewerPanel extends JPanel implements LayoutModel, LayoutListen
viewList = new ArrayList<>();
indexMap = new IndexMap();
create();
- editColor = ByteViewerComponentProvider.CHANGED_VALUE_COLOR;
}
@Override
@@ -115,20 +111,6 @@ public class ByteViewerPanel extends JPanel implements LayoutModel, LayoutListen
super.paintComponent(g);
}
- void setCurrentCursorColor(Color c) {
- currentCursorColor = c;
- for (ByteViewerComponent comp : viewList) {
- comp.setCurrentCursorColor(c);
- }
- }
-
- void setCurrentCursorLineColor(Color c) {
- currentCursorLineColor = c;
- for (ByteViewerComponent comp : viewList) {
- comp.setCurrentCursorLineColor(c);
- }
- }
-
void setHighlightButton(int highlightButton) {
this.highlightButton = highlightButton;
for (ByteViewerComponent comp : viewList) {
@@ -143,12 +125,6 @@ public class ByteViewerPanel extends JPanel implements LayoutModel, LayoutListen
}
}
- void setCursorColor(Color c) {
- for (ByteViewerComponent comp : viewList) {
- comp.setNonFocusCursorColor(c);
- }
- }
-
void setSeparatorColor(Color c) {
indexFactory.setMissingValueColor(c);
for (ByteViewerComponent comp : viewList) {
@@ -156,12 +132,6 @@ public class ByteViewerPanel extends JPanel implements LayoutModel, LayoutListen
}
}
- void setNonFocusCursorColor(Color c) {
- for (ByteViewerComponent comp : viewList) {
- comp.setNonFocusCursorColor(c);
- }
- }
-
/**
* Set the byte blocks and create an new IndexMap object that will be passed to the index panel
* and to each component that shows a format.
@@ -307,15 +277,11 @@ public class ByteViewerPanel extends JPanel implements LayoutModel, LayoutListen
if (viewList.size() != 0) {
addingView = true;
}
- final ViewerPosition vp = getViewerPosition();
- // create new ByteViewerComponent
+ ViewerPosition vp = getViewerPosition();
ByteViewerComponent c = newByteViewerComponent(model);
- c.setEditColor(editColor);
- c.setNonFocusCursorColor(ByteViewerComponentProvider.CURSOR_NOT_FOCUSED_COLOR);
- c.setCurrentCursorColor(currentCursorColor);
- c.setCurrentCursorLineColor(currentCursorLineColor);
+
c.setEditMode(editMode);
c.setIndexMap(indexMap);
c.setMouseButtonHighlightColor(highlightColor);
@@ -375,9 +341,6 @@ public class ByteViewerPanel extends JPanel implements LayoutModel, LayoutListen
}
void setCurrentView(ByteViewerComponent c) {
- if (currentView != null && currentView != c) {
- currentView.setFocusedCursorColor(provider.getCursorColor());
- }
currentView = c;
}
@@ -565,17 +528,6 @@ public class ByteViewerPanel extends JPanel implements LayoutModel, LayoutListen
indexPanel.setViewerPosition(vpos.getIndex(), vpos.getXOffset(), vpos.getYOffset());
}
- /**
- * Restore the configuration of the plugin.
- *
- * @param metrics font metrics
- * @param newEditColor color for showing edits
- */
- void restoreConfigState(FontMetrics metrics, Color newEditColor) {
- setFontMetrics(metrics);
- setEditColor(newEditColor);
- }
-
void restoreConfigState(int newBytesPerLine, int offset) {
if (blockOffset != offset) {
blockOffset = offset;
@@ -603,13 +555,6 @@ public class ByteViewerPanel extends JPanel implements LayoutModel, LayoutListen
indexPanel.modelSizeChanged(IndexMapper.IDENTITY_MAPPER);
}
- void setEditColor(Color editColor) {
- this.editColor = editColor;
- for (ByteViewerComponent c : viewList) {
- c.setEditColor(editColor);
- }
- }
-
protected FontMetrics getFontMetrics() {
return fontMetrics;
}
diff --git a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/FieldFactory.java b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/FieldFactory.java
index 68532fe051..f65b4a341f 100644
--- a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/FieldFactory.java
+++ b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/FieldFactory.java
@@ -4,9 +4,9 @@
* 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.
@@ -20,8 +20,8 @@ import java.awt.FontMetrics;
import java.math.BigInteger;
import docking.widgets.fieldpanel.field.Field;
-import docking.widgets.fieldpanel.support.Highlight;
import docking.widgets.fieldpanel.support.FieldHighlightFactory;
+import docking.widgets.fieldpanel.support.Highlight;
import ghidra.app.plugin.core.format.*;
import ghidra.program.model.address.AddressOutOfBoundsException;
@@ -46,12 +46,6 @@ class FieldFactory {
private int unitByteSize;
private FieldHighlightFactory highlightFactory;
- /**
- * Constructor
- * @param model data format model that knows how to represent the data
- * @param fieldCount number of fields in a row
- * @param label label that is used as a renderer in the field viewer
- */
FieldFactory(DataFormatModel model, int bytesPerLine, int fieldOffset, FontMetrics fm,
ByteViewerHighlighter highlightProvider) {
this.model = model;
@@ -60,20 +54,21 @@ class FieldFactory {
this.highlightFactory = new SimpleHighlightFactory(highlightProvider);
charWidth = fm.charWidth('W');
width = charWidth * model.getDataUnitSymbolSize();
- editColor = ByteViewerComponentProvider.CHANGED_VALUE_COLOR;
+ editColor = ByteViewerComponentProvider.EDITED_TEXT_COLOR;
separatorColor = ByteViewerComponentProvider.SEPARATOR_COLOR;
unitByteSize = model.getUnitByteSize();
}
/**
* Sets the starting x position for the fields generated by this factory.
+ * @param x the x position
*/
public void setStartX(int x) {
startX = x;
}
/**
- * Returns the starting x position for the fields generated by this factory.
+ * {@return the starting x position for the fields generated by this factory.}
*/
public int getStartX() {
return startX;
@@ -95,11 +90,6 @@ class FieldFactory {
return indexMap.getBlockInfo(index, fieldOffset) != null;
}
- /**
- * Gets a Field object for the given index.
- * This method is called for the given index and the fieldOffset
- * that is defined in the constructor.
- */
public Field getField(BigInteger index) {
if (indexMap == null) {
return null;
@@ -145,9 +135,6 @@ class FieldFactory {
}
}
- /**
- * Returns the width (in pixels) of the fields generated by this factory.
- */
public int getWidth() {
return width;
}
@@ -156,12 +143,10 @@ class FieldFactory {
return fm;
}
- ///////////////////////////////////////////////////////////////////
- // *** package-level methods
- ///////////////////////////////////////////////////////////////////
- /**
- * Set the index map.
- */
+//=================================================================================================
+// Package Methods
+//=================================================================================================
+
void setIndexMap(IndexMap indexMap) {
this.indexMap = indexMap;
if (indexMap != null) {
@@ -191,14 +176,12 @@ class FieldFactory {
/**
* Set the color used to denote changes.
+ * @param c the color
*/
void setEditColor(Color c) {
editColor = c;
}
- /**
- * Set the color that indicates gaps in memory.
- */
void setSeparatorColor(Color c) {
separatorColor = c;
}
diff --git a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/format/HexValueFormatModel.java b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/format/HexValueFormatModel.java
index 86215e4104..b6e9428348 100644
--- a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/format/HexValueFormatModel.java
+++ b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/format/HexValueFormatModel.java
@@ -4,9 +4,9 @@
* 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.
@@ -157,7 +157,8 @@ public abstract class HexValueFormatModel implements UniversalDataFormatModel {
@Override
public HelpLocation getHelpLocation() {
- return new HelpLocation("ByteViewerPlugin", "HexValue");
+ String anchor = name.replaceAll("\\s", "");
+ return new HelpLocation("ByteViewerPlugin", anchor);
}
@Override
diff --git a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerConnectedToolBehaviorTest.java b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerConnectedToolBehaviorTest.java
index b5b706e5e9..4a9422ff69 100644
--- a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerConnectedToolBehaviorTest.java
+++ b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerConnectedToolBehaviorTest.java
@@ -4,9 +4,9 @@
* 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.
@@ -174,7 +174,7 @@ public class ByteViewerConnectedToolBehaviorTest extends AbstractGhidraHeadedInt
ByteViewerComponent c2 = panel2.getCurrentComponent();
ByteField f2 = c2.getField(BigInteger.ZERO, 0);
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, f2.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, f2.getForeground());
}
@Test
@@ -204,7 +204,7 @@ public class ByteViewerConnectedToolBehaviorTest extends AbstractGhidraHeadedInt
ByteViewerComponent c2 = panel2.getCurrentComponent();
ByteField f2 = c2.getField(BigInteger.ZERO, 0);
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, f2.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, f2.getForeground());
undo(program);
diff --git a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java
index 62bec52378..9c2d1f0a28 100644
--- a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java
+++ b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPlugin2Test.java
@@ -119,18 +119,18 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
public void testEditModeHex() throws Exception {
env.showTool();
- ToggleDockingAction action =
+ ToggleDockingAction editAction =
(ToggleDockingAction) getAction(plugin, "Enable/Disable Byteviewer Editing");
FieldLocation loc = getFieldLocation(getAddr(0x01001000));
runSwing(() -> {
ByteViewerComponent c = panel.getCurrentComponent();
c.setCursorPosition(loc.getIndex(), loc.getFieldNum(), 0, 0);
- action.setSelected(true);
- action.actionPerformed(new DefaultActionContext());
+ editAction.setSelected(true);
+ editAction.actionPerformed(new DefaultActionContext());
});
- assertTrue(action.isSelected());
+ assertTrue(editAction.isSelected());
ByteViewerComponent c = panel.getCurrentComponent();
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, c.getFocusedCursorColor());
runSwing(() -> {
KeyEvent ev = new KeyEvent(c, 0, new Date().getTime(), 0, KeyEvent.VK_A, 'a');
@@ -141,15 +141,15 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
waitForSwing();
assertEquals((byte) 0xa0, program.getMemory().getByte(getAddr(0x01001000)));
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR,
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR,
((ByteField) c.getCurrentField()).getForeground());
runSwing(() -> {
- action.setSelected(false);
- action.actionPerformed(new DefaultActionContext());
+ editAction.setSelected(false);
+ editAction.actionPerformed(new DefaultActionContext());
});
- assertFalse(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
+ assertFalse(editAction.isSelected());
+ assertEquals(ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT,
c.getFocusedCursorColor());
}
@@ -176,7 +176,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
});
assertTrue(action.isSelected());
ByteViewerComponent c = panel.getCurrentComponent();
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, c.getFocusedCursorColor());
runSwing(() -> {
KeyEvent ev = new KeyEvent(c, 0, new Date().getTime(), 0, KeyEvent.VK_A, 'a');
@@ -189,7 +189,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
assertEquals(b, program.getMemory().getByte(addr));
Color fg = ((ByteField) c.getCurrentField()).getForeground();
if (fg != null) {
- assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR, fg);
+ assertEquals(ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT, fg);
}
Window w = windowForComponent(plugin.getProvider().getComponent());
String str = findLabelStr(w, "Tool Status");
@@ -234,7 +234,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
assertEquals((byte) 0xa0, program.getMemory().getByte(addr));
FieldLocation loc = getFieldLocation(addr);
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
}
@@ -277,21 +277,21 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
assertEquals((byte) 0xa0, program.getMemory().getByte(addr));
FieldLocation loc = getFieldLocation(addr);
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
ByteViewerComponent asciiC = findComponent(panel, "Ascii");
runSwing(() -> panel.setCurrentView(asciiC));
loc = getFieldLocation(addr);
field = asciiC.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
ByteViewerComponent hexIntC = findComponent(panel, "Hex Integer");
runSwing(() -> panel.setCurrentView(hexIntC));
loc = getFieldLocation(addr);
field = asciiC.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
}
@Test
@@ -330,7 +330,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
Color fg = field.getForeground();
assertTrue(fg == null ||
- ByteViewerComponentProvider.CURSOR_NON_ACTIVE_COLOR == field.getForeground());
+ ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_NON_EDIT == field.getForeground());
redo(program);
program.flushEvents();
@@ -338,7 +338,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
// field color should show edit color
loc = getFieldLocation(addr);
field = c.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
}
@@ -386,19 +386,19 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
FieldLocation loc2 = new FieldLocation(0, 1, 0, 0); // second byte on first line
undo(program);
- testFieldColor(loc1, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
- testFieldColor(loc2, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ testFieldColor(loc1, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
+ testFieldColor(loc2, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
undo(program);
- testFieldColor(loc1, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
- testFieldColor(loc2, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ testFieldColor(loc1, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
+ testFieldColor(loc2, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
undo(program);
- testFieldColor(loc1, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ testFieldColor(loc1, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
testFieldColor(loc2, null);
undo(program);
- testFieldColor(loc1, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ testFieldColor(loc1, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
testFieldColor(loc2, null);
undo(program);
@@ -407,24 +407,24 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
assertFalse(program.canUndo());
redo(program);
- testFieldColor(loc1, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ testFieldColor(loc1, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
testFieldColor(loc2, null);
redo(program);
- testFieldColor(loc1, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ testFieldColor(loc1, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
testFieldColor(loc2, null);
redo(program);
- testFieldColor(loc1, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
- testFieldColor(loc2, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ testFieldColor(loc1, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
+ testFieldColor(loc2, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
redo(program);
- testFieldColor(loc1, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
- testFieldColor(loc2, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ testFieldColor(loc1, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
+ testFieldColor(loc2, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
redo(program);
- testFieldColor(loc1, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
- testFieldColor(loc2, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ testFieldColor(loc1, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
+ testFieldColor(loc2, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
assertTrue(program.canUndo());
}
@@ -467,14 +467,14 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
Color fg = field.getForeground();
assertTrue(fg == null ||
- ByteViewerComponentProvider.CURSOR_NON_ACTIVE_COLOR == field.getForeground());
+ ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_NON_EDIT == field.getForeground());
redo(program);
// field color should show edit color
loc = getFieldLocation(addr);
field = c.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
}
@@ -516,14 +516,14 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
Color fg = field.getForeground();
assertTrue(fg == null ||
- ByteViewerComponentProvider.CURSOR_NON_ACTIVE_COLOR == field.getForeground());
+ ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_NON_EDIT == field.getForeground());
redo(program);
// field color should show edit color
loc = getFieldLocation(addr);
field = c.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
}
@@ -565,14 +565,14 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
Color fg = field.getForeground();
assertTrue(fg == null ||
- ByteViewerComponentProvider.CURSOR_NON_ACTIVE_COLOR == field.getForeground());
+ ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_NON_EDIT == field.getForeground());
redo(program);
// field color should show edit color
loc = getFieldLocation(addr);
field = c.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
}
@@ -614,14 +614,14 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
Color fg = field.getForeground();
assertTrue(fg == null ||
- ByteViewerComponentProvider.CURSOR_NON_ACTIVE_COLOR == field.getForeground());
+ ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_NON_EDIT == field.getForeground());
redo(program);
// field color should show edit color
loc = getFieldLocation(addr);
field = c.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
}
@@ -676,10 +676,11 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
Color fg = field.getForeground();
if (i == 2) {
assertTrue(fg == null ||
- ByteViewerComponentProvider.CURSOR_NON_ACTIVE_COLOR == field.getForeground());
+ ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_NON_EDIT == field
+ .getForeground());
}
else {
- assertEquals(fg, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ assertEquals(fg, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
}
}
assertFalse(program.canUndo());
@@ -691,7 +692,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
FieldLocation loc = c.getCursorLocation();
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
Color fg = field.getForeground();
- assertEquals(fg, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ assertEquals(fg, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
}
assertTrue(program.canUndo());
@@ -748,10 +749,11 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
Color fg = field.getForeground();
if (i == 4) {
assertTrue(fg == null ||
- ByteViewerComponentProvider.CURSOR_NON_ACTIVE_COLOR == field.getForeground());
+ ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_NON_EDIT == field
+ .getForeground());
}
else {
- assertEquals(fg, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ assertEquals(fg, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
}
}
assertFalse(program.canUndo());
@@ -763,7 +765,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
FieldLocation loc = c.getCursorLocation();
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
Color fg = field.getForeground();
- assertEquals(fg, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ assertEquals(fg, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
}
assertTrue(program.canUndo());
@@ -821,10 +823,11 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
Color fg = field.getForeground();
if (i == 8) {
assertTrue(fg == null ||
- ByteViewerComponentProvider.CURSOR_NON_ACTIVE_COLOR == field.getForeground());
+ ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_NON_EDIT == field
+ .getForeground());
}
else {
- assertEquals(fg, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ assertEquals(fg, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
}
}
assertFalse(program.canUndo());
@@ -836,7 +839,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
FieldLocation loc = c.getCursorLocation();
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
Color fg = field.getForeground();
- assertEquals(fg, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ assertEquals(fg, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
}
assertTrue(program.canUndo());
@@ -898,10 +901,11 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
Color fg = field.getForeground();
if (i == 16) {
assertTrue(fg == null ||
- ByteViewerComponentProvider.CURSOR_NON_ACTIVE_COLOR == field.getForeground());
+ ByteViewerComponentProvider.CURSOR_COLOR_UNFOCUSED_NON_EDIT == field
+ .getForeground());
}
else {
- assertEquals(fg, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ assertEquals(fg, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
}
}
assertFalse(program.canUndo());
@@ -913,7 +917,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
FieldLocation loc = c.getCursorLocation();
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
Color fg = field.getForeground();
- assertEquals(fg, ByteViewerComponentProvider.CHANGED_VALUE_COLOR);
+ assertEquals(fg, ByteViewerComponentProvider.EDITED_TEXT_COLOR);
}
assertTrue(program.canUndo());
@@ -933,7 +937,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
});
assertTrue(action.isSelected());
ByteViewerComponent c = panel.getCurrentComponent();
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, c.getFocusedCursorColor());
byte value = program.getMemory().getByte(getAddr(0x01001000));
runSwing(() -> {
KeyEvent ev = new KeyEvent(c, 0, new Date().getTime(), 0, KeyEvent.VK_P, 'p');
@@ -963,7 +967,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
});
waitForSwing();
assertTrue(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, c.getFocusedCursorColor());
runSwing(() -> {
KeyEvent ev = new KeyEvent(c, 0, new Date().getTime(), 0, KeyEvent.VK_Z, 'z');
@@ -974,14 +978,14 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
Address addr = getAddr(0x01001000);
assertEquals((byte) 0x7a, program.getMemory().getByte(addr));
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
runSwing(() -> {
action.setSelected(false);
action.actionPerformed(new DefaultActionContext());
});
assertFalse(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
+ assertEquals(ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT,
c.getFocusedCursorColor());
}
@@ -1003,7 +1007,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, c.getFocusedCursorColor());
runSwing(() -> {
FieldLocation loc = getFieldLocation(addr);
@@ -1016,14 +1020,14 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
assertEquals((byte) 0x40, program.getMemory().getByte(addr));
FieldLocation loc = getFieldLocation(addr);
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
runSwing(() -> {
action.setSelected(false);
action.actionPerformed(new DefaultActionContext());
});
assertFalse(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
+ assertEquals(ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT,
c.getFocusedCursorColor());
}
@@ -1045,7 +1049,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, c.getFocusedCursorColor());
byte value = program.getMemory().getByte(getAddr(0x01001000));
runSwing(() -> {
@@ -1075,7 +1079,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, c.getFocusedCursorColor());
runSwing(() -> {
KeyEvent ev = new KeyEvent(c, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
@@ -1084,7 +1088,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
});
program.flushEvents();
assertEquals((byte) 0x10, program.getMemory().getByte(getAddr(0x01001003)));
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR,
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR,
((ByteField) c.getCurrentField()).getForeground());
runSwing(() -> {
@@ -1092,7 +1096,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
action.actionPerformed(new DefaultActionContext());
});
assertFalse(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
+ assertEquals(ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT,
c.getFocusedCursorColor());
}
@@ -1114,7 +1118,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, c.getFocusedCursorColor());
runSwing(() -> {
KeyEvent ev = new KeyEvent(c, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
@@ -1123,7 +1127,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
});
program.flushEvents();
assertEquals((byte) 0x10, program.getMemory().getByte(getAddr(0x01001003)));
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR,
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR,
((ByteField) c.getCurrentField()).getForeground());
runSwing(() -> {
@@ -1131,7 +1135,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
action.actionPerformed(new DefaultActionContext());
});
assertFalse(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
+ assertEquals(ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT,
c.getFocusedCursorColor());
}
@@ -1153,7 +1157,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, c.getFocusedCursorColor());
runSwing(() -> {
KeyEvent ev = new KeyEvent(c, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
@@ -1162,7 +1166,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
});
program.flushEvents();
assertEquals((byte) 0x10, program.getMemory().getByte(getAddr(0x01001003)));
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR,
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR,
((ByteField) c.getCurrentField()).getForeground());
runSwing(() -> {
@@ -1170,7 +1174,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
action.actionPerformed(new DefaultActionContext());
});
assertFalse(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
+ assertEquals(ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT,
c.getFocusedCursorColor());
}
@@ -1192,7 +1196,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
action.actionPerformed(new DefaultActionContext());
});
assertTrue(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, c.getFocusedCursorColor());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, c.getFocusedCursorColor());
runSwing(() -> {
KeyEvent ev = new KeyEvent(c, 0, new Date().getTime(), 0, KeyEvent.VK_1, '1');
@@ -1201,7 +1205,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
});
program.flushEvents();
assertEquals((byte) 0x10, program.getMemory().getByte(getAddr(0x01001003)));
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR,
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR,
((ByteField) c.getCurrentField()).getForeground());
runSwing(() -> {
@@ -1209,7 +1213,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
action.actionPerformed(new DefaultActionContext());
});
assertFalse(action.isSelected());
- assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR,
+ assertEquals(ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT,
c.getFocusedCursorColor());
}
@@ -1260,7 +1264,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
// verify that the bytes are rendered in red
FieldLocation loc = getFieldLocation(addr);
ByteField field = c.getField(loc.getIndex(), loc.getFieldNum());
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR, field.getForeground());
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR, field.getForeground());
addr = addr.add(i);
}
}
@@ -1655,7 +1659,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
Options opt = tool.getOptions("ByteViewer");
// change the color for Current View Cursor Color
- putColor(opt, ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR_OPTION_NAME, Palette.GREEN);
+ putColor(opt, ByteViewerComponentProvider.CURSOR_FOCUSED_COLOR_OPTION_NAME, Palette.GREEN);
ByteViewerComponent c = panel.getCurrentComponent();
assertColorsEqual(Palette.GREEN, c.getFocusedCursorColor());
@@ -1675,7 +1679,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
Options opt = tool.getOptions("ByteViewer");
// change the color for Current View Cursor Color
- putColor(opt, ByteViewerComponentProvider.CURSOR_NOT_FOCUSED_COLOR_OPTION_NAME,
+ putColor(opt, ByteViewerComponentProvider.CURSOR_UNFOCUSED_COLOR_OPTION_NAME,
Palette.GREEN);
ByteViewerComponent c = findComponent(panel, "Octal");
@@ -1695,7 +1699,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
Options opt = tool.getOptions("ByteViewer");
// change the color for Current View Cursor Color
- putColor(opt, ByteViewerComponentProvider.CURSOR_NOT_FOCUSED_COLOR_OPTION_NAME,
+ putColor(opt, ByteViewerComponentProvider.CURSOR_UNFOCUSED_COLOR_OPTION_NAME,
Palette.CYAN);
ByteViewerComponent c = findComponent(panel, "Octal");
@@ -1716,7 +1720,7 @@ public class ByteViewerPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
Options opt = tool.getOptions("ByteViewer");
// change the color for Edit Color
- putColor(opt, ByteViewerComponentProvider.CHANGED_VALUE_COLOR_OPTION_NAME, Palette.GREEN);
+ putColor(opt, ByteViewerComponentProvider.EDIT_TEXT_COLOR_OPTION_NAME, Palette.GREEN);
FieldLocation loc = getFieldLocation(getAddr(0x01001000));
runSwing(() -> {
diff --git a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPluginFormatsTest.java b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPluginFormatsTest.java
index ff1b616d0b..fb37299228 100644
--- a/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPluginFormatsTest.java
+++ b/Ghidra/Features/ByteViewer/src/test.slow/java/ghidra/app/plugin/core/byteviewer/ByteViewerPluginFormatsTest.java
@@ -4,9 +4,9 @@
* 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.
@@ -292,7 +292,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
hexComp.setCursorPosition(l.getIndex(), l.getFieldNum(), 0, 0);
});
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR,
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR,
((ByteField) hexComp.getCurrentField()).getForeground());
}
@@ -351,7 +351,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
hexComp.setCursorPosition(l.getIndex(), l.getFieldNum(), 0, 0);
});
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR,
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR,
((ByteField) hexComp.getCurrentField()).getForeground());
}
@@ -410,7 +410,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
hexComp.setCursorPosition(l.getIndex(), l.getFieldNum(), 0, 0);
});
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR,
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR,
((ByteField) hexComp.getCurrentField()).getForeground());
}
@@ -469,7 +469,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
hexComp.setCursorPosition(l.getIndex(), l.getFieldNum(), 0, 0);
});
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR,
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR,
((ByteField) hexComp.getCurrentField()).getForeground());
}
@@ -519,7 +519,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
// does not support editing
Color fg = ((ByteField) c.getCurrentField()).getForeground();
if (fg != null) {
- assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR, fg);
+ assertEquals(ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT, fg);
}
}
@@ -568,7 +568,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
// does not support editing
Color fg = ((ByteField) c.getCurrentField()).getForeground();
if (fg != null) {
- assertEquals(ByteViewerComponentProvider.CURSOR_ACTIVE_COLOR, fg);
+ assertEquals(ByteViewerComponentProvider.CURSOR_COLOR_FOCUSED_NON_EDIT, fg);
}
}
@@ -613,7 +613,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
intComp.setCursorPosition(l.getIndex(), l.getFieldNum(), 0, 0);
});
// color should indicate the edit
- assertEquals(ByteViewerComponentProvider.CHANGED_VALUE_COLOR,
+ assertEquals(ByteViewerComponentProvider.EDITED_TEXT_COLOR,
((ByteField) intComp.getCurrentField()).getForeground());
}
@@ -930,7 +930,7 @@ public class ByteViewerPluginFormatsTest extends AbstractGhidraHeadedIntegration
Component[] c = container.getComponents();
for (Component element : c) {
if (element instanceof JLabel) {
- if (name.equals(((JLabel) element).getName())) {
+ if (name.equals(element.getName())) {
return ((JLabel) element).getText();
}
}
diff --git a/Ghidra/Framework/Docking/data/docking.theme.properties b/Ghidra/Framework/Docking/data/docking.theme.properties
index 6a5a5a27d3..20c347960b 100644
--- a/Ghidra/Framework/Docking/data/docking.theme.properties
+++ b/Ghidra/Framework/Docking/data/docking.theme.properties
@@ -20,7 +20,7 @@ color.fg.glasspane.message = color.palette.lightcornflowerblue
color.bg.selection = color.palette.palegreen
color.bg.highlight = color.palette.lemonchiffon
-color.bg.currentline = color.palette.aliceblue
+color.bg.currentline = color.palette.lightcyan
color.bg.find.highlight = #FFF38E // light yellow
color.bg.find.highlight.active = #FFC55B // light orange
@@ -197,6 +197,8 @@ color.bg.find.highlight.active = #BC7474 // rosybrown
color.bg.highlight = #67582A // olivish
+color.bg.currentline = ##393D64 // gray purple
+
color.bg.filechooser.shortcut = [color]system.color.bg.view
diff --git a/Ghidra/Framework/Gui/data/gui.palette.theme.properties b/Ghidra/Framework/Gui/data/gui.palette.theme.properties
index 3690974e47..d6611555e5 100644
--- a/Ghidra/Framework/Gui/data/gui.palette.theme.properties
+++ b/Ghidra/Framework/Gui/data/gui.palette.theme.properties
@@ -32,6 +32,7 @@ color.palette.khaki = khaki
color.palette.lavender = lavender
color.palette.lemonchiffon = lemonchiffon
color.palette.lightcoral = lightcoral
+color.palette.lightcyan = lightcyan
color.palette.lightgray = rgb(192, 192, 192)
color.palette.lightgreen = rgb(127, 255, 127)
color.palette.lightpink = lightpink