void ErrorView_DoubleClick(object sender, EventArgs e) { if (SelectedItems.Count == 1) { ActionResult ar = (ActionResult)SelectedItems[0].Tag; if (!File.Exists(ar.Location.Filename)) { return; } AdvancedTextBox atb = (ServiceHost.Project.Current == null ? ServiceHost.File.Open(ar.Location.Filename) : ServiceHost.Project.Current.OpenFile(ar.Location.Filename)) as AdvancedTextBox; if (atb != null) { if (ar.Location.LineNumber > 0) { atb.Buffer.SelectLocation(ar.Location); atb.ScrollToCaret(); } ServiceHost.File.BringToFront(atb); } } }
protected override void SwitchView(IDocument newview, IDocument oldview) { if (newview is AdvancedTextBox) { if (tempfilename != null && File.Exists(tempfilename)) { File.Delete(tempfilename); } } else { AdvancedTextBox atb = oldview as AdvancedTextBox; tempfilename = Path.Combine(Path.GetDirectoryName(atb.Buffer.FileName), "XmlControl.TMP" + Path.GetExtension(atb.Buffer.FileName)); XmlControl g = newview as XmlControl; TextWriter w = File.CreateText(tempfilename); atb.Buffer.SaveInternal(w, false); w.Close(); g.Url = Path.GetFullPath(tempfilename); } }
void classes_SelectedIndexChanged(object sender, EventArgs e) { AdvancedTextBox atb = ServiceHost.File[codefile.Fullname] as AdvancedTextBox; if (atb != null) { ICodeType ct = classes.SelectedItem as ICodeType; if (ct != null) { List <ICodeMember> mems = new List <ICodeMember>(); foreach (ICodeMember cm in ct.Members) { if (!(cm is ICodeType)) { mems.Add(cm); } } mems.Sort(delegate(ICodeMember a, ICodeMember b) { return(a.Name.CompareTo(b.Name)); }); members.DataSource = mems; if (!binding) { atb.Buffer.SelectLocation(ct.Location); atb.ScrollToCaretUpper(); atb.Select(); } } } }
void BpBoundChange(object sender, EventArgs e) { Breakpoint bp = sender as Breakpoint; if (bp != null) { tempbp = bp; } else { bp = tempbp; } if (InvokeRequired) { BeginInvoke(bpboundchange, new object[] { sender, e }); return; } AdvancedTextBox atb = ServiceHost.File[bp.filename] as AdvancedTextBox; if (atb != null) { atb.Invalidate(); } }
void SendProbe() { AdvancedTextBox atb = ServiceHost.File[ServiceHost.File.Current] as AdvancedTextBox; //System.Diagnostics.Debugger.Break(); atb.Buffer.SendProbe(); }
public void ChangeLog() { AdvancedTextBox atb = ServiceHost.File.Open(Application.StartupPath + Path.DirectorySeparatorChar + "ChangeLog.txt") as AdvancedTextBox; atb.ReadOnly = true; }
void ToggleAllBPState() { Project proj = ServiceHost.Project.Current; IFileManagerService fm = ServiceHost.File; AdvancedTextBox atb = fm[fm.Current] as AdvancedTextBox; if (atb != null) { int cline = atb.Buffer.CurrentLine; Hashtable bpsmap = proj.GetBreakpoints(fm.Current); if (bpsmap != null) { ArrayList bps = new ArrayList(bpsmap.Values); foreach (Breakpoint bp in bps) { bp.enabled = allbp; } atb.Invalidate(); allbp = !allbp; } } }
void ToggleBP() { Project proj = ServiceHost.Project.Current; IFileManagerService fm = ServiceHost.File; AdvancedTextBox atb = fm[fm.Current] as AdvancedTextBox; if (atb != null) { int cline = atb.Buffer.CurrentLine; Breakpoint bp = proj.GetBreakpoint(fm.Current, cline); if (bp != null) { RemoveBreakpoint(bp); proj.RemoveBreakpoint(bp); } else { bp = InsertBreakpoint(fm.Current, cline); if (bp.bound) { proj.SetBreakpoint(bp); } } atb.Invalidate(); } }
public void AutoCompletePreviousPage() { AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null) { atb.AutoCompletePreviousPage(); } }
public void AutoCompleteNextChoice() { AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null) { atb.AutoCompleteNextChoice(); } }
public void ShowAutoComplete() { AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null && atb.Focused) { atb.ShowAutoComplete(); } }
public void SelectLine() { AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null && atb.Focused) { atb.SelectLine(); } }
public void RemoveAfter() { AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null && atb.Focused) { atb.RemoveAfter(); } }
public void GotoPreviousToken() { AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null && atb.Focused) { atb.GotoPreviousToken(); } }
public void GotoLastLine() { AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null && ((Control)atb).Focused) { atb.GotoLastLine(); } }
public void HideAutoComplete() { AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null) { atb.HideAutoComplete(); } }
void StripSpace() { AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null && atb.Focused) { atb.StripTrailingWhiteSpace(); } }
public void TraceLog() { AdvancedTextBox atb = ServiceHost.File.Open(Application.StartupPath + Path.DirectorySeparatorChar + "TraceLog.txt") as AdvancedTextBox; atb.Text = Diagnostics.Trace.GetFullTrace(); atb.ReadOnly = true; }
public void AutoCompleteSelectChoice() { AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null) { achack = true; atb.AutoCompleteSelectChoice(); } }
void EditProfile() { IFileManagerService fm = ServiceHost.File; AdvancedTextBox atb = fm.Open(Application.StartupPath + Path.DirectorySeparatorChar + "profile.ls") as AdvancedTextBox; atb.AutoSave = true; atb.ProjectHint = proj; }
void BreakLine() { AdvancedTextBox atb = ServiceHost.File[ServiceHost.File.Current] as AdvancedTextBox; AdvancedTextBox.TextBuffer.TokenLine tl = atb.Buffer.GetUserState(atb.Buffer.CurrentLine); AdvancedTextBox.TextBuffer.DrawInfo[] di = atb.Buffer.GetDrawCache(atb.Buffer.CurrentLine); IDebugService dbg = ServiceHost.Debug; System.Diagnostics.Debugger.Break(); Console.WriteLine("{0}{1}", tl, di); atb.Buffer.SetDrawCache(atb.Buffer.CurrentLine, null); atb.Invalidate(); }
void members_SelectedIndexChanged(object sender, EventArgs e) { AdvancedTextBox atb = ServiceHost.File[codefile.Fullname] as AdvancedTextBox; if (atb != null) { if (!binding) { atb.Buffer.SelectLocation((members.SelectedItem as ICodeMember).Location); atb.ScrollToCaretUpper(); atb.Select(); } } }
public NotepadPage(ref TabControl tabControl, string fileName, Font font = null, Theme theme = null, bool switchToNewTab = true, string filePath = null) { _tabControl = tabControl; _fileName = fileName; _filePath = filePath; _switchToNewTab = switchToNewTab; _theme = theme; _advandedTextBox = new AdvancedTextBox(); _advandedTextBox.Dock = DockStyle.Fill; if (font != null) { _advandedTextBox.Font = font; } _tabPage = new TabPage(); if (_fileName.Length > (MaxTabTitleLength + 3)) { _tabPage.Text = _fileName.Substring(0, MaxTabTitleLength).TrimEnd(' ', '.') + "..."; } else { _tabPage.Text = _fileName; } if (_filePath != null) { _tabPage.ToolTipText = _filePath; } else { _tabPage.ToolTipText = _fileName; } if (theme != null) { ApplyTheme(); } _tabPage.Controls.Add(_advandedTextBox); _tabControl.Controls.Add(_tabPage); _tabControl.SelectedTab = _tabPage; _tabControl.Refresh(); Focus(); }
public void InsertLine() { AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null && atb.Focused) { if (achack) { achack = false; } else { atb.InsertLine(); } } }
public void InitCommand() { #if !DEBUG //proj.DeserializeProjectData(); #endif string fn = (Application.StartupPath + Path.DirectorySeparatorChar + "profile.ls").Replace("\\", @"\\"); if (!File.Exists(fn)) { using (Stream i = typeof(ScriptingService).Assembly.GetManifestResourceStream("Xacc.Resources.profile.ls")) { using (Stream o = File.Create(fn)) { byte[] b = new byte[i.Length]; i.Read(b, 0, b.Length); o.Write(b, 0, b.Length); } } } using (TextReader r = File.OpenText(fn)) { try { LSharp.Runtime.EvalString("(do " + r.ReadToEnd() + ")"); } catch (Exception ex) { Trace.WriteLine("Init exception: {0}", ex); } } if (SettingsService.idemode) { atb = ServiceHost.File.Open(Application.StartupPath + "/command.ls", DockState.DockBottom) as AdvancedTextBox; atb.AutoSave = true; tbp = atb.Parent as IDockContent; tbp.HideOnClose = true; tbp.Hide(); atb.ProjectHint = proj; } }
void FindReplace() { //IFind AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox; if (atb != null && atb.Focused) { if (finddlg == null) { finddlg = new FindDialog(atb); ServiceHost.Window.MainForm.AddOwnedForm(finddlg); } finddlg.Show(); finddlg.Location = atb.PointToScreen(new Point(atb.Width - finddlg.Width - atb.vscroll.Width, 0)); } }
void ToggleBPState() { Project proj = ServiceHost.Project.Current; IFileManagerService fm = ServiceHost.File; AdvancedTextBox atb = fm[fm.Current] as AdvancedTextBox; if (atb != null) { int cline = atb.Buffer.CurrentLine; Breakpoint bp = proj.GetBreakpoint(fm.Current, cline); if (bp != null) { bp.SetEnabled(!bp.enabled); } } }
public AutoCompleteForm(AdvancedTextBox parent) { Opacity = .9; DoubleBuffered = true; FormBorderStyle = FormBorderStyle.SizableToolWindow; this.ControlBox = false; choices.BorderStyle = BorderStyle.FixedSingle; choices.KeyDown += new KeyEventHandler(choices_KeyDown); choices.DoubleClick += new EventHandler(choices_DoubleClick); choices.Font = SystemInformation.MenuFont; choices.Dock = DockStyle.Fill; choices.IntegralHeight = false; Controls.Add(choices); Width = 250; this.ShowInTaskbar = false; this.SizeGripStyle = SizeGripStyle.Hide; this.StartPosition = FormStartPosition.Manual; }
void ProcessExit() { if (dbg != null) { dbg.Dispose(); dbg = null; ServiceHost.State &= ~ApplicationState.DebugBreak; checkforbp = true; Breakpoint[] bps = null; bps = proj.GetAllBreakpoints(); foreach (Breakpoint bp in bps) { bp.bound = true; } proj = null; localsview.Items.Clear(); autosview.Items.Clear(); thisview.Items.Clear(); callstackview.Items.Clear(); if (lastsrcfile != null) { AdvancedTextBox atb = ServiceHost.File[lastsrcfile] as AdvancedTextBox; if (atb != null) { atb.debugexcept = false; atb.debugline = -1; ServiceHost.File.BringToFront(atb); } } Console.WriteLine("Debugger exited."); } }
void tl_Popup(object sender, EventArgs e) { AdvancedTextBox atb = ServiceHost.File[ServiceHost.File.Current] as AdvancedTextBox; if (atb != null) { Languages.Language l = atb.Buffer.Language; ToolStripMenuItem[] mma = langtools[l] as ToolStripMenuItem[]; ToolStripMenuItem tl = ServiceHost.Menu["Tools"]; if (mma == null) { ArrayList mm = new ArrayList(); foreach (Type t in l.actions) { //Build.ProcessAction pa = Activator.CreateInstance(t) as Build.ProcessAction; //ToolStripMenuItem mi = new ToolStripMenuItem(pa.Name, null, new EventHandler(InvokeLangTool)); ////mi.Index = tl.MenuItems.Count; //mi.Enabled = pa.IsAvailable; //mi.Tag = pa; //mm.Add(mi); } mma = mm.ToArray(typeof(ToolStripMenuItem)) as ToolStripMenuItem[]; langtools[l] = mma; } if (lastset != null) { foreach (ToolStripMenuItem mi in lastset) { tl.DropDownItems.Remove(mi); } lastset = null; } tl.DropDownItems.AddRange(lastset = mma); } }