diff options
Diffstat (limited to 'sources/simulator')
| -rw-r--r-- | sources/simulator/VSSimulator.java | 1 | ||||
| -rw-r--r-- | sources/simulator/VSSimulatorCanvas.java | 51 |
2 files changed, 51 insertions, 1 deletions
diff --git a/sources/simulator/VSSimulator.java b/sources/simulator/VSSimulator.java index 222fe62..8795c43 100644 --- a/sources/simulator/VSSimulator.java +++ b/sources/simulator/VSSimulator.java @@ -1505,5 +1505,6 @@ public class VSSimulator extends JPanel implements VSSerializable { updateFromPrefs(); updateTaskManagerTable(); updateProcessesComboBox(); + processesComboBox.setSelectedIndex(processesComboBox.getItemCount()-1); } } 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 |
