Exemplo n.º 1
0
        public static void DebugDelBreakpoint(CWFile File, int line)
        {
            AssertOpenProject("DebugDelBreakpoint");
            AssertValidFile(File, "DebugDelBreakpoint");

            CProject.File file = GetFile(File);

            // Find the breakpoint
            foreach (CProject.Breakpoint bp in g.Project.ProjectBreaks)
            {
                if (bp.file == file && bp.LineNumber == line)
                {
                    g.Project.ProjectBreaks.Remove(bp);
                    break;
                }
            }

            // Update the breakpoints if the file is open
            UCEditor editor = GetEditor(file);

            if (editor != null)
            {
                editor.BreakpointRender();
            }
        }
Exemplo n.º 2
0
        public static void EditorSetCaret(CWFile File, int[] position, bool isOffset)
        {
            AssertOpenProject("EditorSetCaret");
            AssertOpenFile(File, "EditorSetCaret");

            UCEditor editor = GetEditor(GetFile(File));

            if (!isOffset)
            {
                // Try to cast the line/column thing into an offset
                try {
                    int pos = editor.txtEditor.Document.PositionToOffset(new ActiproSoftware.SyntaxEditor.Position(position[0], position[1]));

                    editor.txtEditor.SelectedView.Selection.StartOffset = pos;
                    editor.txtEditor.SelectedView.Selection.EndOffset   = pos;
                } catch {
                    throw new PluginException("Unable to cast the specified line/column combination into an offset.", "EditorSetCaret");
                }
            }
            else
            {
                editor.txtEditor.SelectedView.Selection.StartOffset = position[0];
                editor.txtEditor.SelectedView.Selection.EndOffset   = position[0];
            }
        }
Exemplo n.º 3
0
        public static void AddIndicatorIcon(CWFile File, string IndicatorName, int line, Image marginIcon)
        {
            if (g.Project == null)
            {
                throw new PluginException("Attempting to add indicator with no project open.", "AddIndicatorSpan");
            }

            CProject.File file = GetFile(File);

            if (file == null)
            {
                throw new PluginException("Invalid CWFile instance -- file is not in project.", "AddIndicatorSpan");
            }

            // Check to see if the file is open
            UCEditor editor = GetEditor(file);

            if (editor == null)
            {
                throw new PluginException("File specified is not open", "AddIndicatorSpan");
            }

            // Add the indicator
            editor.txtEditor.Document.Indicators.Add(
                new CIndicators.CustomIconIndicator(IndicatorName, marginIcon), line);
        }
Exemplo n.º 4
0
        public static void AddIndicatorSpan(CWFile File, string IndicatorName, int startoffset, int endoffset, Image marginIcon, Color lineForeColor, Color lineBackColor, bool Bold, bool Italic, bool Underline)
        {
            if (g.Project == null)
            {
                throw new PluginException("Attempting to add indicator with no project open.", "AddIndicatorSpan");
            }

            CProject.File file = GetFile(File);

            if (file == null)
            {
                throw new PluginException("Invalid CWFile instance -- file is not in project.", "AddIndicatorSpan");
            }

            // Check to see if the file is open
            UCEditor editor = GetEditor(file);

            if (editor == null)
            {
                throw new PluginException("File specified is not open", "AddIndicatorSpan");
            }

            // Finally, add the indicator
            editor.txtEditor.Document.Indicators.Add(
                new CIndicators.CustomIndicator(IndicatorName, marginIcon, lineForeColor, lineBackColor, Bold, Italic, Underline),
                startoffset, (endoffset - startoffset));
        }
Exemplo n.º 5
0
        public static void IntellicodeDisplayInfopop(InfopopCollection entries)
        {
            // Is an editor window active?
            if (g.Main.GetActiveEditor() == null)
            {
                return;
            }

            UCEditor editor = g.Main.GetActiveEditor();

            editor.txtEditor.IntelliPrompt.InfoTip.Info.Clear();

            // Display it
            foreach (Infopop info in entries)
            {
                editor.txtEditor.IntelliPrompt.InfoTip.Info.Add(
                    "<b><u>" + info.InfopopRetType.Replace("<", "&lt;") + "</b></u> " +
                    "<b>" + info.InfopopName.Replace("<", "&lt;") + "</b> " +
                    "(<i>" + info.InfopopParams.Replace("<", "&lt;") + "</i>) " +
                    ((info.InfopopDescr.Trim() != "") ? "<br />" + info.InfopopDescr.Replace("<", "&lt;") : "")
                    );
            }

            editor.txtEditor.IntelliPrompt.InfoTip.Show(editor.txtEditor.SelectedView.Selection.StartOffset);
        }
Exemplo n.º 6
0
        public static CWFile?GetActiveFile()
        {
            AssertOpenProject("GetActiveFile");

            UCEditor editor = g.Main.GetActiveEditor();

            if (editor == null)
            {
                return(null);
            }

            return(editor.g_curFile.ToCWFile());
        }
Exemplo n.º 7
0
        public static void RemoveIndicator(CWFile File, string IndicatorName, int line)
        {
            if (g.Project == null)
            {
                throw new PluginException("Attempting to add indicator with no project open.", "AddIndicatorSpan");
            }

            CProject.File file = GetFile(File);

            if (file == null)
            {
                throw new PluginException("Invalid CWFile instance -- file is not in project.", "AddIndicatorSpan");
            }

            // Check to see if the file is open
            UCEditor editor = GetEditor(file);

            if (editor == null)
            {
                throw new PluginException("File specified is not open", "AddIndicatorSpan");
            }

            // Remove the indicator
            ArrayList toremove = new ArrayList();

            foreach (ActiproSoftware.SyntaxEditor.Indicator ind in editor.txtEditor.Document.Indicators)
            {
                if (ind is CIndicators.CustomIconIndicator)
                {
                    if (line == -1)
                    {
                        toremove.Add(ind);
                    }
                    else if ((ind as CIndicators.CustomIconIndicator).LineIndex == line)
                    {
                        toremove.Add(ind);
                    }
                }
                else if (ind is CIndicators.CustomIndicator)
                {
                    toremove.Add(ind);
                }
            }

            foreach (ActiproSoftware.SyntaxEditor.Indicator ind in toremove)
            {
                editor.txtEditor.Document.Indicators.Remove(ind);
            }
        }
Exemplo n.º 8
0
        public static int[] EditorGetCaret(CWFile File, bool TranslateToOffset)
        {
            AssertOpenProject("EditorGetCaret");
            AssertOpenFile(File, "EditorGetCaret");

            UCEditor editor = GetEditor(GetFile(File));

            if (TranslateToOffset)
            {
                return(new int[] { editor.txtEditor.SelectedView.Selection.StartOffset });
            }
            else
            {
                ActiproSoftware.SyntaxEditor.Position pos = editor.txtEditor.Document.OffsetToPosition(editor.txtEditor.SelectedView.Selection.StartOffset);
                return(new int[] { pos.Line, pos.Character });
            }
        }
Exemplo n.º 9
0
        public frmIntellisense(UCEditor editor, string var, int up)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.editor    = editor;
            this.prevclass = editor.prevclass;
            this.prevfunc  = editor.prevfunc;
            this.var       = var;
            this.up        = up;

            //this.fIP = new frmIntellisensePrompt(new Point(Screen.PrimaryScreen.WorkingArea.Left, Screen.PrimaryScreen.WorkingArea.Bottom));
            this.fIP = new frmIntellisensePrompt(new Point(0, 0));

            //this.fIP.Show();
            //this.fIP.Hide();
        }
Exemplo n.º 10
0
        void EditTemplates(bool f*g)
        {
            string path = string.Empty;
            var    form = new FrmRazorTemplates(f*g);

            if (form.ShowDialog() == DialogResult.OK)
            {
                if (pairs.ContainsKey(form.TemplatesName))
                {
                    var item = superTabControl1.Tabs.Cast <SuperTabItem>()
                               .Where(a => a.Text == form.TemplatesName).FirstOrDefault();
                    superTabControl1.SelectedTab = item;
                    return;
                }
                var superItem = superTabControl1.CreateTab(form.TemplatesName);
                var ucEditor  = new UCEditor(form.TemplatesPath);
                pairs.Add(form.TemplatesName, ucEditor);
                superTabControl1.SelectedTab = superItem;
                ucEditor.Dock = DockStyle.Fill;
                superTabControl1.SelectedPanel.Controls.Add(ucEditor);
            }
        }
Exemplo n.º 11
0
        public static void IntellicodeDisplayMemberlist(IntellicodeEntryCollection entries)
        {
            // Is an editor window active?
            if (g.Main.GetActiveEditor() == null)
            {
                return;
            }

            UCEditor editor = g.Main.GetActiveEditor();

            editor.txtEditor.IntelliPrompt.MemberList.Clear();

            // Display it
            foreach (IntellicodeEntry ic in entries)
            {
                editor.txtEditor.IntelliPrompt.MemberList.Add(new ActiproSoftware.SyntaxEditor.IntelliPromptMemberListItem(
                                                                  ic.EntryName, ic.EntryIconIndex,
                                                                  "<b>" + ic.EntryName.Replace("<", "&lt;") + " (</b>" +
                                                                  ic.EntryParams + "<b>)</b> " +
                                                                  ((ic.EntryDescription != "") ? "<br />" + ic.EntryDescription.Replace("<", "&lt;") : "")
                                                                  , ic.EntryInsertBefore, ic.EntryInsertAfter)
                                                              );
            }
        }