diff --git a/Ghidra/Features/Base/data/base.listing.theme.properties b/Ghidra/Features/Base/data/base.listing.theme.properties index f7f7fbcfa8..e4df5b84be 100644 --- a/Ghidra/Features/Base/data/base.listing.theme.properties +++ b/Ghidra/Features/Base/data/base.listing.theme.properties @@ -7,7 +7,7 @@ color.bg.highlight.listing = color.bg.highlight color.bg.highlight.listing.diff = moccasin // bisque / blanchedalmond / peachpuff / navajowhite -color.bg.listing.highlighter.default = color.palette.yellow +color.bg.listing.highlighter.middle.mouse = color.palette.yellow color.bg.listing.highlighter.scoped.read = color.palette.darkkhaki color.bg.listing.highlighter.scoped.write = color.palette.lightgreen @@ -116,7 +116,7 @@ font.listing.header = SansSerif-PLAIN-11 color.bg.highlight.listing.diff = #4D4D2A -color.bg.listing.highlighter.default = #666600 +color.bg.listing.highlighter.middle.mouse = #666600 color.bg.listing.highlighter.scoped.read = #996600 color.bg.listing.highlighter.scoped.write = #009900 diff --git a/Ghidra/Features/Base/src/main/help/help/topics/CodeBrowserPlugin/CodeBrowserOptions.htm b/Ghidra/Features/Base/src/main/help/help/topics/CodeBrowserPlugin/CodeBrowserOptions.htm index f08a3da4a8..4e0cecd1bd 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/CodeBrowserPlugin/CodeBrowserOptions.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/CodeBrowserPlugin/CodeBrowserOptions.htm @@ -498,14 +498,9 @@

Use the following options to customize Cursor Text Highlighting:

-

Alternate Highlight Color - Sets the alternate color used for cursor text - highlighting. Double click on the color bar to bring up a color chooser dialog.

+

Enabled - Select this checkbox to enable cursor text highlighting.

-

Enabled - Select this checkbox to enable cursor text highlighting.

- -

Highlight Color - Sets the color used for cursor text highlighting. Double click - on the color bar to bring up a color chooser dialog.
-
+

Mouse Button To Activate - Use the combo box to select which mouse button will be used to highlight text (Left, Right, Middle).

@@ -513,6 +508,24 @@ enable Scoped highlighting of registers within the operand field. If turned off, cursor highlighted text within an operand field is treated the same as text in other fields.

+ +

Scoped Default Color - Sets the color used for cursor text highlighting via + middle-mouse. Double-click on the color bar to bring up a color chooser dialog. +

+ +

Scoped Read Highlight Color - Sets the color used for cursor text highlighting a + register when the register value is read. The Scope Register Operand option + above must be on for this value to be used. + Double-click on the color bar to bring up a color chooser dialog. +

+ +

Scoped Write Highlight Color - Sets the color used for cursor text highlighting a + register when the register value is written to. The Scope Register Operand option + above must be on for this value to be used. + Double-click on the color bar to bring up a color chooser dialog. +

+ +

EOL Comments Field

diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/ListingMiddleMouseHighlightProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/ListingMiddleMouseHighlightProvider.java index 0996849560..0ce143b404 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/ListingMiddleMouseHighlightProvider.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/ListingMiddleMouseHighlightProvider.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. @@ -54,10 +54,11 @@ import ghidra.util.datastruct.Stack; public class ListingMiddleMouseHighlightProvider implements ButtonPressedListener, OptionsChangeListener, ListingHighlightProvider { //@formatter:off - private static final GColor DEFAULT_HIGHLIGHT_COLOR = new GColor("color.bg.listing.highlighter.default"); + private static final GColor DEFAULT_MIDDLE_MOUSE_HIGHLIGHT_COLOR = new GColor("color.bg.listing.highlighter.middle.mouse"); private static final GColor DEFAULT_SCOPED_READ_COLOR = new GColor("color.bg.listing.highlighter.scoped.read"); private static final GColor DEFAULT_SCOPED_WRITE_COLOR = new GColor("color.bg.listing.highlighter.scoped.write"); private static final String DISPLAY_HIGHLIGHT_NAME = CURSOR_HIGHLIGHT_GROUP + DELIMITER + "Enabled"; + private static final String SCOPED_DEFAULT_HIGHLIGHT_COLOR = CURSOR_HIGHLIGHT_GROUP + DELIMITER + "Scoped Default Color"; private static final String SCOPED_WRITE_HIGHLIGHT_COLOR = CURSOR_HIGHLIGHT_GROUP + DELIMITER + "Scoped Write Highlight Color"; private static final String SCOPED_READ_HIGHLIGHT_COLOR = CURSOR_HIGHLIGHT_GROUP + DELIMITER + "Scoped Read Highlight Color"; private static final String SCOPE_REGISTER_OPERAND = CURSOR_HIGHLIGHT_GROUP + DELIMITER + "Scope Register Operand"; @@ -873,8 +874,9 @@ public class ListingMiddleMouseHighlightProvider ToolOptions opt = tool.getOptions(CATEGORY_BROWSER_FIELDS); HelpLocation hl = new HelpLocation("CodeBrowserPlugin", "Cursor_Text_Highlight"); - opt.registerThemeColorBinding(HIGHLIGHT_COLOR_NAME, DEFAULT_HIGHLIGHT_COLOR.getId(), hl, - "The color to use to highlight text."); + opt.registerThemeColorBinding(SCOPED_DEFAULT_HIGHLIGHT_COLOR, + DEFAULT_MIDDLE_MOUSE_HIGHLIGHT_COLOR.getId(), hl, + "The color to use to highlight the register text."); opt.registerThemeColorBinding(SCOPED_WRITE_HIGHLIGHT_COLOR, DEFAULT_SCOPED_WRITE_COLOR.getId(), hl, "The color to use for showing a register being written."); @@ -892,32 +894,24 @@ public class ListingMiddleMouseHighlightProvider opt.addOptionsChangeListener(this); - ///////////////////////////////////////////////////// - displayHighlight = opt.getBoolean(DISPLAY_HIGHLIGHT_NAME, true); if (!displayHighlight) { setHighlightString(null, null); } - textMatchingHighlightColor = opt.getColor(HIGHLIGHT_COLOR_NAME, DEFAULT_HIGHLIGHT_COLOR); + textMatchingHighlightColor = + opt.getColor(SCOPED_DEFAULT_HIGHLIGHT_COLOR, DEFAULT_MIDDLE_MOUSE_HIGHLIGHT_COLOR); scopeWriteHighlightColor = opt.getColor(SCOPED_WRITE_HIGHLIGHT_COLOR, DEFAULT_SCOPED_WRITE_COLOR); scopeReadHighlightColor = opt.getColor(SCOPED_READ_HIGHLIGHT_COLOR, DEFAULT_SCOPED_READ_COLOR); - ///////////////////////////////////////////////////// - CURSOR_MOUSE_BUTTON_NAMES mouseButton = opt.getEnum(CURSOR_HIGHLIGHT_BUTTON_NAME, CURSOR_MOUSE_BUTTON_NAMES.MIDDLE); highlightButtonOption = mouseButton.getMouseEventID(); - - ////////////////////////////////////////////////////// - scopeRegisterHighlight = opt.getBoolean(SCOPE_REGISTER_OPERAND, true); - ////////////////////////////////////////////////////// - opt.addOptionsChangeListener(this); } @@ -931,7 +925,7 @@ public class ListingMiddleMouseHighlightProvider clearHighlight(); } } - else if (optionName.equals(HIGHLIGHT_COLOR_NAME)) { + else if (optionName.equals(SCOPED_DEFAULT_HIGHLIGHT_COLOR)) { textMatchingHighlightColor = (Color) newValue; } else if (optionName.equals(SCOPED_WRITE_HIGHLIGHT_COLOR)) { diff --git a/Ghidra/Features/ByteViewer/data/byteviewer.theme.properties b/Ghidra/Features/ByteViewer/data/byteviewer.theme.properties index 1c7f1b8385..094ef01334 100644 --- a/Ghidra/Features/ByteViewer/data/byteviewer.theme.properties +++ b/Ghidra/Features/ByteViewer/data/byteviewer.theme.properties @@ -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 diff --git a/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/ByteViewerOptions.htm b/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/ByteViewerOptions.htm index 94913e4636..f6f02a8fda 100644 --- a/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/ByteViewerOptions.htm +++ b/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/ByteViewerOptions.htm @@ -58,9 +58,14 @@ Non-Focus Cursor Color - Th/e cursor color when the Byte Viewer is not focuses + The cursor color when the Byte Viewer is not focuses - + + + Middle-Mouse Color + The color when the user middle-mouses in the Byte Viewer + + 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 fc672cb1f2..a5845f8d69 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 @@ -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); } diff --git a/Ghidra/Features/Decompiler/data/decompiler.theme.properties b/Ghidra/Features/Decompiler/data/decompiler.theme.properties index a88ebb7d94..816d20be6f 100644 --- a/Ghidra/Features/Decompiler/data/decompiler.theme.properties +++ b/Ghidra/Features/Decompiler/data/decompiler.theme.properties @@ -16,6 +16,7 @@ color.fg.decompiler.external.function = color.palette.fuchsia color.bg.decompiler.current.variable = color.palette.highlight.transparent.yellow +color.bg.decompiler.highlights.middle.mouse = color.bg.highlight color.bg.decompiler.highlights.default = color.palette.highlight.transparent.yellow color.bg.decompiler.highlights.special = color.palette.crimson color.bg.decompiler.highlights.find = color.palette.slateblue diff --git a/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xml b/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xml index 5e8d0542ba..a26cb55afb 100644 --- a/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xml +++ b/Ghidra/Features/Decompiler/src/main/doc/decompileplugin.xml @@ -3348,6 +3348,14 @@ + + Color for Highlighting Middle-mouse Matches + + + Assign the background color used to highlight characters when highlighting using the middle-mouse button. + + + Comment line indent level diff --git a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerOptions.html b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerOptions.html index a59fceb8df..87349ea37c 100644 --- a/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerOptions.html +++ b/Ghidra/Features/Decompiler/src/main/help/help/topics/DecompilePlugin/DecompilerOptions.html @@ -534,6 +534,16 @@ (see Find...).

+ +
+ Color for Highlighting Middle-mouse Matches +
+
+

+ Assign the background color used to highlight characters when highlighting using the middle-mouse button. +

+
+
Comment line indent level
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileOptions.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileOptions.java index 25a3d543b1..ffd97c4953 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileOptions.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileOptions.java @@ -26,7 +26,6 @@ import java.io.IOException; import generic.theme.GColor; import generic.theme.Gui; -import ghidra.GhidraOptions; import ghidra.GhidraOptions.CURSOR_MOUSE_BUTTON_NAMES; import ghidra.app.util.HelpTopics; import ghidra.app.util.template.TemplateSimplifier; @@ -444,6 +443,9 @@ public class DecompileOptions { private static final String SEARCH_HIGHLIGHT_MSG = "Display.Color for Highlighting Find Matches"; private static final GColor SEARCH_HIGHLIGHT_COLOR = new GColor("color.bg.decompiler.highlights.find"); + + private static final String HIGHLIGHT_MIDDLE_MOUSE_MSG = "Display.Color for Middle Mouse"; + private static final GColor HIGHLIGHT_MIDDLE_MOUSE_COLOR = new GColor("color.bg.decompiler.highlights.middle.mouse"); //@formatter:on private static final String BACKGROUND_COLOR_MSG = "Display.Background Color"; @@ -467,6 +469,7 @@ public class DecompileOptions { private final static String MAX_INSTRUCTIONS = "Max Instructions per Function"; private final static String MAX_JUMPTABLE_ENTRIES = "Max Entries per Jumptable"; private final static Boolean LINE_NUMBER_DEF = Boolean.TRUE; + private boolean displayLineNumbers; private int decompileTimeoutSeconds; private int payloadLimitMBytes; @@ -791,14 +794,20 @@ public class DecompileOptions { "The maximum size of the decompiler result payload in MBYtes (Suggested value: 50)."); opt.registerOption(MAX_INSTRUCTIONS, SUGGESTED_MAX_INSTRUCTIONS, new HelpLocation(HelpTopics.DECOMPILER, "GeneralMaxInstruction"), - "The maximum number of instructions decompiled in a single function"); + "The maximum number of instructions decompiled in a single function."); opt.registerOption(MAX_JUMPTABLE_ENTRIES, SUGGESTED_MAX_JUMPTABLE_ENTRIES, new HelpLocation(HelpTopics.DECOMPILER, "GeneralMaxJumptable"), - "The maximum number of entries that can be recovered from a single jumptable"); + "The maximum number of entries that can be recovered from a single jumptable."); opt.registerThemeColorBinding(HIGHLIGHT_CURRENT_VARIABLE_MSG, HIGHLIGHT_CURRENT_VARIABLE_COLOR.getId(), new HelpLocation(HelpTopics.DECOMPILER, "DisplayCurrentHighlight"), - "Current variable highlight"); + "Current variable highlight."); + + opt.registerThemeColorBinding(HIGHLIGHT_MIDDLE_MOUSE_MSG, + HIGHLIGHT_MIDDLE_MOUSE_COLOR.getId(), + new HelpLocation(HelpTopics.DECOMPILER, "MiddleMouseColor"), + "The middle-mouse highlight color."); + opt.registerOption(CACHED_RESULTS_SIZE_MSG, SUGGESTED_CACHED_RESULTS_SIZE, new HelpLocation(HelpTopics.DECOMPILER, "GeneralCacheSize"), CACHE_RESULTS_DESCRIPTION); grabFromToolAndProgram(fieldOptions, opt, program); @@ -1122,7 +1131,7 @@ public class DecompileOptions { * @return color used to highlight token(s) selected with a middle button clock */ public Color getMiddleMouseHighlightColor() { - return GhidraOptions.DEFAULT_HIGHLIGHT_COLOR; + return HIGHLIGHT_MIDDLE_MOUSE_COLOR; } /** diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/dialog/ManagePluginsDialog.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/dialog/ManagePluginsDialog.java index de5653df0e..2ba35d9df8 100644 --- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/dialog/ManagePluginsDialog.java +++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/dialog/ManagePluginsDialog.java @@ -31,9 +31,7 @@ import ghidra.framework.plugintool.PluginConfigurationModel; import ghidra.framework.plugintool.PluginTool; import ghidra.framework.plugintool.util.PluginPackage; import ghidra.util.HelpLocation; -import ghidra.util.Msg; import resources.Icons; -import utilities.util.reflection.ReflectionUtilities; public class ManagePluginsDialog extends ReusableDialogComponentProvider { @@ -147,18 +145,6 @@ public class ManagePluginsDialog extends ReusableDialogComponentProvider { public boolean isEnabledForContext(ActionContext context) { return true; } - - @Override - public void setEnabled(boolean newValue) { - - if (!newValue) { - Msg.debug(this, "disable Save As...", - ReflectionUtilities.createJavaFilteredThrowable()); - } - - super.setEnabled(newValue); - } - }; icon = Icons.SAVE_AS_ICON; saveAsAction