Skip to content

Commit

Permalink
Tracing and VarWatching support. Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Oct 20, 2000
1 parent 8bce759 commit 2793826
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions last/toby/gui/TobyMenuBar.java
Expand Up @@ -65,10 +65,9 @@ public final class TobyMenuBar extends JMenuBar implements ActionListener,

public JMenu debugMenu;
public JMenuItem stepItem;
public JMenuItem traceItem;
public JCheckBoxMenuItem traceItem;
public JCheckBoxMenuItem watchVarsItem;


private JMenuItem setupMenuItem(JMenu m, String itemStr,
boolean isEnabled, KeyStroke keys)
{
Expand Down Expand Up @@ -184,6 +183,10 @@ public void setSaveEnabled(boolean savable)

private void doStep()
{
TobyInputArea tia = parent.getTobyPanel().getInputArea();
if (tia != null)
tia.setTracing(true);

if (this.globalContext != null)
{
this.globalContext.pauseExecution();
Expand All @@ -199,23 +202,27 @@ private void doStep()

private void setupTrace(JCheckBoxMenuItem cbmi)
{
System.err.println("*** last.toby.gui.TobyMenuBar.setupTrace(): This is stubbed.");
// parent.getTobyPanel().getTurtleSpace().enableTracing(cbmi.getState());
boolean val = cbmi.getState();
if (this.globalContext != null)
this.globalContext.setTracing(val);

TobyInputArea tia = parent.getTobyPanel().getInputArea();
if (tia != null)
tia.setTracing(val);
} // setupTrace


private void setupWatchVars(JCheckBoxMenuItem cbmi)
{
System.err.println("*** last.toby.gui.TobyMenuBar.setupWatchVars(): This is stubbed.");
/*
TurtleSpace tspace = parent.getTobyPanel().getTurtleSpace();
VarWatcher vw = parent.getTobyPanel().getVarWatcher();

if (this.globalContext == null)
return;

if (cbmi.getState()) // true == enable variable watching.
tspace.addVarWatcher(vw);
this.globalContext.addVarWatcher(vw);
else
tspace.removeVarWatcher(vw);
*/
this.globalContext.removeVarWatcher(vw);
} // setupWatchVars


Expand All @@ -241,7 +248,8 @@ else if (mi == quitItem)
parent.requestToQuit();

else if (mi == helpItem)
// parent.displayHelp();
parent.displayHelp();
/*
// !!!
{
// try
Expand All @@ -261,6 +269,7 @@ else if (mi == helpItem)
// } // catch
} // else if
*/

else if (mi == aboutItem)
parent.createAboutBox();
Expand Down Expand Up @@ -352,6 +361,9 @@ public void run()
this.globalContext.addSourceWatcher(this);
this.globalContext.addSourceWatcher(tia);

setupTrace(this.traceItem);
setupWatchVars(this.watchVarsItem);

if (this.startWithStep == false)
this.globalContext.execute();
else
Expand Down

0 comments on commit 2793826

Please sign in to comment.