private void font(object sender, EventArgs __) { if (sender == miSourceFont) { font(ref EsotericIDEProgram.Settings.SourceFont, f => txtSource.Font = f.Font); } else if (sender == miOutputFont) { font(ref EsotericIDEProgram.Settings.OutputFont, f => txtOutput.Font = f.Font); } else if (sender == miWatchFont) { font(ref EsotericIDEProgram.Settings.WatchFont, f => { if (_env != null) { _env.SetWatchWindowFont(f); } else { // Assume that the notRunningLabel is there tabWatch.Controls[0].Font = f.Font; tabWatch.Controls[0].ForeColor = f.Color; } }); } }
private bool compile(ExecutionState state) { removeRunToCursorBreakpoint(); _currentPosition = null; if (_env != null) { _env.State = state; return(true); } if (_saveWhenRun) { save(); } try { _env = _currentLanguage.Compile(txtSource.Text, _input ?? ""); _env.OriginalSource = txtSource.Text; _env.State = state; _env.DebuggerBreak += p => { this.BeginInvoke(new Action(() => debuggerBreak(p))); }; _env.ExecutionFinished += (c, e) => { this.BeginInvoke(new Action(() => executionFinished(c, e))); }; foreach (int bp in lstBreakpoints.Items) { _env.AddBreakpoint(bp); } _env.BreakpointsChanged += () => { this.BeginInvoke(new Action(() => breakpointsChanged())); }; tabWatch.Controls.Clear(); tabWatch.Controls.Add(_env.InitializeWatchWindow()); if (EsotericIDEProgram.Settings.WatchFont != null) { _env.SetWatchWindowFont(EsotericIDEProgram.Settings.WatchFont); } return(true); } catch (CompileException e) { if (e.Index != null) { txtSource.Focus(); txtSource.SelectionStart = e.Index.Value; txtSource.SelectionLength = e.Length ?? 0; txtSource.ScrollToCaret(); } DlgMessage.Show("Compilation failed:" + Environment.NewLine + e.Message, "Esoteric IDE", DlgType.Error, "&OK"); return(false); } catch (Exception e) { DlgMessage.Show("Compilation failed:" + Environment.NewLine + e.Message + " (" + e.GetType().FullName + ")", "Esoteric IDE", DlgType.Error, "&OK"); return(false); } }