Пример #1
0
        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);
                }
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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();
                    }
                }
            }
        }
Пример #4
0
        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();
            }
        }
Пример #5
0
        void SendProbe()
        {
            AdvancedTextBox atb = ServiceHost.File[ServiceHost.File.Current] as AdvancedTextBox;

            //System.Diagnostics.Debugger.Break();
            atb.Buffer.SendProbe();
        }
Пример #6
0
        public void ChangeLog()
        {
            AdvancedTextBox atb = ServiceHost.File.Open(Application.StartupPath + Path.DirectorySeparatorChar + "ChangeLog.txt")
                                  as AdvancedTextBox;

            atb.ReadOnly = true;
        }
Пример #7
0
        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;
                }
            }
        }
Пример #8
0
        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();
            }
        }
Пример #9
0
        public void AutoCompletePreviousPage()
        {
            AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox;

            if (atb != null)
            {
                atb.AutoCompletePreviousPage();
            }
        }
Пример #10
0
        public void AutoCompleteNextChoice()
        {
            AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox;

            if (atb != null)
            {
                atb.AutoCompleteNextChoice();
            }
        }
Пример #11
0
        public void ShowAutoComplete()
        {
            AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox;

            if (atb != null && atb.Focused)
            {
                atb.ShowAutoComplete();
            }
        }
Пример #12
0
        public void SelectLine()
        {
            AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox;

            if (atb != null && atb.Focused)
            {
                atb.SelectLine();
            }
        }
Пример #13
0
        public void RemoveAfter()
        {
            AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox;

            if (atb != null && atb.Focused)
            {
                atb.RemoveAfter();
            }
        }
Пример #14
0
        public void GotoPreviousToken()
        {
            AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox;

            if (atb != null && atb.Focused)
            {
                atb.GotoPreviousToken();
            }
        }
Пример #15
0
        public void GotoLastLine()
        {
            AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox;

            if (atb != null && ((Control)atb).Focused)
            {
                atb.GotoLastLine();
            }
        }
Пример #16
0
        public void HideAutoComplete()
        {
            AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox;

            if (atb != null)
            {
                atb.HideAutoComplete();
            }
        }
Пример #17
0
        void StripSpace()
        {
            AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox;

            if (atb != null && atb.Focused)
            {
                atb.StripTrailingWhiteSpace();
            }
        }
Пример #18
0
        public void TraceLog()
        {
            AdvancedTextBox atb = ServiceHost.File.Open(Application.StartupPath + Path.DirectorySeparatorChar + "TraceLog.txt")
                                  as AdvancedTextBox;

            atb.Text = Diagnostics.Trace.GetFullTrace();

            atb.ReadOnly = true;
        }
Пример #19
0
        public void AutoCompleteSelectChoice()
        {
            AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox;

            if (atb != null)
            {
                achack = true;
                atb.AutoCompleteSelectChoice();
            }
        }
Пример #20
0
        void EditProfile()
        {
            IFileManagerService fm  = ServiceHost.File;
            AdvancedTextBox     atb =
                fm.Open(Application.StartupPath + Path.DirectorySeparatorChar + "profile.ls")
                as AdvancedTextBox;

            atb.AutoSave    = true;
            atb.ProjectHint = proj;
        }
Пример #21
0
        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();
        }
Пример #22
0
        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();
                }
            }
        }
Пример #23
0
        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();
        }
Пример #24
0
        public void InsertLine()
        {
            AdvancedTextBox atb = fm.CurrentControl as AdvancedTextBox;

            if (atb != null && atb.Focused)
            {
                if (achack)
                {
                    achack = false;
                }
                else
                {
                    atb.InsertLine();
                }
            }
        }
Пример #25
0
        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;
            }
        }
Пример #26
0
        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));
            }
        }
Пример #27
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);
                }
            }
        }
Пример #28
0
        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;
        }
Пример #29
0
        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.");
            }
        }
Пример #30
0
        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);
            }
        }