From d0a6bcb2d758dc488013edc16b3280a0fb2a6a71 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 14 Jun 2008 02:42:02 +0000 Subject: deserialized processes always open with 'All processes' tab. --- sources/simulator/VSSimulatorCanvas.java | 51 +++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'sources/simulator/VSSimulatorCanvas.java') diff --git a/sources/simulator/VSSimulatorCanvas.java b/sources/simulator/VSSimulatorCanvas.java index 7309d75..e0be2e8 100644 --- a/sources/simulator/VSSimulatorCanvas.java +++ b/sources/simulator/VSSimulatorCanvas.java @@ -556,6 +556,13 @@ public class VSSimulatorCanvas extends Canvas JPopupMenu popup = new JPopupMenu(); JMenuItem item = new JMenuItem( + finalPrefs.getString("lang.process.selected") + + ": " + process.getProcessID()); + item.setEnabled(false); + popup.add(item); + popup.addSeparator(); + + item = new JMenuItem( finalPrefs.getString("lang.process.edit")); if (process == null) item.setEnabled(false); @@ -592,6 +599,29 @@ public class VSSimulatorCanvas extends Canvas item.addActionListener(actionListener); popup.add(item); + popup.addSeparator(); + + long xPosTime = getXPositionTime(me.getX()); + String timeString = finalPrefs.getString( + "lang.event.add.time") + + " " + xPosTime + "ms"; + + item = new JMenuItem( + finalPrefs.getString("lang.event.add.local") + + " " + timeString); + item.addActionListener(actionListener); + item.setEnabled(false); + popup.add(item); + + if (finalPrefs.getBoolean("sim.mode.expert")) { + item = new JMenuItem( + finalPrefs.getString("lang.event.add.global") + + " " + timeString); + item.addActionListener(actionListener); + item.setEnabled(false); + popup.add(item); + } + popup.addSeparator(); item = new JMenuItem( @@ -1045,7 +1075,7 @@ public class VSSimulatorCanvas extends Canvas } /** - * Gets the time x position. + * Gets the x position of the given time. * * @param time the time * @@ -1055,6 +1085,25 @@ public class VSSimulatorCanvas extends Canvas return XOFFSET + xpaintsize_dividedby_untiltime * time; } + /** + * Gets the time of a given x position + * + * @param xPos the x position + * + * @return the time + */ + private long getXPositionTime(double xPos) { + xPos -= XOFFSET; + + if (xPos <= 0) + return 0; + + else if (xPos >= xPaintSize) + return untilTime; + + return (long) ((untilTime/xPaintSize) * xPos); + } + /** * Gets the process y position. * -- cgit v1.2.3