From 970b68aa8a0575acc300a6187fad150edec0d628 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Thu, 19 Aug 2010 03:27:29 +0300 Subject: [PATCH] Add emuname for telling apart multiple emulators Telling apart multiple emulators open at once could be useful, so add option to add string to window titles. --- Changelog.utf8 | 1 + org/jpc/Misc.java | 6 ++++++ org/jpc/j2se/JPCApplication.java | 2 ++ org/jpc/plugins/JoystickInput.java | 3 ++- org/jpc/plugins/LuaPlugin.java | 3 ++- org/jpc/plugins/PCControl.java | 3 ++- org/jpc/plugins/PCMonitor.java | 3 ++- org/jpc/plugins/PCStartStopTest.java | 3 ++- org/jpc/plugins/TimeDisplay.java | 3 ++- org/jpc/plugins/VirtualKeyboard.java | 3 ++- 10 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Changelog.utf8 b/Changelog.utf8 index 3bd4766..d174d89 100644 --- a/Changelog.utf8 +++ b/Changelog.utf8 @@ -46,6 +46,7 @@ Changes since JPC-RR Release 10.5: - Don't loadstate via DnD when running. - Add option to dump every frame with frametimes. - Fix NPE when canceling loadstate. +- Add emuname for telling apart multiple emulators. Changes from JPC-RR Release 10.14 to JPC-RR Release 10.15: ========================================================== diff --git a/org/jpc/Misc.java b/org/jpc/Misc.java index c992cad..c17356f 100644 --- a/org/jpc/Misc.java +++ b/org/jpc/Misc.java @@ -46,6 +46,12 @@ import static org.jpc.Revision.getRelease; public class Misc { private static boolean renameOverSupported; + public static String emuname; + + static + { + emuname = ""; + } public static String randomHexes(int bytes) { diff --git a/org/jpc/j2se/JPCApplication.java b/org/jpc/j2se/JPCApplication.java index ca0b555..7fa5350 100644 --- a/org/jpc/j2se/JPCApplication.java +++ b/org/jpc/j2se/JPCApplication.java @@ -287,6 +287,8 @@ public class JPCApplication } else if(cmd.toLowerCase().equals("exit")) { pluginManager.shutdownEmulator(); } else if(cmd.toLowerCase().equals("")) { + } else if(cmd.toLowerCase().startsWith("emuname ")) { + Misc.emuname = "[" + cmd.substring(8) + "]"; } else if(cmd.toLowerCase().startsWith("command ")) { try { String[] arr = parseString(cmd.substring(8)); diff --git a/org/jpc/plugins/JoystickInput.java b/org/jpc/plugins/JoystickInput.java index 5d31854..0e00cb4 100644 --- a/org/jpc/plugins/JoystickInput.java +++ b/org/jpc/plugins/JoystickInput.java @@ -34,6 +34,7 @@ import org.jpc.pluginsbase.Plugins; import org.jpc.pluginsbase.Plugin; import static org.jpc.Misc.errorDialog; import static org.jpc.Misc.moveWindow; +import org.jpc.Misc; import javax.swing.*; import java.io.*; @@ -60,7 +61,7 @@ public class JoystickInput implements ActionListener, Plugin public JoystickInput(Plugins _pluginManager) { pluginManager = _pluginManager; - window = new JFrame("Joystick input"); + window = new JFrame("Joystick input" + Misc.emuname); GridLayout layout = new GridLayout(0, 4); panel = new JPanel(layout); window.add(panel); diff --git a/org/jpc/plugins/LuaPlugin.java b/org/jpc/plugins/LuaPlugin.java index 3086192..527ba96 100644 --- a/org/jpc/plugins/LuaPlugin.java +++ b/org/jpc/plugins/LuaPlugin.java @@ -37,6 +37,7 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.lang.reflect.*; +import org.jpc.Misc; import org.jpc.emulator.PC; import org.jpc.emulator.HardwareComponent; @@ -855,7 +856,7 @@ public class LuaPlugin implements ActionListener, Plugin if(specialNoGUIMode) return; - window = new JFrame("Lua window"); + window = new JFrame("Lua window" + Misc.emuname); GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); panel = new JPanel(layout); diff --git a/org/jpc/plugins/PCControl.java b/org/jpc/plugins/PCControl.java index ed9742c..9f988c8 100644 --- a/org/jpc/plugins/PCControl.java +++ b/org/jpc/plugins/PCControl.java @@ -59,6 +59,7 @@ import org.jpc.pluginsaux.MenuManager; import org.jpc.pluginsaux.PCMonitorPanel; import org.jpc.pluginsaux.PCMonitorPanelEmbedder; import org.jpc.pluginsaux.ImportDiskImage; +import org.jpc.Misc; import org.jpc.pluginsbase.*; import org.jpc.jrsr.*; @@ -682,7 +683,7 @@ public class PCControl implements Plugin, PCMonitorPanelEmbedder public PCControl(Plugins manager) throws Exception { - window = new JFrame("JPC-RR"); + window = new JFrame("JPC-RR" + Misc.emuname); if(DiskImage.getLibrary() == null) throw new Exception("PCControl plugin requires disk library"); diff --git a/org/jpc/plugins/PCMonitor.java b/org/jpc/plugins/PCMonitor.java index ce17934..f95ccb4 100644 --- a/org/jpc/plugins/PCMonitor.java +++ b/org/jpc/plugins/PCMonitor.java @@ -38,6 +38,7 @@ import org.jpc.pluginsbase.Plugin; import org.jpc.pluginsaux.HUDRenderer; import org.jpc.pluginsaux.PCMonitorPanel; import org.jpc.pluginsaux.PCMonitorPanelEmbedder; +import org.jpc.Misc; import java.io.*; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; @@ -64,7 +65,7 @@ public class PCMonitor implements Plugin, PCMonitorPanelEmbedder panel = new PCMonitorPanel(this); manager.addSlaveObject(this, panel); - monitorWindow = new JFrame("VGA Monitor"); + monitorWindow = new JFrame("VGA Monitor" + Misc.emuname); monitorWindow.getContentPane().add("Center", panel.getMonitorPanel()); JMenuBar bar = new JMenuBar(); for(JMenu menu : panel.getMenusNeeded()) diff --git a/org/jpc/plugins/PCStartStopTest.java b/org/jpc/plugins/PCStartStopTest.java index 4a81d56..413ea2a 100644 --- a/org/jpc/plugins/PCStartStopTest.java +++ b/org/jpc/plugins/PCStartStopTest.java @@ -38,6 +38,7 @@ import org.jpc.pluginsbase.Plugins; import org.jpc.pluginsbase.Plugin; import org.jpc.emulator.PC; import org.jpc.emulator.peripheral.Keyboard; +import org.jpc.Misc; import static org.jpc.Misc.errorDialog; import static org.jpc.Misc.moveWindow; @@ -90,7 +91,7 @@ public class PCStartStopTest extends JFrame implements Plugin public PCStartStopTest(Plugins manager) throws Exception { - super("Control test"); + super("Control test" + Misc.emuname); this.vPluginManager = manager; diff --git a/org/jpc/plugins/TimeDisplay.java b/org/jpc/plugins/TimeDisplay.java index 0484b1c..2b47d84 100644 --- a/org/jpc/plugins/TimeDisplay.java +++ b/org/jpc/plugins/TimeDisplay.java @@ -32,6 +32,7 @@ package org.jpc.plugins; import org.jpc.emulator.PC; import org.jpc.emulator.Clock; import org.jpc.emulator.EventRecorder; +import org.jpc.Misc; import org.jpc.pluginsbase.Plugins; import org.jpc.pluginsbase.Plugin; import static org.jpc.Misc.moveWindow; @@ -58,7 +59,7 @@ public class TimeDisplay implements Plugin { pluginManager = _pluginManager; pc = null; - window = new JFrame("Time Display"); + window = new JFrame("Time Display" + Misc.emuname); panel = new JPanel(); window.add(panel); display = new JLabel("Time: "); diff --git a/org/jpc/plugins/VirtualKeyboard.java b/org/jpc/plugins/VirtualKeyboard.java index a9ed947..9ed032b 100644 --- a/org/jpc/plugins/VirtualKeyboard.java +++ b/org/jpc/plugins/VirtualKeyboard.java @@ -37,6 +37,7 @@ import org.jpc.jrsr.UTFInputLineStream; import org.jpc.pluginsbase.Plugins; import org.jpc.pluginsbase.Plugin; import org.jpc.pluginsaux.ConstantTableLayout; +import org.jpc.Misc; import static org.jpc.Misc.errorDialog; import static org.jpc.Misc.moveWindow; import static org.jpc.Misc.parseStringToComponents; @@ -132,7 +133,7 @@ public class VirtualKeyboard implements ActionListener, Plugin, KeyboardStatusLi keyboard = null; commandToKey = new HashMap(); commandToButton = new HashMap(); - window = new JFrame("Virtual Keyboard"); + window = new JFrame("Virtual Keyboard" + Misc.emuname); ConstantTableLayout layout = new ConstantTableLayout(); cachedState = new boolean[256]; panel = new JPanel(layout); -- 2.11.4.GIT