From fa7b7c34a0e2a9ad5eabe2d20a56d55532492f3a Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 11 Nov 2024 12:49:53 -0600 Subject: [PATCH] Scale search result icons by ImageJ scale factor --- pom.xml | 2 ++ src/main/java/net/imagej/legacy/IJ1Helper.java | 4 ++++ src/main/java/net/imagej/legacy/search/SearchBarHacker.java | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/pom.xml b/pom.xml index 9dee90ef..f409be2c 100644 --- a/pom.xml +++ b/pom.xml @@ -184,6 +184,8 @@ sign,deploy-to-scijava + + 3.0.0 diff --git a/src/main/java/net/imagej/legacy/IJ1Helper.java b/src/main/java/net/imagej/legacy/IJ1Helper.java index 72f1c7af..a1d4cfa2 100644 --- a/src/main/java/net/imagej/legacy/IJ1Helper.java +++ b/src/main/java/net/imagej/legacy/IJ1Helper.java @@ -284,6 +284,10 @@ public boolean isRMIEnabled() { return Prefs.runSocketListener; } + public double guiScale() { + return Prefs.getGuiScale(); + } + private boolean batchMode; void setBatchMode(final boolean batch) { diff --git a/src/main/java/net/imagej/legacy/search/SearchBarHacker.java b/src/main/java/net/imagej/legacy/search/SearchBarHacker.java index 0e3344f4..3822405b 100644 --- a/src/main/java/net/imagej/legacy/search/SearchBarHacker.java +++ b/src/main/java/net/imagej/legacy/search/SearchBarHacker.java @@ -93,6 +93,9 @@ public Object addSearchBar(final Object imagej, final IJ1Helper ij1Helper) { resultLimit); } + // Scale search result icons to match original ImageJ settings. + int iconSize = (int) (16 * ij1Helper.guiScale()); + final Component[] ijc = ((Container) imagej).getComponents(); if (ijc.length < 2) return null; final Component ijc1 = ijc[1]; @@ -168,6 +171,7 @@ protected void hidePanel(final Container p) { } searchBar.setMouseoverEnabled(mouseoverEnabled); searchBar.setResultLimit(resultLimit); + searchBar.setIconSize(iconSize); // add toolbar buttons // NB: Unfortunately, the gear (\u2699) does not appear on MacOS.