GP-5947 - Created new theme value for the Decompiler's middle-mouse

highlight color so that the Listing and Decompiler colors may change
independently.
This commit is contained in:
dragonmacher
2025-08-22 18:00:48 -04:00
parent 4fcc1febdd
commit aae2843f4d
11 changed files with 86 additions and 52 deletions

View File

@@ -2,6 +2,7 @@
color.bg.byteviewer = color.bg
color.bg.byteviewer.highlight = yellow
color.bg.byteviewer.highlight.middle.mouse = color.bg.highlight
color.fg.byteviewer.separator = color.palette.blue
color.fg.byteviewer.changed = red

View File

@@ -58,9 +58,14 @@
<tr>
<td width="31%"> Non-Focus Cursor Color</td>
<td width="69%"> Th/e cursor color when the Byte Viewer is not focuses</td>
<td width="69%"> The cursor color when the Byte Viewer is not focuses</td>
</tr>
<tr>
<td width="31%"> Middle-Mouse Color</td>
<td width="69%"> The color when the user middle-mouses in the Byte Viewer</td>
</tr>
</tbody>
</table>
</div>

View File

@@ -86,6 +86,9 @@ public abstract class ByteViewerComponentProvider extends ComponentProviderAdapt
GhidraOptions.HIGHLIGHT_CURSOR_LINE_COLOR_OPTION_NAME;
private static final String OPTION_HIGHLIGHT_CURSOR_LINE =
GhidraOptions.HIGHLIGHT_CURSOR_LINE_OPTION_NAME;
private static final String OPTION_HIGHLIGHT_MIDDLE_MOUSE_NAME = "Middle Mouse Color";
private static final GColor HIGHLIGHT_MIDDLE_MOUSE_COLOR =
new GColor("color.bg.byteviewer.highlight.middle.mouse");
protected ByteViewerPanel panel;
@@ -182,7 +185,7 @@ public abstract class ByteViewerComponentProvider extends ComponentProviderAdapt
CURSOR_MOUSE_BUTTON_NAMES mouseButton = (CURSOR_MOUSE_BUTTON_NAMES) newValue;
panel.setHighlightButton(mouseButton.getMouseEventID());
}
else if (optionName.equals(HIGHLIGHT_COLOR_NAME)) {
else if (optionName.equals(OPTION_HIGHLIGHT_MIDDLE_MOUSE_NAME)) {
panel.setMouseButtonHighlightColor((Color) newValue);
}
}
@@ -219,15 +222,22 @@ public abstract class ByteViewerComponentProvider extends ComponentProviderAdapt
opt.registerThemeColorBinding(CURRENT_LINE_COLOR_OPTION_NAME,
GhidraOptions.DEFAULT_CURSOR_LINE_COLOR.getId(), help,
"Color of the line containing the cursor");
"Color of the line containing the cursor.");
opt.registerThemeColorBinding(OPTION_HIGHLIGHT_MIDDLE_MOUSE_NAME,
HIGHLIGHT_MIDDLE_MOUSE_COLOR.getId(), help, "The middle-mouse highlight color.");
opt.registerThemeFontBinding(OPTION_FONT, DEFAULT_FONT_ID, help, "Font used in the views.");
opt.registerOption(OPTION_HIGHLIGHT_CURSOR_LINE, true, help,
"Toggles highlighting background color of line containing the cursor");
"Toggles highlighting background color of line containing the cursor.");
Color separatorColor = opt.getColor(SEPARATOR_COLOR_OPTION_NAME, SEPARATOR_COLOR);
panel.setSeparatorColor(separatorColor);
Color middleMouseColor =
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);
@@ -246,9 +256,6 @@ public abstract class ByteViewerComponentProvider extends ComponentProviderAdapt
CURSOR_HIGHLIGHT_BUTTON_NAME, GhidraOptions.CURSOR_MOUSE_BUTTON_NAMES.MIDDLE);
panel.setHighlightButton(mouseButton.getMouseEventID());
panel.setMouseButtonHighlightColor(
opt.getColor(HIGHLIGHT_COLOR_NAME, DEFAULT_HIGHLIGHT_COLOR));
opt.addOptionsChangeListener(this);
}