summaryrefslogtreecommitdiff
path: root/sources/simulator/VSSimulatorCanvas.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-06-14 02:42:02 +0000
committerPaul Buetow <paul@buetow.org>2008-06-14 02:42:02 +0000
commitd0a6bcb2d758dc488013edc16b3280a0fb2a6a71 (patch)
treeaf3f7ba8f2c3b9565c5935f3ff683be2e85851c0 /sources/simulator/VSSimulatorCanvas.java
parent02eb6a4ff881ad9878a1105c6737e1583c94ed7e (diff)
deserialized processes always open with 'All processes' tab.
Diffstat (limited to 'sources/simulator/VSSimulatorCanvas.java')
-rw-r--r--sources/simulator/VSSimulatorCanvas.java51
1 files changed, 50 insertions, 1 deletions
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);
@@ -594,6 +601,29 @@ public class VSSimulatorCanvas extends Canvas
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(
finalPrefs.getString("lang.process.add.new"));
@@ -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
*
@@ -1056,6 +1086,25 @@ public class VSSimulatorCanvas extends Canvas
}
/**
+ * 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.
*
* @param i the process num