diff --git a/Ghidra/Debug/Debugger/src/main/help/help/shared/Frontpage.css b/Ghidra/Debug/Debugger/src/main/help/help/shared/Frontpage.css index c8616e85e8..ff855bae04 100644 --- a/Ghidra/Debug/Debugger/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Debug/Debugger/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/framework/options/AutoOptions.java b/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/framework/options/AutoOptions.java index 13dd374b27..c364441fed 100644 --- a/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/framework/options/AutoOptions.java +++ b/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/framework/options/AutoOptions.java @@ -27,6 +27,7 @@ import org.apache.commons.lang3.StringUtils; import com.google.common.collect.ImmutableList; import generic.ComparableTupleRecord; +import generic.theme.GColor; import ghidra.framework.options.annotation.*; import ghidra.framework.plugintool.Plugin; import ghidra.framework.plugintool.PluginTool; @@ -165,6 +166,7 @@ public interface AutoOptions { catch (IllegalArgumentException | IllegalAccessException e) { throw new AssertionError(e); } + OptionType type = annotation.type(); if (type == OptionType.NO_TYPE) { type = OptionType.getOptionType(defaultValue); @@ -175,6 +177,7 @@ public interface AutoOptions { "Could not determine option type from default value: " + f + " = " + defaultValue); } + String description = annotation.description(); Class editorClass = annotation.editor(); final PropertyEditor editor; @@ -191,7 +194,26 @@ public interface AutoOptions { "editor class must have accessible default constructor", e); } } - options.registerOption(key.getName(), type, defaultValue, help, description, editor); + + if (defaultValue instanceof GColor gColor) { + options.registerThemeColorBinding(key.getName(), gColor.getId(), help, description); + } + /* + else if ( is font option ) { + + // Note: there is no font value to check against for fonts in the new Theme system. + // If annotation fonts are needed, then they should be bound by String id. Likely, + // annotation fonts are not needed now that have themes. We also probably no + // longer need annotation colors either. + + options.registerThemeFontBinding(description, fontId, help, description); + } + */ + else { + options.registerOption(key.getName(), type, defaultValue, help, description, + editor); + } + // TODO: Wish Ghidra would do this upon any option registration options.putObject(key.getName(), defaultValue, type); } diff --git a/Ghidra/Extensions/SampleTablePlugin/certification.manifest b/Ghidra/Extensions/SampleTablePlugin/certification.manifest index c982dd70ad..dc315f04e3 100644 --- a/Ghidra/Extensions/SampleTablePlugin/certification.manifest +++ b/Ghidra/Extensions/SampleTablePlugin/certification.manifest @@ -3,7 +3,7 @@ ##MODULE IP: Oxygen Icons - LGPL 3.0 Module.manifest||GHIDRA||reviewed||END| data/ExtensionPoint.manifest||GHIDRA||||END| -data/sample.plugin.theme.properties||GHIDRA||||END| +data/sampletableplugin.theme.properties||GHIDRA||||END| extension.properties||GHIDRA||||END| src/main/help/help/TOC_Source.xml||GHIDRA||||END| src/main/help/help/shared/arrow.gif||GHIDRA||reviewed||END| diff --git a/Ghidra/Extensions/SampleTablePlugin/data/sample.plugin.theme.properties b/Ghidra/Extensions/SampleTablePlugin/data/sampletableplugin.theme.properties similarity index 100% rename from Ghidra/Extensions/SampleTablePlugin/data/sample.plugin.theme.properties rename to Ghidra/Extensions/SampleTablePlugin/data/sampletableplugin.theme.properties diff --git a/Ghidra/Extensions/SampleTablePlugin/src/main/help/help/shared/Frontpage.css b/Ghidra/Extensions/SampleTablePlugin/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Extensions/SampleTablePlugin/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Extensions/SampleTablePlugin/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Extensions/sample/src/main/help/help/shared/Frontpage.css b/Ghidra/Extensions/sample/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Extensions/sample/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Extensions/sample/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/Base/certification.manifest b/Ghidra/Features/Base/certification.manifest index 30d629f544..11ab2393b2 100644 --- a/Ghidra/Features/Base/certification.manifest +++ b/Ghidra/Features/Base/certification.manifest @@ -20,7 +20,6 @@ data/base.icons.theme.properties||GHIDRA||||END| data/base.listing.theme.properties||GHIDRA||||END| data/base.programgraph.theme.properties||GHIDRA||||END| data/base.theme.properties||GHIDRA||||END| -data/file_extension_icons.xml||GHIDRA||||END| data/functionTags.xml||GHIDRA||||END| data/ms_pe_rich_products.xml||GHIDRA||||END| data/noReturnFunctionConstraints.xml||GHIDRA||||END| @@ -81,7 +80,7 @@ data/symbols/win64/mfc80u.exports||GHIDRA||||END| data/symbols/win64/mfc90.exports||GHIDRA||||END| data/symbols/win64/mfc90u.exports||GHIDRA||||END| data/symbols/win64/msvcrt.hints||GHIDRA||||END| -data/typeinfo/file.extensions.icons.theme.properties||GHIDRA||||END| +data/typeinfo/base.file.extensions.icons.theme.properties||GHIDRA||||END| data/typeinfo/generic/generic_clib.gdt||GHIDRA||||END| data/typeinfo/generic/generic_clib_64.gdt||GHIDRA||||END| data/typeinfo/mac_10.9/mac_osx.gdt||GHIDRA||||END| diff --git a/Ghidra/Features/Base/data/file_extension_icons.xml b/Ghidra/Features/Base/data/file_extension_icons.xml deleted file mode 100644 index a7c59dcf98..0000000000 --- a/Ghidra/Features/Base/data/file_extension_icons.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Ghidra/Features/Base/data/typeinfo/file.extensions.icons.theme.properties b/Ghidra/Features/Base/data/typeinfo/base.file.extensions.icons.theme.properties similarity index 98% rename from Ghidra/Features/Base/data/typeinfo/file.extensions.icons.theme.properties rename to Ghidra/Features/Base/data/typeinfo/base.file.extensions.icons.theme.properties index bd4f7ddfea..9554e479de 100644 --- a/Ghidra/Features/Base/data/typeinfo/file.extensions.icons.theme.properties +++ b/Ghidra/Features/Base/data/typeinfo/base.file.extensions.icons.theme.properties @@ -1,6 +1,5 @@ [Defaults] - // Only single level file exts supported right now icon.fsbrowser.file.extension.default = images/famfamfam_silk_icons_v013/page_white.png icon.fsbrowser.file.extension.apk = images/famfamfam_silk_icons_v013/package.png icon.fsbrowser.file.extension.c = images/text-x-csrc.png diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java index 5b476a5488..0f0ddb2889 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/AbstractCodeBrowserPlugin.java @@ -62,15 +62,17 @@ public abstract class AbstractCodeBrowserPlugin

ex implements CodeViewerService, CodeFormatService, OptionsChangeListener, FormatModelListener, DomainObjectListener, CodeBrowserPluginInterface { - private static final String CURSOR_COLOR = "Cursor.Cursor Color - Focused"; - private static final String UNFOCUSED_CURSOR_COLOR = "Cursor.Cursor Color - Unfocused"; - private static final String BLINK_CURSOR = "Cursor.Blink Cursor"; - private static final String MOUSE_WHEEL_HORIZONTAL_SCROLLING = "Mouse.Horizontal Scrolling"; + private static final String CURSOR_COLOR_OPTIONS_NAME = "Cursor.Cursor Color - Focused"; + private static final String UNFOCUSED_CURSOR_COLOR_OPTIONS_NAME = + "Cursor.Cursor Color - Unfocused"; + private static final String BLINK_CURSOR_OPTIONS_NAME = "Cursor.Blink Cursor"; + private static final String MOUSE_WHEEL_HORIZONTAL_SCROLLING_OPTIONS_NAME = + "Mouse.Horizontal Scrolling"; //@formatter:off - public static final GColor IFOCUSED_CURSOR_COLOR = new GColor("color.cursor.focused.listing"); - public static final GColor IUNFOCUSED_CURSOR_COLOR = new GColor("color.cursor.unfocused.listing"); - public static final GColor ICURRENT_LINE_HIGHLIGHT_COLOR = new GColor("color.bg.currentline.listing"); + private static final GColor FOCUSED_CURSOR_COLOR = new GColor("color.cursor.focused.listing"); + private static final GColor UNFOCUSED_CURSOR_COLOR = new GColor("color.cursor.unfocused.listing"); + private static final GColor CURRENT_LINE_HIGHLIGHT_COLOR = new GColor("color.bg.currentline.listing"); //@formatter:on // - Icon - @@ -412,15 +414,15 @@ public abstract class AbstractCodeBrowserPlugin

ex highlightMarkers.setMarkerColor(color); } } - else if (optionName.equals(CURSOR_COLOR)) { + else if (optionName.equals(CURSOR_COLOR_OPTIONS_NAME)) { Color color = ((Color) newValue); fieldPanel.setFocusedCursorColor(color); } - else if (optionName.equals(UNFOCUSED_CURSOR_COLOR)) { + else if (optionName.equals(UNFOCUSED_CURSOR_COLOR_OPTIONS_NAME)) { Color color = ((Color) newValue); fieldPanel.setNonFocusCursorColor(color); } - else if (optionName.equals(BLINK_CURSOR)) { + else if (optionName.equals(BLINK_CURSOR_OPTIONS_NAME)) { Boolean isBlinkCursor = ((Boolean) newValue); fieldPanel.setBlinkCursor(isBlinkCursor); } @@ -436,7 +438,7 @@ public abstract class AbstractCodeBrowserPlugin

ex currentCursorMarkers.setColoringBackground(isHighlightCursorLine); } } - else if (optionName.equals(MOUSE_WHEEL_HORIZONTAL_SCROLLING)) { + else if (optionName.equals(MOUSE_WHEEL_HORIZONTAL_SCROLLING_OPTIONS_NAME)) { fieldPanel.setHorizontalScrollingEnabled((Boolean) newValue); } @@ -560,23 +562,25 @@ public abstract class AbstractCodeBrowserPlugin

ex GhidraOptions.DEFAULT_HIGHLIGHT_COLOR.getId(), helpLocation, "The highlight color in the browser."); - fieldOptions.registerThemeColorBinding(CURSOR_COLOR, IFOCUSED_CURSOR_COLOR.getId(), + fieldOptions.registerThemeColorBinding(CURSOR_COLOR_OPTIONS_NAME, + FOCUSED_CURSOR_COLOR.getId(), helpLocation, "The color of the cursor in the browser."); - fieldOptions.registerThemeColorBinding(UNFOCUSED_CURSOR_COLOR, - IUNFOCUSED_CURSOR_COLOR.getId(), + fieldOptions.registerThemeColorBinding(UNFOCUSED_CURSOR_COLOR_OPTIONS_NAME, + UNFOCUSED_CURSOR_COLOR.getId(), helpLocation, "The color of the cursor in the browser when the browser does not have focus."); - fieldOptions.registerOption(BLINK_CURSOR, true, helpLocation, + fieldOptions.registerOption(BLINK_CURSOR_OPTIONS_NAME, true, helpLocation, "When selected, the cursor will blink when the containing window is focused."); fieldOptions.registerThemeColorBinding(GhidraOptions.HIGHLIGHT_CURSOR_LINE_COLOR, - ICURRENT_LINE_HIGHLIGHT_COLOR.getId(), helpLocation, + CURRENT_LINE_HIGHLIGHT_COLOR.getId(), helpLocation, "The background color of the line where the cursor is located"); fieldOptions.registerOption(GhidraOptions.HIGHLIGHT_CURSOR_LINE, true, helpLocation, "Toggles highlighting background color of line containing the cursor"); helpLocation = new HelpLocation(getName(), "Keyboard_Controls_Shift"); - fieldOptions.registerOption(MOUSE_WHEEL_HORIZONTAL_SCROLLING, true, helpLocation, + fieldOptions.registerOption(MOUSE_WHEEL_HORIZONTAL_SCROLLING_OPTIONS_NAME, true, + helpLocation, "Enables horizontal scrolling by holding the Shift key while " + "using the mouse scroll wheel"); @@ -599,21 +603,21 @@ public abstract class AbstractCodeBrowserPlugin

ex highlightMarkers.setMarkerColor(color); } - color = fieldOptions.getColor(CURSOR_COLOR, IFOCUSED_CURSOR_COLOR); + color = fieldOptions.getColor(CURSOR_COLOR_OPTIONS_NAME, FOCUSED_CURSOR_COLOR); fieldPanel.setFocusedCursorColor(color); - color = fieldOptions.getColor(UNFOCUSED_CURSOR_COLOR, IUNFOCUSED_CURSOR_COLOR); + color = fieldOptions.getColor(UNFOCUSED_CURSOR_COLOR_OPTIONS_NAME, UNFOCUSED_CURSOR_COLOR); fieldPanel.setNonFocusCursorColor(color); - Boolean isBlinkCursor = fieldOptions.getBoolean(BLINK_CURSOR, true); + Boolean isBlinkCursor = fieldOptions.getBoolean(BLINK_CURSOR_OPTIONS_NAME, true); fieldPanel.setBlinkCursor(isBlinkCursor); boolean horizontalScrollingEnabled = - fieldOptions.getBoolean(MOUSE_WHEEL_HORIZONTAL_SCROLLING, true); + fieldOptions.getBoolean(MOUSE_WHEEL_HORIZONTAL_SCROLLING_OPTIONS_NAME, true); fieldPanel.setHorizontalScrollingEnabled(horizontalScrollingEnabled); cursorHighlightColor = fieldOptions.getColor(GhidraOptions.HIGHLIGHT_CURSOR_LINE_COLOR, - ICURRENT_LINE_HIGHLIGHT_COLOR); + CURRENT_LINE_HIGHLIGHT_COLOR); isHighlightCursorLine = fieldOptions.getBoolean(GhidraOptions.HIGHLIGHT_CURSOR_LINE, true); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datapreview/DataTypePreviewPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datapreview/DataTypePreviewPlugin.java index da04b8bf36..df59a8d79e 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datapreview/DataTypePreviewPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datapreview/DataTypePreviewPlugin.java @@ -29,7 +29,6 @@ import docking.action.*; import docking.dnd.DropTgtAdapter; import docking.dnd.Droppable; import docking.widgets.table.AbstractSortedTableModel; -import generic.theme.GIcon; import ghidra.app.CorePluginPackage; import ghidra.app.plugin.PluginCategoryNames; import ghidra.app.plugin.ProgramPlugin; @@ -317,7 +316,7 @@ public class DataTypePreviewPlugin extends ProgramPlugin { } }; deleteAction.setPopupMenuData(new MenuData(new String[] { "Delete" })); - deleteAction.setToolBarData(new ToolBarData(new GIcon("icon.delete"))); + deleteAction.setToolBarData(new ToolBarData(Icons.DELETE_ICON)); deleteAction.setKeyBindingData(new KeyBindingData(KeyEvent.VK_DELETE, 0)); deleteAction.setDescription("Delete Selected Datatypes"); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/misc/FontAdjustPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/misc/FontAdjustPlugin.java index 98f40a08b5..af5cc78ffb 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/misc/FontAdjustPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/misc/FontAdjustPlugin.java @@ -22,7 +22,6 @@ import ghidra.app.CorePluginPackage; import ghidra.app.plugin.PluginCategoryNames; import ghidra.framework.plugintool.*; import ghidra.framework.plugintool.util.PluginStatus; -import ghidra.util.Msg; /** * Manages the markers to display areas where changes have occurred @@ -55,7 +54,6 @@ public class FontAdjustPlugin extends Plugin { } private void incrementFont(ActionContext context) { - Msg.debug(this, "incrementFont"); ComponentProvider provider = context.getComponentProvider(); if (provider != null) { provider.adjustFontSize(true); @@ -63,7 +61,6 @@ public class FontAdjustPlugin extends Plugin { } private void decrementFont(ActionContext context) { - Msg.debug(this, "decrementFont"); ComponentProvider provider = context.getComponentProvider(); if (provider != null) { provider.adjustFontSize(false); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditMemoryReferencePanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditMemoryReferencePanel.java index 537ca427a9..bc66418267 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditMemoryReferencePanel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditMemoryReferencePanel.java @@ -49,7 +49,7 @@ import ghidra.util.layout.PairLayout; class EditMemoryReferencePanel extends EditReferencePanel { private static final Color BUTTON_COLOR = new GColor("color.fg.button"); - private static final Icon MENU_ICON = new DropDownMenuIcon(16, 4, 4, BUTTON_COLOR); + private static final Icon MENU_ICON = new DropDownMenuIcon(BUTTON_COLOR); private static final RefType[] MEM_REF_TYPES = RefTypeFactory.getMemoryRefTypes(); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bean/FixedBitSizeValueField.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bean/FixedBitSizeValueField.java index ff3c45c27c..7381c1b29f 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bean/FixedBitSizeValueField.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bean/FixedBitSizeValueField.java @@ -66,7 +66,7 @@ public class FixedBitSizeValueField extends JPanel { } add(valueField, BorderLayout.CENTER); - Font f2 = Gui.getFont("font.monospaced"); + Font f2 = Gui.getFont(Font.MONOSPACED); valueField.setFont(f2); valueField.setMargin(new Insets(0, 2, 0, 2)); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.java b/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.java index e72a7a2a00..c6ec824e3d 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.java @@ -44,7 +44,7 @@ public class GhidraApplicationConfiguration extends HeadlessGhidraApplicationCon @Override protected void initializeApplication() { Gui.initialize(); - LookAndFeelUtils.platformSpecificFixups(); + LookAndFeelUtils.performPlatformSpecificFixups(); if (showSplashScreen) { showUserAgreement(); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/framework/main/ConsoleTextPane.java b/Ghidra/Features/Base/src/main/java/ghidra/framework/main/ConsoleTextPane.java index 84a501aa27..77891c21ae 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/framework/main/ConsoleTextPane.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/framework/main/ConsoleTextPane.java @@ -22,6 +22,7 @@ import javax.swing.JTextPane; import javax.swing.text.*; import generic.theme.GColor; +import generic.theme.GThemeDefaults.Ids.Fonts; import generic.theme.Gui; import ghidra.framework.options.*; import ghidra.framework.plugintool.PluginTool; @@ -203,7 +204,7 @@ public class ConsoleTextPane extends JTextPane implements OptionsChangeListener } private void createAttribtues() { - createAttributes(Gui.getFont("font.monospaced")); + createAttributes(Gui.getFont(Fonts.MONOSPACED)); } private void createAttributes(Font font) { diff --git a/Ghidra/Features/BytePatterns/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/BytePatterns/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/BytePatterns/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/BytePatterns/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/ByteViewer/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/ByteViewer/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/ByteViewer/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/ByteViewer/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/Decompiler/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/Decompiler/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/Decompiler/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/Decompiler/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/FileFormats/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/FileFormats/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/FileFormats/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/FileFormats/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/FunctionGraph/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/FunctionGraph/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/FunctionGraph/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/FunctionGraph/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/FunctionID/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/FunctionID/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/FunctionID/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/FunctionID/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidFunctionDebugPanel.java b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidFunctionDebugPanel.java index 4a9912130b..68d6a58835 100644 --- a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidFunctionDebugPanel.java +++ b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidFunctionDebugPanel.java @@ -21,6 +21,7 @@ import java.awt.event.ActionListener; import javax.swing.*; import docking.widgets.label.GDLabel; +import generic.theme.GThemeDefaults; import generic.theme.Gui; import ghidra.feature.fid.db.*; import ghidra.feature.fid.service.FidService; @@ -56,7 +57,7 @@ public class FidFunctionDebugPanel extends JPanel { JButton button = new JButton(text); button.addActionListener(listener); button.setHorizontalAlignment(SwingConstants.LEFT); - button.setFont(Gui.getFont("font.monospaced")); + Gui.registerFont(button, GThemeDefaults.Ids.Fonts.MONOSPACED); add(button); } diff --git a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidSearchDebugDialog.java b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidSearchDebugDialog.java index 6792ca0c14..3ba1bb1279 100644 --- a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidSearchDebugDialog.java +++ b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidSearchDebugDialog.java @@ -21,6 +21,7 @@ import javax.swing.*; import docking.DialogComponentProvider; import docking.widgets.label.GDLabel; +import generic.theme.GThemeDefaults.Ids.Fonts; import generic.theme.Gui; import ghidra.feature.fid.db.FidFileManager; import ghidra.feature.fid.db.FidQueryService; @@ -76,13 +77,13 @@ public class FidSearchDebugDialog extends DialogComponentProvider { private JLabel getPreparedLabel(String text) { JLabel label = new GDLabel(text, SwingConstants.RIGHT); - label.setFont(Gui.getFont("font.monospaced")); + label.setFont(Gui.getFont(Fonts.MONOSPACED)); return label; } private JTextField getPreparedTextField() { JTextField textField = new JTextField(25); - textField.setFont(Gui.getFont("font.monospaced")); + textField.setFont(Gui.getFont(Fonts.MONOSPACED)); return textField; } diff --git a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidSearchResultFrame.java b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidSearchResultFrame.java index 38baae3065..1e246cedc7 100644 --- a/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidSearchResultFrame.java +++ b/Ghidra/Features/FunctionID/src/main/java/ghidra/feature/fid/debug/FidSearchResultFrame.java @@ -26,6 +26,7 @@ import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; import docking.widgets.table.*; +import generic.theme.GThemeDefaults.Ids.Fonts; import generic.theme.Gui; import ghidra.feature.fid.db.*; import ghidra.feature.fid.service.FidService; @@ -65,7 +66,7 @@ public class FidSearchResultFrame extends JFrame implements FidQueryCloseListene private void buildFrame() { GTableCellRenderer renderer = new GTableCellRenderer(); - renderer.setFont(Gui.getFont("font.monospaced")); + renderer.setFont(Gui.getFont(Fonts.MONOSPACED)); int columnCount = table.getColumnCount(); for (int ii = 0; ii < columnCount; ++ii) { Class columnClass = table.getColumnClass(ii); diff --git a/Ghidra/Features/GraphFunctionCalls/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/GraphFunctionCalls/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/GraphFunctionCalls/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/GraphFunctionCalls/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/PDB/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/PDB/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/PDB/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/PDB/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/ProgramDiff/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/ProgramDiff/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/ProgramDiff/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/ProgramDiff/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffDetailsProvider.java b/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffDetailsProvider.java index 10609fffb8..8042e9a026 100644 --- a/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffDetailsProvider.java +++ b/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffDetailsProvider.java @@ -30,6 +30,7 @@ import docking.action.DockingAction; import docking.action.ToolBarData; import docking.widgets.checkbox.GCheckBox; import generic.theme.GIcon; +import generic.theme.GThemeDefaults.Ids.Fonts; import generic.theme.Gui; import ghidra.app.util.HelpTopics; import ghidra.framework.plugintool.ComponentProviderAdapter; @@ -294,7 +295,7 @@ public class DiffDetailsProvider extends ComponentProviderAdapter { textPane.setName(DIFF_DETAILS_TEXT_AREA); textPane.setEditable(false); textPane.setMargin(new Insets(5, 5, 5, 5)); - Gui.registerFont(textPane, "font.monospaced"); + Gui.registerFont(textPane, Fonts.MONOSPACED); textPane.setOpaque(true); textPane.setCaretPosition(0); JScrollPane scrolledDetails = new JScrollPane(textPane); diff --git a/Ghidra/Features/Python/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/Python/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/Python/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/Python/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/SourceCodeLookup/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/SourceCodeLookup/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/SourceCodeLookup/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/SourceCodeLookup/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/VersionTracking/src/main/help/help/shared/Frontpage.css b/Ghidra/Features/VersionTracking/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Features/VersionTracking/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Features/VersionTracking/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/wizard/NewSessionPanel.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/wizard/NewSessionPanel.java index 06f14ae77a..a0b69e6f8c 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/wizard/NewSessionPanel.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/wizard/NewSessionPanel.java @@ -73,7 +73,7 @@ public class NewSessionPanel extends AbstractMageJPanel { folderLabel.setHorizontalAlignment(SwingConstants.RIGHT); folderLabel.setToolTipText("The folder to store the new Version Tracking Session"); folderNameField = new JTextField(); - Gui.registerFont(folderNameField, GThemeDefaults.Fonts.MONOSPACED); + Gui.registerFont(folderNameField, GThemeDefaults.Ids.Fonts.MONOSPACED); folderNameField.setEditable(false); // force user to browse to choose JButton browseFolderButton = diff --git a/Ghidra/Framework/Docking/Module.manifest b/Ghidra/Framework/Docking/Module.manifest index 98a3c453e5..139597f9cb 100644 --- a/Ghidra/Framework/Docking/Module.manifest +++ b/Ghidra/Framework/Docking/Module.manifest @@ -1,2 +1,2 @@ -MODULE FILE LICENSE: lib/flatlaf-2.1.jar Apache License 2.0 + diff --git a/Ghidra/Framework/Docking/build.gradle b/Ghidra/Framework/Docking/build.gradle index fdf880918f..4cc5963654 100644 --- a/Ghidra/Framework/Docking/build.gradle +++ b/Ghidra/Framework/Docking/build.gradle @@ -26,8 +26,6 @@ eclipse.project.name = 'Framework Docking' dependencies { api project(':Generic') api project(':Help') - - api 'com.formdev:flatlaf:2.2' // include code from src/test in Generic testImplementation project(path: ':Generic', configuration: 'testArtifacts') diff --git a/Ghidra/Framework/Docking/data/docking.theme.properties b/Ghidra/Framework/Docking/data/docking.theme.properties index 4d6b89c958..4b562165aa 100644 --- a/Ghidra/Framework/Docking/data/docking.theme.properties +++ b/Ghidra/Framework/Docking/data/docking.theme.properties @@ -124,8 +124,6 @@ icon.dragon.256 = GhidraIcon256.png icon.help.navigation.aid.disabled.overlay = icon.not.allowed icon.help.navigation.aid.enabled = software-update-available.png -icon.options.node.leaf = icon.properties - icon.filechooser.places.my.computer = computer.png icon.filechooser.places.desktop = desktop.png icon.filechooser.places.home = user-home.png diff --git a/Ghidra/Framework/Docking/src/main/help/help/shared/Frontpage.css b/Ghidra/Framework/Docking/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/Ghidra/Framework/Docking/src/main/help/help/shared/Frontpage.css +++ b/Ghidra/Framework/Docking/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/Ghidra/Framework/Docking/src/main/help/help/topics/Theming/ThemingDeveloperDocs.html b/Ghidra/Framework/Docking/src/main/help/help/topics/Theming/ThemingDeveloperDocs.html index 54d08f820e..4be4a61936 100644 --- a/Ghidra/Framework/Docking/src/main/help/help/topics/Theming/ThemingDeveloperDocs.html +++ b/Ghidra/Framework/Docking/src/main/help/help/topics/Theming/ThemingDeveloperDocs.html @@ -11,8 +11,6 @@ - Theming Development Documentation -

Ghidra Theming Developer Documentation

This document provides everything an application developer should know when developing diff --git a/Ghidra/Framework/Docking/src/main/java/docking/CloseIcon.java b/Ghidra/Framework/Docking/src/main/java/docking/CloseIcon.java index 77f9db4ad7..48d28967e3 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/CloseIcon.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/CloseIcon.java @@ -16,6 +16,7 @@ package docking; import java.awt.*; +import java.awt.geom.GeneralPath; import javax.swing.Icon; @@ -24,34 +25,86 @@ import javax.swing.Icon; */ public class CloseIcon implements Icon { private int size; - private int margin; private Color color; + private Shape shape; /** - * Creates a close icon. - * @param size the width and height of the icon - * @param margin the margin around the "x" - * @param color the color of the "x" - */ - public CloseIcon(int size, int margin, Color color) { - this.size = size; - this.margin = margin; + * Creates a close icon. + * @param isSmall false signals to use a 16x16 size; true signals to use an 8x8 size + * @param color the color of the "x" + */ + public CloseIcon(boolean isSmall, Color color) { + this.size = isSmall ? 8 : 16; this.color = color; + this.shape = buildShape(); + } + + private Shape buildShape() { + GeneralPath path = new GeneralPath(); + + /* + We use trial and error sizing. This class allows clients to specify the icon size. At + the time of writing, there were only 2 sizes in use: 16 and 8 pixels. If more size + needs arise, we can revisit how the values below are chosen. + */ + + double margin = 2; + double shapeSize = 11; + double thickness = 1.7; + if (size == 8) { + margin = 0; + shapeSize = 7; + thickness = 1; + } + + double p1x = margin; + double p1y = margin + thickness; + double p2x = margin + thickness; + double p2y = margin; + double p3x = margin + shapeSize; + double p3y = margin + shapeSize - thickness; + double p4x = margin + shapeSize - thickness; + double p4y = margin + shapeSize; + + path.moveTo(p1x, p1y); + path.lineTo(p2x, p2y); + path.lineTo(p3x, p3y); + path.lineTo(p4x, p4y); + path.lineTo(p1x, p1y); + + p1x = margin + shapeSize - thickness; + p1y = margin; + p2x = margin + shapeSize; + p2y = margin + thickness; + p3x = margin + thickness; + p3y = margin + shapeSize; + p4x = margin; + p4y = margin + shapeSize - thickness; + + path.moveTo(p1x, p1y); + path.lineTo(p2x, p2y); + path.lineTo(p3x, p3y); + path.lineTo(p4x, p4y); + path.lineTo(p1x, p1y); + + path.closePath(); + return path; } @Override public void paintIcon(Component c, Graphics g, int x, int y) { - g.setColor(color); - int xStart = x + margin; - int yStart = y + margin; - int xEnd = x + size - margin; - int yEnd = y + size - margin; - g.drawLine(xStart, yStart, xEnd, yEnd); - g.drawLine(xStart, yEnd, xEnd, yStart); - g.drawLine(xStart + 1, yStart, xEnd + 1, yEnd); - g.drawLine(xStart + 1, yEnd, xEnd + 1, yStart); - g.drawLine(xStart - 1, yStart, xEnd - 1, yEnd); - g.drawLine(xStart - 1, yEnd, xEnd - 1, yStart); + + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + try { + g2d.translate(x, y); + g2d.setColor(color); + g2d.fill(shape); + } + finally { + g2d.translate(-x, -y); + } } @Override diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DockableToolBarManager.java b/Ghidra/Framework/Docking/src/main/java/docking/DockableToolBarManager.java index 89ef71a1e1..0116deda95 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/DockableToolBarManager.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/DockableToolBarManager.java @@ -32,8 +32,8 @@ import ghidra.util.task.SwingUpdateManager; */ class DockableToolBarManager { private static final Color BUTTON_COLOR = new GColor("color.fg.button"); - private static final Icon CLOSE_ICON = new CloseIcon(16, 4, BUTTON_COLOR); - private static final Icon MENU_ICON = new DropDownMenuIcon(16, 4, 4, BUTTON_COLOR); + private static final Icon CLOSE_ICON = new CloseIcon(false, BUTTON_COLOR); + private Icon MENU_ICON = new DropDownMenuIcon(BUTTON_COLOR); private GenericHeader dockableHeader; private ToolBarManager toolBarManager; diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DropDownMenuIcon.java b/Ghidra/Framework/Docking/src/main/java/docking/DropDownMenuIcon.java index bf9692d96a..7f07f50405 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/DropDownMenuIcon.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/DropDownMenuIcon.java @@ -16,6 +16,7 @@ package docking; import java.awt.*; +import java.awt.geom.GeneralPath; import javax.swing.Icon; @@ -23,49 +24,71 @@ import javax.swing.Icon; * Icon for a drop down menu button (triangle pointing down) */ public class DropDownMenuIcon implements Icon { - private int size; - private int xMargin; - private int yMargin; + private static final int ICON_SIZE = 16; + private Color color; + private Shape shape; /** * Creates a drop down menu icon. - * @param size the width and height of the icon - * @param xMargin the margin around triangle base - * @param yMargin the margin around triangle height * @param color the color of the triangle */ - public DropDownMenuIcon(int size, int xMargin, int yMargin, Color color) { - this.size = size; - this.xMargin = xMargin; - this.yMargin = yMargin; + public DropDownMenuIcon(Color color) { this.color = color; + this.shape = buildShape(); + } + + private Shape buildShape() { + + GeneralPath path = new GeneralPath(); + + double iconSize = 16; + double height = 6; + double width = 10; + double leftMargin = (iconSize - width) / 2; + double topMargin = (iconSize - height) / 2; + + // draw a triangle pointing down; p1 is the bottom; p2 is the left + double p1x = leftMargin + (width / 2); + double p1y = topMargin + height; + double p2x = leftMargin; + double p2y = topMargin; + double p3x = leftMargin + width; + double p3y = topMargin; + + path.moveTo(p1x, p1y); + path.lineTo(p2x, p2y); + path.lineTo(p3x, p3y); + path.lineTo(p1x, p1y); + path.closePath(); + + return path; } @Override public void paintIcon(Component c, Graphics g, int x, int y) { - g.setColor(color); - // draw a triangle pointing down - int p1x = x + size / 2; - int p1y = y + size - yMargin; - int p2x = x + xMargin; - int p2y = y + yMargin; - int p3x = x + size - xMargin + 1; - int p3y = y + yMargin; - int xPoints[] = { p1x, p2x, p3x }; - int yPoints[] = { p1y, p2y, p3y }; - g.fillPolygon(xPoints, yPoints, 3); + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + try { + g2d.translate(x, y); + g2d.setColor(color); + g2d.fill(shape); + } + finally { + g2d.translate(-x, -y); + } } @Override public int getIconWidth() { - return size; + return ICON_SIZE; } @Override public int getIconHeight() { - return size; + return ICON_SIZE; } } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/framework/DockingApplicationConfiguration.java b/Ghidra/Framework/Docking/src/main/java/docking/framework/DockingApplicationConfiguration.java index a1b8ddb290..730d0087ac 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/framework/DockingApplicationConfiguration.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/framework/DockingApplicationConfiguration.java @@ -50,7 +50,7 @@ public class DockingApplicationConfiguration extends ApplicationConfiguration { super.initializeApplication(); Gui.initialize(); - LookAndFeelUtils.platformSpecificFixups(); + LookAndFeelUtils.performPlatformSpecificFixups(); if (showSplashScreen) { SplashScreen.showSplashScreen(); diff --git a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/IconPropertyEditor.java b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/IconPropertyEditor.java index 368eb43b66..68d863f44f 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/IconPropertyEditor.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/IconPropertyEditor.java @@ -133,12 +133,6 @@ public class IconPropertyEditor extends PropertyEditorSupport { return panel; } -// private void iconChanged() { -// Icon icon = dropDown.getSelectedValue(); -// Msg.debug(this, "action listener: icon changed " + icon); -// dropDown.getSelectedValue(); -// } - private void iconChanged(Icon icon) { boolean isDropDownWindowShowing = dropDown.isMatchingListShowing(); if (!isDropDownWindowShowing) { @@ -216,10 +210,8 @@ public class IconPropertyEditor extends PropertyEditorSupport { previewLabel = new GDLabel(""); previewLabel.setIcon(ResourceManager.getDefaultIcon()); -// previewLabel.setPreferredSize(new Dimension(350, 50)); previewLabel.setHorizontalAlignment(SwingConstants.CENTER); previewLabel.setVerticalAlignment(SwingConstants.CENTER); -// previewLabel.setMinimumSize(new Dimension(300, 50)); panel.add(previewLabel, BorderLayout.CENTER); panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); return panel; diff --git a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/OptionsTreeNode.java b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/OptionsTreeNode.java index d95d5311e5..50355b8cc6 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/OptionsTreeNode.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/OptionsTreeNode.java @@ -23,11 +23,12 @@ import docking.widgets.tree.GTreeLazyNode; import docking.widgets.tree.GTreeNode; import generic.theme.GIcon; import ghidra.framework.options.Options; +import resources.Icons; class OptionsTreeNode extends GTreeLazyNode { - private final static Icon OPEN_FOLDER_ICON = new GIcon("icon.folder.open"); - private final static Icon CLOSED_FOLDER_ICON = new GIcon("icon.folder.closed"); - private final static Icon PROPERTIES_ICON = new GIcon("icon.options.node.leaf"); + private final static Icon OPEN_FOLDER_ICON = Icons.OPEN_FOLDER_ICON; + private final static Icon CLOSED_FOLDER_ICON = Icons.CLOSED_FOLDER_ICON; + private final static Icon PROPERTIES_ICON = new GIcon("icon.properties"); private final Options options; private final String name; diff --git a/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeColorTable.java b/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeColorTable.java index fa27f8e86a..c06f729bef 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeColorTable.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeColorTable.java @@ -107,7 +107,7 @@ public class ThemeColorTable extends JPanel implements ActionContextProvider { @Override public ActionContext getActionContext(MouseEvent e) { - if (e.getSource() == table) { + if (e != null && e.getSource() == table) { ColorValue currentValue = filterTable.getSelectedRowObject(); if (currentValue == null) { return null; diff --git a/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeDialog.java b/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeDialog.java index 46bd4d9490..61bd67731d 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeDialog.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeDialog.java @@ -79,7 +79,7 @@ public class ThemeDialog extends DialogComponentProvider { .enabledWhen(c -> c.isChanged()) .popupWhen(c -> true) .helpLocation(new HelpLocation("Theming", "Restore_Value")) - .onAction(c -> c.getThemeValue().makeCurrentValue()) + .onAction(c -> c.getThemeValue().installValue()) .build(); addAction(resetValueAction); } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeValueEditor.java b/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeValueEditor.java index 38d8700ebd..068bd640ae 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeValueEditor.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/theme/gui/ThemeValueEditor.java @@ -25,7 +25,7 @@ import docking.DockingWindowManager; import generic.theme.ThemeValue; /** - * Base class for Theme properties (Colors, Fonts, and Icons) + * Base class for Theme property Editors (Colors, Fonts, and Icons) * * @param the base property (Color, Font, or Icon) */ diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java index 5a5ceb3634..3bb62a7ff5 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java @@ -1152,6 +1152,7 @@ public class FieldPanel extends JPanel } private Color blend(Color primary, Color secondary) { + return ColorUtils.blend(primary, secondary, 0.75); } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tabbedpane/DockingTabRenderer.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tabbedpane/DockingTabRenderer.java index 6b355e8167..82b564489d 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tabbedpane/DockingTabRenderer.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tabbedpane/DockingTabRenderer.java @@ -32,9 +32,7 @@ import generic.theme.GColor; public class DockingTabRenderer extends JPanel { private static final int MAX_TITLE_LENGTH = 25; - private Icon CLOSE_ICON = new CloseIcon(8, 1, new GColor("color.fg.button")); - private Icon EMPTY_ICON = CLOSE_ICON; - //TODO if we don't want the close icon to come and go, then this class can be greatly simplified + private Icon CLOSE_ICON = new CloseIcon(true, new GColor("color.fg.button")); private JLabel titleLabel; private JLabel iconLabel; @@ -56,9 +54,9 @@ public class DockingTabRenderer extends JPanel { setTitle(tabTitle, fullTitle); closeButton.setToolTipText("Close " + tabTitle); - closeButton.setIcon(EMPTY_ICON); // no icon until we rollover the tab closeButton.setFocusable(false); closeButton.addActionListener(closeListener); + closeButton.setIcon(CLOSE_ICON); closeButton.setRolloverIcon(CLOSE_ICON); JPanel container = new JPanel(); @@ -84,20 +82,10 @@ public class DockingTabRenderer extends JPanel { titleLabel.addMouseListener(eventForwardingListener); titleLabel.addMouseMotionListener(eventForwardingListener); - // listeners to know when to hide our close button (from the tabbed pane) - final ButtonIconSwapperMouseListener iconListener = - new ButtonIconSwapperMouseListener(tabbedPane); - installIconListener(container, tabbedPane, iconListener); - - // listeners to know when to hide our close button (from this panel) - addMouseListener(iconListener); - addMouseMotionListener(iconListener); - - installMouseForwardingListenerWorkaround(tabbedPane, iconListener); + installMouseForwardingListenerWorkaround(tabbedPane); } - private void installMouseForwardingListenerWorkaround(final JTabbedPane tabbedPane, - final ButtonIconSwapperMouseListener iconListener) { + private void installMouseForwardingListenerWorkaround(final JTabbedPane tabbedPane) { forwardingListener = new TabContainerForwardingMouseListener(tabbedPane); @@ -114,20 +102,14 @@ public class DockingTabRenderer extends JPanel { boolean isDisplayable = isDisplayable(); if (isDisplayable) { // remove and add in order to prevent duplicate adding - myParent.removeMouseListener(iconListener); - myParent.removeMouseMotionListener(iconListener); myParent.removeMouseListener(forwardingListener); myParent.removeMouseMotionListener(forwardingListener); - myParent.addMouseListener(iconListener); - myParent.addMouseMotionListener(iconListener); myParent.addMouseListener(forwardingListener); myParent.addMouseMotionListener(forwardingListener); hierarchyListener = this; } else if (hierarchyListener != null) { - myParent.removeMouseListener(iconListener); - myParent.removeMouseMotionListener(iconListener); myParent.removeMouseListener(forwardingListener); myParent.removeMouseMotionListener(forwardingListener); @@ -145,20 +127,6 @@ public class DockingTabRenderer extends JPanel { return title; } - // add listeners to the tabbed pane so that the icon for closing appears (and disappears) as - // needed - private void installIconListener(Container container, JTabbedPane tabbedPane, - ButtonIconSwapperMouseListener iconListener) { - Component[] components = container.getComponents(); - for (Component component : components) { - component.addMouseListener(iconListener); - } - - tabbedPane.addMouseListener(iconListener); - // we need this due to the gaps between the renderer and the tabbed pane - tabbedPane.addMouseMotionListener(iconListener); - } - public void installRenameAction(MouseListener listener) { this.renameListener = listener; } @@ -193,57 +161,6 @@ public class DockingTabRenderer extends JPanel { // Inner Classes //================================================================================================== - /** - * A class to hide/show the close button's icon to make it appear that the button is hidden - * and removed. - */ - private class ButtonIconSwapperMouseListener extends MouseAdapter { - - private final JTabbedPane tabbedPane; - - ButtonIconSwapperMouseListener(JTabbedPane tabbedPane) { - this.tabbedPane = tabbedPane; - } - - private void updateButton(MouseEvent e) { - Point point = e.getPoint(); - Point tabbedPaneRelativePoint = - SwingUtilities.convertPoint(e.getComponent(), point, tabbedPane); - int x = tabbedPaneRelativePoint.x; - int y = tabbedPaneRelativePoint.y; - int tabIndex = tabbedPane.indexAtLocation(x, y); - if (tabIndex < 0) { - // no tab for the given point (can happen when over the tabbed pane, but not - // over any tab) - closeButton.setIcon(EMPTY_ICON); - return; - } - - Component tabComponent = tabbedPane.getTabComponentAt(tabIndex); - if (SwingUtilities.isDescendingFrom(closeButton, tabComponent)) { - closeButton.setIcon(CLOSE_ICON); - } - else { - closeButton.setIcon(EMPTY_ICON); - } - } - - @Override - public void mouseMoved(MouseEvent e) { - updateButton(e); - } - - @Override - public void mouseEntered(MouseEvent e) { - updateButton(e); - } - - @Override - public void mouseExited(MouseEvent e) { - closeButton.setIcon(EMPTY_ICON); - } - } - /** * A class designed to listen for mouse events on this renderer component which it will then * forward on to the given component. diff --git a/Ghidra/Framework/Docking/src/main/java/ghidra/docking/util/LookAndFeelUtils.java b/Ghidra/Framework/Docking/src/main/java/ghidra/docking/util/LookAndFeelUtils.java index 363d406b8a..3d5cf6de12 100644 --- a/Ghidra/Framework/Docking/src/main/java/ghidra/docking/util/LookAndFeelUtils.java +++ b/Ghidra/Framework/Docking/src/main/java/ghidra/docking/util/LookAndFeelUtils.java @@ -72,7 +72,7 @@ public class LookAndFeelUtils { } } - public static void platformSpecificFixups() { + public static void performPlatformSpecificFixups() { // Set the dock icon for macOS if (Taskbar.isTaskbarSupported()) { Taskbar taskbar = Taskbar.getTaskbar(); diff --git a/Ghidra/Framework/Docking/src/test/java/docking/theme/gui/ThemeUtilsTest.java b/Ghidra/Framework/Docking/src/test/java/docking/theme/gui/ThemeUtilsTest.java index ec423c6c56..557a6b3a0b 100644 --- a/Ghidra/Framework/Docking/src/test/java/docking/theme/gui/ThemeUtilsTest.java +++ b/Ghidra/Framework/Docking/src/test/java/docking/theme/gui/ThemeUtilsTest.java @@ -204,8 +204,8 @@ public class ThemeUtilsTest extends AbstractDockingTest { } @Test - public void testParseGroupingsParseError() { - String source = "(ab (cd))(ef)( gh))"; + public void testParseGroupingsWithUnbalancedGroups() { + String source = "(ab (cd))(ef)( gh))"; // note the groupings are unbalanced try { ThemeValueUtils.parseGroupings(source, '(', ')'); fail("Expected parse Exception"); @@ -216,8 +216,8 @@ public class ThemeUtilsTest extends AbstractDockingTest { } @Test - public void testParseGroupingsParseError2() { - String source = " xx"; + public void testParseGroupingsWhenNoGroupingsExist() { + String source = "xx yy"; // note there are no grouping chars try { ThemeValueUtils.parseGroupings(source, '(', ')'); fail("Expected parse Exception"); diff --git a/Ghidra/Framework/Generic/Module.manifest b/Ghidra/Framework/Generic/Module.manifest index 830f7b173e..0533366caf 100644 --- a/Ghidra/Framework/Generic/Module.manifest +++ b/Ghidra/Framework/Generic/Module.manifest @@ -10,3 +10,4 @@ MODULE FILE LICENSE: lib/gson-2.9.0.jar Apache License 2.0 MODULE FILE LICENSE: lib/bcpkix-jdk15on-1.69.jar Bouncy Castle License MODULE FILE LICENSE: lib/bcprov-jdk15on-1.69.jar Bouncy Castle License MODULE FILE LICENSE: lib/bcutil-jdk15on-1.69.jar Bouncy Castle License +MODULE FILE LICENSE: lib/flatlaf-2.6.jar Apache License 2.0 diff --git a/Ghidra/Framework/Generic/build.gradle b/Ghidra/Framework/Generic/build.gradle index 2a3b147c3b..f7d479cf69 100644 --- a/Ghidra/Framework/Generic/build.gradle +++ b/Ghidra/Framework/Generic/build.gradle @@ -38,7 +38,7 @@ dependencies { api 'org.bouncycastle:bcpkix-jdk15on:1.69' // requires bcutil and bcprov api 'org.bouncycastle:bcprov-jdk15on:1.69' api 'org.bouncycastle:bcutil-jdk15on:1.69' - api 'com.formdev:flatlaf:2.2' + api 'com.formdev:flatlaf:2.6' compileOnly "junit:junit:4.12" diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/AbstractThemeReader.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/AbstractThemeReader.java index 9a12317fe9..a6b7bbfc63 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/AbstractThemeReader.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/AbstractThemeReader.java @@ -291,7 +291,7 @@ public abstract class AbstractThemeReader { error(lineNumber, "Missing key for propery line: \"" + line + "\""); return; } - if (key.isBlank()) { + if (value.isBlank()) { error(lineNumber, "Missing value for propery line: \"" + line + "\""); return; } diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/ColorValue.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/ColorValue.java index ec17688515..0190d7aa5f 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/ColorValue.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/ColorValue.java @@ -104,7 +104,8 @@ public class ColorValue extends ThemeValue { Msg.error(this, "Could not resolve indirect color path for \"" + unresolvedId + - "\" for primary id \"" + id + "\", using last resort default"); + "\" for primary id \"" + id + "\", using last resort default", + t); return LAST_RESORT_DEFAULT; } @@ -149,7 +150,7 @@ public class ColorValue extends ThemeValue { } @Override - public void makeCurrentValue() { + public void installValue() { Gui.setColor(this); } diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/FontModifier.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/FontModifier.java index 8b1760da2e..d2b6c84494 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/FontModifier.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/FontModifier.java @@ -18,7 +18,6 @@ package generic.theme; import java.awt.Font; import java.text.ParseException; import java.util.List; -import java.util.regex.Pattern; /** * Class that can transform one font into another. For example if want a font that is the same @@ -26,8 +25,6 @@ import java.util.regex.Pattern; * FontModifier */ public class FontModifier { - - private static final Pattern MODIFIER_PATTERN = Pattern.compile("(\\[([a-zA-Z]+|[0-9]+)\\])*"); private String family; private Integer style; private Integer size; diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/FontValue.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/FontValue.java index c5ef68db4c..105e7b914f 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/FontValue.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/FontValue.java @@ -121,6 +121,11 @@ public class FontValue extends ThemeValue { return font == null ? null : new FontValue(id, font); } + /** + * Returns the Font style int for the given style string + * @param styleString the string to convert to a Font style int + * @return the Font style int for the given style string + */ public static int getStyle(String styleString) { if ("plain".equalsIgnoreCase(styleString)) { return Font.PLAIN; @@ -227,7 +232,7 @@ public class FontValue extends ThemeValue { } @Override - public void makeCurrentValue() { + public void installValue() { Gui.setFont(this); } diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/GColor.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/GColor.java index 7aa2176b7f..3f82c4316d 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/GColor.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/GColor.java @@ -30,7 +30,7 @@ import ghidra.util.datastruct.WeakStore; * color table that is determined by the active {@link GTheme}. *

The idea is for developers to * not use specific colors in their code, but to instead use a GColor with an id that hints at - * its use. For example, instead of harding code a component's background color to white by coding + * its use. For example, instead of hard coding a component's background color to white by coding * "component.setBackground(Color.white)", you would do something like * "component.setBackground(new GColor("color.mywidget.bg"). Then in a * "[module name].theme.properties" file (located in the module's data directory), you would @@ -127,6 +127,11 @@ public class GColor extends Color { return delegate.darker(); } + /** + * Returns true if this GColor could not find a value for its color id in the current theme + * and is using the default color as its delegate + * @return true if this GColor could not find a value for its color id in the current theme + */ public boolean isUnresolved() { return delegate == ColorValue.LAST_RESORT_DEFAULT; } @@ -144,20 +149,17 @@ public class GColor extends Color { return WebColors.toString(this, false); } + /** + * Generates a more verbose toString() + * @return a more verbose toString() + */ public String toDebugString() { Color c = delegate; String rgb = "(" + c.getRed() + "," + c.getGreen() + "," + c.getBlue() + "," + c.getAlpha() + ")"; + String hexrgb = "(" + WebColors.toString(c, true) + ")"; return getClass().getSimpleName() + " [id = " + id + ", color = " + - c.getClass().getSimpleName() + rgb + "]"; - } - - public String toDebugHexString() { - Color c = delegate; - String rgb = - "(" + WebColors.toString(c, true) + ")"; - return getClass().getSimpleName() + " [id = " + id + ", color = " + - c.getClass().getSimpleName() + rgb + "]"; + c.getClass().getSimpleName() + rgb + hexrgb + "]"; } @Override diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/GIcon.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/GIcon.java index ce5ee16b01..72e98b2a46 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/GIcon.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/GIcon.java @@ -31,8 +31,8 @@ import resources.icons.*; * icon table that is determined by the active {@link GTheme}. *

The idea is for developers to * not use specific icons in their code, but to instead use a GIcon with an id that hints at - * its use. For example, instead of harding code a label's icon by coding - * "lable.setIcon(ResourceManager.loadImage("images/refresh.png", you would do something like + * its use. For example, instead of hard coding a label's icon by coding + * "label.setIcon(ResourceManager.loadImage("images/refresh.png", you would do something like * label.setIcon(new GIcon("icon.refresh"). Then in a "[module name].theme.properties" file * (located in the module's data directory), you would set the default value by adding this * line "icon.refresh = images/refresh.png". diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/GTheme.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/GTheme.java index 2591a65444..fda6ea33f7 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/GTheme.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/GTheme.java @@ -41,7 +41,7 @@ public class GTheme extends GThemeValueMap { private final File file; /** - * Creates an new GTheme with the given name, the default {@link LookAndFeel} for the the + * Creates a new GTheme with the given name, the default {@link LookAndFeel} for the the * platform and not using dark defaults. This theme will be using all the standard defaults * from the theme.property files and the defaults from the default LookAndFeel. * @param name the name for this GTheme diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/GThemeDefaults.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/GThemeDefaults.java index 72179d49ae..c95fc657c9 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/GThemeDefaults.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/GThemeDefaults.java @@ -32,6 +32,14 @@ public class GThemeDefaults { public static class Java { public static final String BORDER = "system.color.border"; // TODO } + + public static class Fonts { + public static final String STANDARD = "font.standard"; + public static final String BOLD = "font.bold"; + public static final String ITALIC = "font.italic"; + public static final String BOLD_ITALIC = "font.bold.italic"; + public static final String MONOSPACED = "font.monospaced"; + } } /** @@ -125,12 +133,4 @@ public class GThemeDefaults { } } } - - public static class Fonts { - public static final String STANDARD = "font.standard"; - public static final String BOLD = "font.bold"; - public static final String ITALIC = "font.italic"; - public static final String BOLD_ITALIC = "font.bold.italic"; - public static final String MONOSPACED = "font.monospaced"; - } } diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/Gui.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/Gui.java index 56d56235f0..ce14d3ae63 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/Gui.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/Gui.java @@ -23,7 +23,8 @@ import java.util.List; import javax.swing.*; import javax.swing.plaf.ComponentUI; -import com.formdev.flatlaf.*; +import com.formdev.flatlaf.FlatDarkLaf; +import com.formdev.flatlaf.FlatLightLaf; import generic.theme.builtin.*; import generic.theme.laf.LookAndFeelManager; @@ -92,7 +93,6 @@ public class Gui { installFlatLookAndFeels(); loadThemeDefaults(); setTheme(themePreferenceManager.getTheme()); -// LookAndFeelUtils.installGlobalOverrides(); } /** @@ -489,6 +489,7 @@ public class Gui { return gIcon; } + // used by public static void setSystemDefaults(GThemeValueMap map) { systemValues = map; } @@ -730,8 +731,6 @@ public class Gui { private static void installFlatLookAndFeels() { UIManager.installLookAndFeel(LafType.FLAT_LIGHT.getName(), FlatLightLaf.class.getName()); UIManager.installLookAndFeel(LafType.FLAT_DARK.getName(), FlatDarkLaf.class.getName()); - UIManager.installLookAndFeel(LafType.FLAT_DARCULA.getName(), - FlatDarculaLaf.class.getName()); } private static void loadThemeDefaults() { diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/IconValue.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/IconValue.java index 0af14893a0..5018daacc1 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/IconValue.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/IconValue.java @@ -247,7 +247,7 @@ public class IconValue extends ThemeValue { } @Override - public void makeCurrentValue() { + public void installValue() { Gui.setIcon(this); } diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/LafType.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/LafType.java index f921b418e6..0d80c38610 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/LafType.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/LafType.java @@ -34,7 +34,6 @@ public enum LafType { MOTIF("CDE/Motif"), FLAT_LIGHT("Flat Light"), FLAT_DARK("Flat Dark"), - FLAT_DARCULA("Flat Darcula"), WINDOWS("Windows"), WINDOWS_CLASSIC("Windows Classic"), MAC("Mac OS X"); @@ -109,7 +108,6 @@ public enum LafType { return new MotifLookAndFeelManager(); case NIMBUS: return new NimbusLookAndFeelManager(); - case FLAT_DARCULA: case FLAT_DARK: case FLAT_LIGHT: return new FlatLookAndFeelManager(lookAndFeel); diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemeFileLoader.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemeFileLoader.java index 4cf43b6bcf..0489086416 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemeFileLoader.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemeFileLoader.java @@ -52,7 +52,7 @@ public class ThemeFileLoader { } catch (IOException e) { Msg.error(this, - "Error reading theme properties file: " + resourceFile.getAbsolutePath()); + "Error reading theme properties file: " + resourceFile.getAbsolutePath(), e); } } } diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemePreferenceManager.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemePreferenceManager.java index 5e8cdfad2a..ab2051c202 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemePreferenceManager.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemePreferenceManager.java @@ -52,7 +52,7 @@ public class ThemePreferenceManager { } catch (Exception e) { Msg.showError(GTheme.class, null, "Can't Load Previous Theme", - "Can't find or instantiate class: " + className); + "Can't find or instantiate class: " + className, e); } } return Gui.getDefaultTheme(); diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemeValue.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemeValue.java index 3a21bfbb9e..3ccc6c1a92 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemeValue.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/ThemeValue.java @@ -207,8 +207,8 @@ public abstract class ThemeValue implements Comparable> { } /** - * Makes this value the current value for the application + * Install this value as the current value for the application */ - public abstract void makeCurrentValue(); + public abstract void installValue(); } diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/FlatThemeGrouper.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/FlatThemeGrouper.java index 695cf94e6a..bed475a323 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/FlatThemeGrouper.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/FlatThemeGrouper.java @@ -24,37 +24,35 @@ public class FlatThemeGrouper extends ThemeGrouper { @Override public void group(GThemeValueMap values) { - // we made up a source property for a common Flat color. Picked one of them as - // an exemplar (menu.foreground) // @formatter:off - defineCustomColorGroup(values, "color.flat.menu.hover.bg", "MenuBar.hoverBackground"); - defineCustomColorGroup(values, "color.flat.button.hover.bg", "Button.hoverBackground"); - defineCustomColorGroup(values, "color.flat.button.selected.bg","Button.selectedBackground"); - defineCustomColorGroup(values, "color.flat.button.toolbar.hover.bg","Button.toolbar.hoverBackground"); - defineCustomColorGroup(values, "color.flat.button.toolbar.pressed.bg","Button.toolbar.pressedBackground"); - defineCustomColorGroup(values, "color.flat.checkbox.icon.focus.border","CheckBox.icon.focusedBorderColor"); - defineCustomColorGroup(values, "color.flat.menu.accelerator.fg","Menu.acceleratorForeground"); + defineCustomColorGroup("color.flat.menu.hover.bg", "MenuBar.hoverBackground", values); + defineCustomColorGroup("color.flat.button.hover.bg", "Button.hoverBackground", values); + defineCustomColorGroup("color.flat.button.selected.bg", "Button.selectedBackground",values); + defineCustomColorGroup("color.flat.button.toolbar.hover.bg", "Button.toolbar.hoverBackground",values); + defineCustomColorGroup("color.flat.button.toolbar.pressed.bg", "Button.toolbar.pressedBackground",values); + defineCustomColorGroup("color.flat.checkbox.icon.focus.border", "CheckBox.icon.focusedBorderColor",values); + defineCustomColorGroup("color.flat.menu.accelerator.fg", "Menu.acceleratorForeground",values); - defineCustomColorGroup(values, "color.flat.focus.border", "Button.focusedBorderColor"); - defineCustomColorGroup(values, "color.flat.focus", "Component.focusColor"); - defineCustomColorGroup(values, "color.flat.focus.bg", "Button.focusedBackground"); - defineCustomColorGroup(values, "color.flat.checkmark", "CheckBox.icon.checkmarkColor"); - defineCustomColorGroup(values, "color.flat.disabled", "Button.disabledBorderColor"); - defineCustomColorGroup(values, "color.flat.disabled.selected","Button.disabledSelectedBackground"); - defineCustomColorGroup(values, "color.flat.arrow","Spinner.buttonArrowColor"); - defineCustomColorGroup(values, "color.flat.arrow.disabled","Spinner.buttonDisabledArrowColor"); - defineCustomColorGroup(values, "color.flat.arrow.hover","Spinner.buttonHoverArrowColor"); - defineCustomColorGroup(values, "color.flat.arrow.pressed","Spinner.buttonPressedArrowColor"); + defineCustomColorGroup("color.flat.focus.border", "Button.focusedBorderColor", values); + defineCustomColorGroup("color.flat.focus", "Component.focusColor", values); + defineCustomColorGroup("color.flat.focus.bg", "Button.focusedBackground", values); + defineCustomColorGroup("color.flat.checkmark", "CheckBox.icon.checkmarkColor", values); + defineCustomColorGroup("color.flat.disabled", "Button.disabledBorderColor", values); + defineCustomColorGroup("color.flat.disabled.selected", "Button.disabledSelectedBackground",values); + defineCustomColorGroup("color.flat.arrow", "Spinner.buttonArrowColor",values); + defineCustomColorGroup("color.flat.arrow.disabled", "Spinner.buttonDisabledArrowColor",values); + defineCustomColorGroup("color.flat.arrow.hover", "Spinner.buttonHoverArrowColor",values); + defineCustomColorGroup("color.flat.arrow.pressed", "Spinner.buttonPressedArrowColor",values); - defineCustomColorGroup(values, "color.flat.dropcell.bg","List.dropCellBackground"); - defineCustomColorGroup(values, "color.flat.dropline","List.dropLineColor"); - defineCustomColorGroup(values, "color.flat.underline","MenuItem.underlineSelectionColor"); - defineCustomColorGroup(values, "color.flat.docking.bg","ToolBar.dockingBackground"); - defineCustomColorGroup(values, "color.flat.progressbar.bg","ProgressBar.background"); - defineCustomColorGroup(values, "color.flat.progressbar.fg","ProgressBar.foreground"); - defineCustomColorGroup(values, "color.flat.icon.bg","Tree.icon.openColor"); - defineCustomColorGroup(values, "color.flat.selection.inactive","Tree.selectionInactiveBackground"); + defineCustomColorGroup("color.flat.dropcell.bg", "List.dropCellBackground",values); + defineCustomColorGroup("color.flat.dropline", "List.dropLineColor",values); + defineCustomColorGroup("color.flat.underline", "MenuItem.underlineSelectionColor",values); + defineCustomColorGroup("color.flat.docking.bg", "ToolBar.dockingBackground",values); + defineCustomColorGroup("color.flat.progressbar.bg", "ProgressBar.background",values); + defineCustomColorGroup("color.flat.progressbar.fg", "ProgressBar.foreground",values); + defineCustomColorGroup("color.flat.icon.bg", "Tree.icon.openColor",values); + defineCustomColorGroup("color.flat.selection.inactive", "Tree.selectionInactiveBackground",values); // @formatter:on diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/LookAndFeelManager.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/LookAndFeelManager.java index 27088002c1..1129c1e2c0 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/LookAndFeelManager.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/LookAndFeelManager.java @@ -39,7 +39,7 @@ public abstract class LookAndFeelManager { /** * These are color ids (see {@link GColor} used to represent general concepts that * application developers can use to get the color for that concept as defined by - * a specific {@link LookAndFeel}. This class will define some standard defaults + * a specific {@link LookAndFeel}. This class will define some standard default * mappings in the constructor, but it is expected that each specific LookAndFeelManager * will override these mappings with values appropriate for that LookAndFeel. */ diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/MacThemeGrouper.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/MacThemeGrouper.java index 19eae9bd69..7411e7abe7 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/MacThemeGrouper.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/MacThemeGrouper.java @@ -25,12 +25,12 @@ public class MacThemeGrouper extends ThemeGrouper { @Override public void group(GThemeValueMap values) { // @formatter:off - defineCustomColorGroup(values, "color.mac.disabled.fg", "Menu.disabledForeground"); - defineCustomColorGroup(values, "color.mac.button.select", "Button.select"); - defineCustomColorGroup(values, "color.mac.menu.select","Menu.selectionBackground"); - defineCustomColorGroup(values, "color.mac.seletion.inactive.bg","List.selectionInactiveBackground");//d4d4d4 + defineCustomColorGroup("color.mac.disabled.fg", "Menu.disabledForeground", values); + defineCustomColorGroup("color.mac.button.select", "Button.select", values); + defineCustomColorGroup("color.mac.menu.select", "Menu.selectionBackground",values); + defineCustomColorGroup("color.mac.seletion.inactive.bg", "List.selectionInactiveBackground",values);//d4d4d4 - defineCustomFontGroup(values, "font.mac.smallFont", "IconButton.font"); + defineCustomFontGroup("font.mac.small.font", "IconButton.font", values); // @formatter:on super.group(values); } diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/MotifThemeGrouper.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/MotifThemeGrouper.java index cbe2ead176..0b584e932d 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/MotifThemeGrouper.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/MotifThemeGrouper.java @@ -27,7 +27,7 @@ public class MotifThemeGrouper extends ThemeGrouper { @Override public void group(GThemeValueMap values) { - defineCustomFontGroup(values, "font.monospaced", "Spinner.font"); + defineCustomFontGroup("font.monospaced", "Spinner.font", values); super.group(values); } diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/NimbusThemeGrouper.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/NimbusThemeGrouper.java index e6c62ccdc7..8c977d3ee1 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/NimbusThemeGrouper.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/NimbusThemeGrouper.java @@ -34,8 +34,8 @@ public class NimbusThemeGrouper extends ThemeGrouper { @Override public void group(GThemeValueMap values) { - defineCustomColorGroup(values, "color.nimbus.text.alt", "Menu.foreground"); - defineCustomFontGroup(values, "font.titledborder", "TitledBorder.font"); + defineCustomColorGroup("color.nimbus.text.alt", "Menu.foreground", values); + defineCustomFontGroup("font.titledborder", "TitledBorder.font", values); super.group(values); } diff --git a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/ThemeGrouper.java b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/ThemeGrouper.java index 0c3259e648..420e5ee782 100644 --- a/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/ThemeGrouper.java +++ b/Ghidra/Framework/Generic/src/main/java/generic/theme/laf/ThemeGrouper.java @@ -31,12 +31,17 @@ import generic.theme.*; * organize the properties internally and this class attempts to restore that organization * as much as possible by using the values defined in the {@link BasicLookAndFeel} such as * "control", "window", "controlShadlow", etc. The fonts don't appear to have any such internal - * organization, so we created our own groups and used an exemplar property to initialize each - * group source value. Then whenever the font matched a group source value, the color is replace - * with an indirect reference to the group source property value. + * organization, so we created our own groups and used a lookAndFeel property to initialize each + * group source value. Then whenever the font matched a group source value, the font is replace + * with an indirect reference to the group source font value. *

* This class is sometimes sub-classed for a particular {@link LookAndFeel}. The subclass can * create new groups and mappings that are unique to that LookAndFeel. + * + * Often, many of the various group source ids have the same color value. To try to group + * properties as defined in BasicLookAndFeel, the preferred source ids are + * defined for each group. These will be tried first, but if a match isn't found among the + * preferred sources, then all the sources will be searched for a match */ public class ThemeGrouper { private static String DEFAULT_FONT_GROUP_ID = "font.default"; @@ -141,10 +146,6 @@ public class ThemeGrouper { "ToolTip" }; - // often the many of the various group source ids have the same color value. To try and group - // properties as defined in BasicLookAndFeel, the preferred source ids are - // defined for each group. These will be tried first, but if a match isn't found among the - // preferred sources, then all the sources will be searched for a match private static final String[] BUTTON_PREFERRED_SOURCES = { "control", "controlText", @@ -225,24 +226,42 @@ public class ThemeGrouper { groupFonts(values, groupMap); } - protected void defineCustomColorGroup(GThemeValueMap values, String customGroupName, - String exemplarComponentId) { + /** + * Defines a new color id that will be used as the reference value for any specific color ids that + * have the same color value. This will allow all those specific colors to be changed at once. + * @param customGroupColorName name of a higher level group color id that will be used as the + * value for more specific color ids defined by the lookAndFeel. + * @param lookAndFeelSourceId the lookAndFeel color id whose value will be used as the value + * for the new custom group color id + * @param values the map where we store the default theme value mappings + */ + protected void defineCustomColorGroup(String customGroupColorName, String lookAndFeelSourceId, + GThemeValueMap values) { - colorSourceProperties.add(customGroupName); - ColorValue colorValue = values.getColor(exemplarComponentId); + colorSourceProperties.add(customGroupColorName); + ColorValue colorValue = values.getColor(lookAndFeelSourceId); if (colorValue != null) { Color color = colorValue.get(values); - values.addColor(new ColorValue(customGroupName, color)); + values.addColor(new ColorValue(customGroupColorName, color)); } } - protected void defineCustomFontGroup(GThemeValueMap values, String customGroupName, - String exemplarComponentId) { - fontSourceProperties.add(customGroupName); - FontValue fontValue = values.getFont(exemplarComponentId); + /** + * Defines a new font id that will be used as the reference value for any specific font ids that + * have the same font value. This will allow all those specific fonts to be changed at once. + * @param customGroupFontName name of a higher level group font id that will be used as the + * value of more specific font ids defined by the lookAndFeel. + * @param lookAndFeelSourceId the lookAndFeel font id whose value will be used as the value + * for the new custom group font id + * @param values the map where we store the default theme value mappings + */ + protected void defineCustomFontGroup(String customGroupFontName, String lookAndFeelSourceId, + GThemeValueMap values) { + fontSourceProperties.add(customGroupFontName); + FontValue fontValue = values.getFont(lookAndFeelSourceId); if (fontValue != null) { Font font = fontValue.get(values); - values.addFont(new FontValue(customGroupName, font)); + values.addFont(new FontValue(customGroupFontName, font)); } } diff --git a/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/AbstractOptions.java b/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/AbstractOptions.java index a1fe2c2673..ac9e9e523e 100644 --- a/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/AbstractOptions.java +++ b/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/AbstractOptions.java @@ -854,6 +854,10 @@ public abstract class AbstractOptions implements Options { } private void themeChanged(ThemeEvent e) { + // We are only sending out OptionsChangedEvents in response to Font theme changes. We + // don't notify options changed for colors because we expect clients are using GColor + // which updates automatically, so should need to be notified via options. + if (!e.hasAnyFontChanged()) { return; } diff --git a/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/OptionType.java b/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/OptionType.java index ec75c49e26..b7da0fddd9 100644 --- a/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/OptionType.java +++ b/Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/OptionType.java @@ -64,6 +64,13 @@ public enum OptionType { return stringAdapter.objectToString(object); } + /** + * Return true if the give value is of the correct type for this option type. Note that a + * value of null is compatible with any class type + * since it is an acceptable value for any class type. + * @param object the object to see if it is compatible with this option type + * @return true if the give value is of the correct type for this option type. + */ public boolean isCompatible(Object object) { return object == null || clazz.isAssignableFrom(object.getClass()); } diff --git a/Ghidra/Framework/Generic/src/main/java/ghidra/util/ColorUtils.java b/Ghidra/Framework/Generic/src/main/java/ghidra/util/ColorUtils.java index 3ca088ff02..79d4f26d90 100644 --- a/Ghidra/Framework/Generic/src/main/java/ghidra/util/ColorUtils.java +++ b/Ghidra/Framework/Generic/src/main/java/ghidra/util/ColorUtils.java @@ -185,7 +185,7 @@ public class ColorUtils { private static int blend(int colorValue1, int colorValue2, double ratio) { double value = colorValue1 * ratio + colorValue2 * (1.0 - ratio); int result = (int) (value + 0.5); - return Math.max(result, 255); + return Math.min(result, 255); } /** diff --git a/Ghidra/Framework/Generic/src/main/java/ghidra/util/WebColors.java b/Ghidra/Framework/Generic/src/main/java/ghidra/util/WebColors.java index 4e309dd970..e8ba4ef344 100644 --- a/Ghidra/Framework/Generic/src/main/java/ghidra/util/WebColors.java +++ b/Ghidra/Framework/Generic/src/main/java/ghidra/util/WebColors.java @@ -25,7 +25,6 @@ import java.util.Map; * those strings back to a color. */ public abstract class WebColors { -// private static final Pattern HEX_PATTERN = Pattern.compile("(0x|#)[0-9A-Fa-f]{6}"); private static final Map nameToColorMap = new HashMap<>(); private static final Map colorToNameMap = new HashMap<>(); @@ -391,10 +390,13 @@ public abstract class WebColors { } private static int parseAlpha(String string) { + // alpha strings can either be a float between 0.0 and 1.0 or an integer from 0 to 255. + // if it is a float, treat that value as a percentage of the 255 max value + // if it is an int, don't allow the value to be bigger than 255. if (string.contains(".")) { float value = Float.parseFloat(string); - return (int) (value * 0xff + 0.5) & 0xff; + return (int) (value * 0xff + 0.5) & 0xff; // convert to value in range (0-255) } - return Integer.parseInt(string) & 0xff; + return Integer.parseInt(string) & 0xff; // truncate any bits that would make it bigger than 255 } } diff --git a/Ghidra/Framework/Generic/src/main/java/ghidra/util/datastruct/WeakStore.java b/Ghidra/Framework/Generic/src/main/java/ghidra/util/datastruct/WeakStore.java index 534376191b..32e579eed0 100644 --- a/Ghidra/Framework/Generic/src/main/java/ghidra/util/datastruct/WeakStore.java +++ b/Ghidra/Framework/Generic/src/main/java/ghidra/util/datastruct/WeakStore.java @@ -20,11 +20,11 @@ import java.lang.ref.WeakReference; import java.util.*; /** - * Class for storing weak reference to object instances. Objects of type T can be place in this - * store and they will remain there until there are no references to that object remaining. Note + * Class for storing a weak reference to object instances. Objects of type T can be placed in this + * store and they will remain there until there are no references to that object. Note * that this is not a Set and you can have multiple instances that are "equal" in this store.The * main purpose of this store is to be able to get all objects in the store that are still - * referenced. This is useful when you need to visit all remaining items. + * referenced. This is useful when you need to visit all in use items. *

* This class is thread safe. * diff --git a/Ghidra/Framework/Generic/src/main/java/resources/Icons.java b/Ghidra/Framework/Generic/src/main/java/resources/Icons.java index d16b78199e..1fbb24eaa0 100644 --- a/Ghidra/Framework/Generic/src/main/java/resources/Icons.java +++ b/Ghidra/Framework/Generic/src/main/java/resources/Icons.java @@ -53,7 +53,7 @@ public class Icons { public static final Icon NOT_ALLOWED_ICON = new GIcon("icon.not.allowed"); public static final Icon OPEN_FOLDER_ICON = new GIcon("icon.folder.open"); - public static final Icon CLOSED_FOLDER_ICON = new GIcon("icon.folder.open"); + public static final Icon CLOSED_FOLDER_ICON = new GIcon("icon.folder.closed"); public static final Icon REFRESH_ICON = new GIcon("icon.refresh"); public static final Icon SORT_ASCENDING_ICON = new GIcon("icon.sort.ascending"); diff --git a/Ghidra/Framework/Generic/src/main/java/resources/ResourceManager.java b/Ghidra/Framework/Generic/src/main/java/resources/ResourceManager.java index ccf832795c..05a040d4cb 100644 --- a/Ghidra/Framework/Generic/src/main/java/resources/ResourceManager.java +++ b/Ghidra/Framework/Generic/src/main/java/resources/ResourceManager.java @@ -482,7 +482,9 @@ public class ResourceManager { /** * Attempts to load an icon from the given path. Returns the icon or null if no icon was - * found from the given path. + * found from the given path. This differs from {@link #loadImage(String)} in that + * loadImage will return the default Icon if one can't be found. Further, loadImage will cache + * even the default value, while findIcon only caches resolved icons. *

* * @param path the icon to load, e.g., "images/home.gif" diff --git a/Ghidra/Framework/Generic/src/test/java/generic/theme/ColorValueTest.java b/Ghidra/Framework/Generic/src/test/java/generic/theme/ColorValueTest.java index ce0ef48ba0..662e33e3e5 100644 --- a/Ghidra/Framework/Generic/src/test/java/generic/theme/ColorValueTest.java +++ b/Ghidra/Framework/Generic/src/test/java/generic/theme/ColorValueTest.java @@ -57,7 +57,7 @@ public class ColorValueTest { } @Test - public void TestIndirectMultiHopValue() { + public void testIndirectMultiHopValue() { values.addColor(new ColorValue("color.grandparent", Color.RED)); values.addColor(new ColorValue("color.parent", "color.grandparent")); ColorValue value = new ColorValue("color.test", "color.parent"); @@ -69,7 +69,7 @@ public class ColorValueTest { } @Test - public void TestUnresolvedIndirectValue() { + public void testUnresolvedIndirectValue() { ColorValue value = new ColorValue("color.test", "color.parent"); values.addColor(value); diff --git a/Ghidra/Framework/Generic/src/test/java/ghidra/util/HTMLUtilitiesTest.java b/Ghidra/Framework/Generic/src/test/java/ghidra/util/HTMLUtilitiesTest.java index d45c9d2e25..d9fda2ff81 100644 --- a/Ghidra/Framework/Generic/src/test/java/ghidra/util/HTMLUtilitiesTest.java +++ b/Ghidra/Framework/Generic/src/test/java/ghidra/util/HTMLUtilitiesTest.java @@ -18,6 +18,8 @@ package ghidra.util; import static ghidra.util.HTMLUtilities.*; import static org.junit.Assert.*; +import java.awt.Color; + import org.junit.Before; import org.junit.Test; @@ -126,13 +128,13 @@ public class HTMLUtilitiesTest { @Test public void testToRGBString() { - String rgb = HTMLUtilities.toRGBString(WebColors.RED); + String rgb = HTMLUtilities.toRGBString(Color.RED); assertEquals("255000000", rgb); } @Test public void testToHexString() { - String rgb = HTMLUtilities.toHexString(WebColors.RED); + String rgb = HTMLUtilities.toHexString(Color.RED); assertEquals("#FF0000", rgb); } diff --git a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/edge/routing/ArticulatedEdgeRouter.java b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/edge/routing/ArticulatedEdgeRouter.java index 92edb50f97..f7d77557a0 100644 --- a/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/edge/routing/ArticulatedEdgeRouter.java +++ b/Ghidra/Framework/Graph/src/main/java/ghidra/graph/viewer/edge/routing/ArticulatedEdgeRouter.java @@ -321,7 +321,7 @@ class ArticulatedEdgeRouter> private Color getRoutingBoxColor(E edge) { if (isTrueEdge(edge)) { - return new GColor("color.palette.magenta"); + return Palette.MAGENTA; } return Palette.ORANGE; } diff --git a/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/support/TextAreaTestVertex.java b/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/support/TextAreaTestVertex.java index 4831a8b121..988d143b8f 100644 --- a/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/support/TextAreaTestVertex.java +++ b/Ghidra/Framework/Graph/src/test.slow/java/ghidra/graph/support/TextAreaTestVertex.java @@ -23,7 +23,6 @@ import java.beans.PropertyChangeListener; import javax.swing.*; import docking.GenericHeader; -import generic.theme.GColor; import generic.theme.GThemeDefaults.Colors.Palette; import ghidra.graph.graphs.AbstractTestVertex; @@ -41,7 +40,7 @@ public class TextAreaTestVertex extends AbstractTestVertex { textArea.setText(name); textArea.setPreferredSize(new Dimension(200, 50)); - textArea.setBackground(new GColor("color.palette.darkkhaki")); + textArea.setBackground(Palette.getColor("darkkhaki")); textArea.setCaretColor(Palette.PINK); textArea.setBorder(BorderFactory.createRaisedBevelBorder()); textArea.setLineWrap(true); diff --git a/Ghidra/Framework/Help/src/main/java/help/GHelpHTMLEditorKit.java b/Ghidra/Framework/Help/src/main/java/help/GHelpHTMLEditorKit.java index 62168f89ee..408489c265 100644 --- a/Ghidra/Framework/Help/src/main/java/help/GHelpHTMLEditorKit.java +++ b/Ghidra/Framework/Help/src/main/java/help/GHelpHTMLEditorKit.java @@ -483,7 +483,7 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { String srcString = src.toString(); - //check if the icon is a defined icon theme id + // check if the srcString is a defined theme icon id if (Gui.hasIcon(srcString)) { return new GIcon(srcString).getUrl(); } diff --git a/Ghidra/Framework/Project/certification.manifest b/Ghidra/Framework/Project/certification.manifest index 045c9ea18f..ec700e3b9d 100644 --- a/Ghidra/Framework/Project/certification.manifest +++ b/Ghidra/Framework/Project/certification.manifest @@ -25,18 +25,15 @@ src/main/resources/images/allInTool.gif||GHIDRA||reviewed||END| src/main/resources/images/applications-development-web.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END| src/main/resources/images/applications-science.png||Oxygen Icons - LGPL 3.0||||END| src/main/resources/images/bug.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END| -src/main/resources/images/check.png||GHIDRA||reviewed||END| src/main/resources/images/checkNotLatest.gif||GHIDRA||reviewed||END| src/main/resources/images/checkex.png||GHIDRA||reviewed||END| src/main/resources/images/checkmark_green.gif||GHIDRA||reviewed||END| -src/main/resources/images/closedSmallFolder.png||Modified Nuvola Icons - LGPL 2.1||||END| src/main/resources/images/connected.gif||GHIDRA||reviewed||END| src/main/resources/images/cut_red.png||FAMFAMFAM Icons - CC 2.5||||END| src/main/resources/images/defaultIndicator.png||GHIDRA||reviewed||END| src/main/resources/images/dialog-cancel.png||Oxygen Icons - LGPL 3.0||||END| src/main/resources/images/disconnected.gif||GHIDRA||reviewed||END| src/main/resources/images/disk.png||FAMFAMFAM Icons - CC 2.5||||END| -src/main/resources/images/disk_save_as.png||FAMFAMFAM Icons - CC 2.5|||modified silk icon disk_multiple.png|END| src/main/resources/images/face-glasses.png||Tango Icons - Public Domain|||tango icon set|END| src/main/resources/images/folder_add.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END| src/main/resources/images/lock.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END| @@ -46,7 +43,6 @@ src/main/resources/images/page_add.png||FAMFAMFAM Icons - CC 2.5||||END| src/main/resources/images/page_copy.png||FAMFAMFAM Icons - CC 2.5||||END| src/main/resources/images/page_delete.png||FAMFAMFAM Icons - CC 2.5||||END| src/main/resources/images/page_edit.png||FAMFAMFAM Icons - CC 2.5||||END| -src/main/resources/images/page_paste.png||FAMFAMFAM Icons - CC 2.5||||END| src/main/resources/images/plasma.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END| src/main/resources/images/plugin.png||GHIDRA||reviewed||END| src/main/resources/images/small_hijack.gif||GHIDRA||reviewed||END| diff --git a/Ghidra/Framework/Project/data/project.theme.properties b/Ghidra/Framework/Project/data/project.theme.properties index b9533c2bbe..36e6c996dc 100644 --- a/Ghidra/Framework/Project/data/project.theme.properties +++ b/Ghidra/Framework/Project/data/project.theme.properties @@ -83,9 +83,9 @@ icon.extension.configure = plugin.png icon.plugin.manager.default = plasma.png font.help.about = font.monospaced -font.keybindings.status = SansSerif-PLAIN-11 -font.task.viewer = SansSerif-BOLD-36 -font.user.agreement = SansSerif-PLAIN-16 +font.keybindings.status = sansserif-plain-11 +font.task.viewer = sansserif-bold-36 +font.user.agreement = sansserif-plain-16 [Dark Defaults] diff --git a/GhidraBuild/Skeleton/src/main/help/help/shared/Frontpage.css b/GhidraBuild/Skeleton/src/main/help/help/shared/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/GhidraBuild/Skeleton/src/main/help/help/shared/Frontpage.css +++ b/GhidraBuild/Skeleton/src/main/help/help/shared/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/GhidraDocs/languages/html/Frontpage.css b/GhidraDocs/languages/html/Frontpage.css index b8471669f4..557c37ca39 100644 --- a/GhidraDocs/languages/html/Frontpage.css +++ b/GhidraDocs/languages/html/Frontpage.css @@ -28,7 +28,7 @@ body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 1 li { font-family:times new roman; font-size:14pt; } h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; } h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; } -h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; `font-size:14pt; font-weight:bold; } +h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; } h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; } /* diff --git a/gradle/helpProject.gradle b/gradle/helpProject.gradle index 0bfe584944..c3b422173e 100644 --- a/gradle/helpProject.gradle +++ b/gradle/helpProject.gradle @@ -142,7 +142,7 @@ task buildHelp(type: JavaExec, dependsOn: indexHelp) { inputs.dir file('src/main/help'); File resourcesDir = file('src/main/resources') if (resourcesDir.exists()) { - inputs.dir file('src/main/resources'); + inputs.dir resourcesDir } outputs.dir outputDir