mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Theme-aware icons for the main window menu bar and Playlist Editor tab (#2493)
The main window's font-glyph icons were rendered with IconFontSwing.buildIcon, which bakes a fixed colour into the image (black by default, DARK_GRAY for the Playlist Editor tab), so the Screen Capture camera, the Playlist Editor tab icon and the View menu icons ignored the selected theme and were nearly invisible on dark themes. Adds ThemedFontIcon, which resolves its colour from UIManager at paint time (Label.foreground, MenuItem.selectionForeground while a menu item is armed, Label.disabledForeground when disabled) and re-renders only when the colour changes, so icons follow theme switches without a restart. Claude-Session: https://claude.ai/code/session_01TDsxnQntujmycg3aJyRsuN Co-authored-by: Dennis Sheirer <dennis.sheirer@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,7 +32,7 @@ import java.awt.EventQueue;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import jiconfont.icons.font_awesome.FontAwesome;
|
||||
import jiconfont.swing.IconFontSwing;
|
||||
import io.github.dsheirer.gui.theme.ThemedFontIcon;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import javax.sound.sampled.FloatControl;
|
||||
@@ -152,7 +152,7 @@ public class AudioPanel extends JPanel implements Listener<AudioEvent>
|
||||
{
|
||||
JPopupMenu popup = new JPopupMenu();
|
||||
JMenuItem outputMenu = new JMenuItem("Audio Playback Device ...");
|
||||
Icon icon = IconFontSwing.buildIcon(FontAwesome.COG, 14);
|
||||
Icon icon = new ThemedFontIcon(FontAwesome.COG, 14);
|
||||
outputMenu.setIcon(icon);
|
||||
outputMenu.addActionListener(e -> MyEventBus.getGlobalEventBus()
|
||||
.post(new ViewUserPreferenceEditorRequest(PreferenceEditorType.AUDIO_OUTPUT)));
|
||||
@@ -164,7 +164,7 @@ public class AudioPanel extends JPanel implements Listener<AudioEvent>
|
||||
popup.add(new JPopupMenu.Separator());
|
||||
JMenuItem volume = new JMenuItem("Audio Volume");
|
||||
volume.setEnabled(false);
|
||||
Icon volumeIcon = IconFontSwing.buildIcon(FontAwesome.VOLUME_UP, 14);
|
||||
Icon volumeIcon = new ThemedFontIcon(FontAwesome.VOLUME_UP, 14);
|
||||
volume.setIcon(volumeIcon);
|
||||
popup.add(volume);
|
||||
popup.add(new VolumeSlider(mAudioPlaybackManager.getAudioOutput().getGainControl()));
|
||||
|
||||
Reference in New Issue
Block a user