コード例 #1
0
 // Methods
 public KeyList(SyntaxEdit Owner)
 {
     this.owner    = Owner;
     this.handlers = new EventHandlers(this.owner);
     this.states   = new Hashtable();
     this.Init();
 }
コード例 #2
0
ファイル: SyntaxSettings.cs プロジェクト: stevencohn/Orqa
 public void ApplyToEdit(SyntaxEdit SyntaxEdit)
 {
     SyntaxEdit.Source.BeginUpdate(UpdateReason.Other);
     try
     {
         SyntaxEdit.Outlining.AllowOutlining = this.AllowOutlining;
         SyntaxEdit.Outlining.OutlineOptions = this.OutlineOptions;
         SyntaxEdit.Font                   = this.Font;
         SyntaxEdit.Gutter.Options         = this.GutterOptions;
         SyntaxEdit.Gutter.Width           = this.GutterWidth;
         SyntaxEdit.Margin.Position        = this.MarginPos;
         SyntaxEdit.NavigateOptions        = this.NavigateOptions;
         SyntaxEdit.Scrolling.ScrollBars   = this.ScrollBars;
         SyntaxEdit.Selection.Options      = this.SelectionOptions;
         SyntaxEdit.Gutter.Visible         = this.ShowGutter;
         SyntaxEdit.Margin.Visible         = this.ShowMargin;
         SyntaxEdit.Source.Lines.TabStops  = this.TabStops;
         SyntaxEdit.Source.Lines.UseSpaces = this.UseSpaces;
         SyntaxEdit.WordWrap               = this.WordWrap;
         this.CopyStyles(this.LexStyles, this.GetLexStyles(SyntaxEdit));
         SyntaxEdit.Spelling.SpellColor         = this.LexStyles[this.LexStyles.Length - 1].ForeColor;
         SyntaxEdit.HyperText.HighlightUrls     = this.HighlightUrls;
         SyntaxEdit.HyperText.UrlColor          = this.LexStyles[this.LexStyles.Length - 2].ForeColor;
         SyntaxEdit.HyperText.UrlStyle          = this.LexStyles[this.LexStyles.Length - 2].FontStyle;
         SyntaxEdit.Gutter.LineNumbersForeColor = this.lexStyles[this.LexStyles.Length - 3].ForeColor;
     }
     finally
     {
         SyntaxEdit.Source.EndUpdate();
     }
     SyntaxEdit.Invalidate();
 }
コード例 #3
0
        protected virtual void WriteLine(string Line, int Style, int Start, int End)
        {
            FontStyle  style2;
            Color      color1;
            Color      color2;
            ColorFlags flags1 = ColorFlags.None;
            SyntaxEdit edit1  = this.owner as SyntaxEdit;
            ILexStyle  style1 = edit1.GetLexStyle(Style, ref flags1);

            if (style1 != null)
            {
                style2 = edit1.GetFontStyle(style1.FontStyle, flags1);
                color1 = edit1.GetFontColor(style1.ForeColor, flags1);
                if (style1.BackColor != Color.Empty)
                {
                    color2 = style1.BackColor;
                }
                else
                {
                    color2 = this.owner.BackColor;
                }
            }
            else
            {
                style2 = edit1.GetFontStyle(this.owner.Font.Style, flags1);
                color1 = edit1.GetFontColor(this.owner.ForeColor, flags1);
                color2 = this.owner.BackColor;
            }
            this.ApplyStyle(style2, color1, color2);
            this.WriteText(Start, Line.Substring(Start, (End - Start) + 1));
        }
コード例 #4
0
 // Methods
 public CodeCompletionWindow(SyntaxEdit Owner)
 {
     this.completionFlags = EditConsts.DefaultCodeCompletionFlags;
     this.ownerControl    = Owner;
     this.startPos        = new Point(0, 0);
     this.endPos          = new Point(0, 0);
     base.MinimumSize     = new Size(this.Font.Height + 2, this.Font.Height + 2);
     base.SizeGripStyle   = SizeGripStyle.Hide;
     base.StartPosition   = FormStartPosition.Manual;
     base.FormBorderStyle = FormBorderStyle.FixedSingle;
     base.Width           = 200;
     base.Height          = 200;
     base.ShowInTaskbar   = false;
     base.ControlBox      = false;
     this.BackColor       = Consts.DefaultControlBackColor;
     base.SetStyle(ControlStyles.ResizeRedraw, true);
     base.TopLevel                  = true;
     base.DoubleClick              += new EventHandler(this.DoDoubleClick);
     base.Click                    += new EventHandler(this.DoClick);
     base.LostFocus                += new EventHandler(this.DoLostFocus);
     this.popupControl              = this.CreatePopupControl();
     this.popupControl.DoubleClick += new EventHandler(this.DoDoubleClick);
     this.popupControl.Click       += new EventHandler(this.DoClick);
     this.popupControl.LostFocus   += new EventHandler(this.DoLostFocus);
     base.Controls.Clear();
     base.Controls.Add(this.popupControl);
     this.popupControl.Dock = DockStyle.Fill;
     this.UpdateAutoSize();
 }
コード例 #5
0
    private void CreateEdit()
    {
      FEditInitialized = true;
      FSource = new TextSource();
      FEdit = new SyntaxEdit();
      FEdit.Dock = DockStyle.Fill;
      FEdit.BorderStyle = EditBorderStyle.None;
      FEdit.Source = FSource;
      FEdit.AllowDrop = true;
      FEdit.DragOver += new DragEventHandler(Edit_DragOver);
      FEdit.DragDrop += new DragEventHandler(Edit_DragDrop);
      Controls.Add(FEdit);

      // do this after controls.add!
      FEdit.IndentOptions = IndentOptions.AutoIndent | IndentOptions.SmartIndent;
      FEdit.NavigateOptions = NavigateOptions.BeyondEol;
      FEdit.Braces.BracesOptions = BracesOptions.Highlight | BracesOptions.HighlightBounds;
      FEdit.Braces.BackColor = Color.LightGray;
      FEdit.Braces.Style = FontStyle.Regular;
      FEdit.Scroll.ScrollBars = RichTextBoxScrollBars.Both;
      FEdit.Scroll.Options = ScrollingOptions.AllowSplitHorz | ScrollingOptions.AllowSplitVert | ScrollingOptions.SmoothScroll;
      FEdit.Outlining.AllowOutlining = true;
      FEdit.DisplayLines.UseSpaces = true;
      FEdit.SplitHorz += new EventHandler(Edit_SplitHorz);
      FEdit.SplitVert += new EventHandler(Edit_SplitVert);
      FEdit.TextChanged += new EventHandler(Edit_TextChanged);

      UpdateOptions();
      UpdateEditColors();
      SetScriptText();
    }
コード例 #6
0
 public LineStyle(SyntaxEdit Owner)
 {
     this.foreColor  = EditConsts.DefaultLineStyleForeColor;
     this.backColor  = EditConsts.DefaultLineStyleBackColor;
     this.imageIndex = -1;
     this.options    = EditConsts.DefaultLineStyleOptions;
     this.owner      = Owner;
 }
コード例 #7
0
        // Methods
        public CodeCompletionBox(SyntaxEdit Owner) : base(Owner)
        {
            this.dropDownCount    = EditConsts.DefaultDropDownCount;
            base.CompletionFlags &= ((CodeCompletionFlags)(-5));
            base.SizeAble         = true;
            this.UpdateDropDown();
            CompletionListBox box1 = this.ListBox;

            box1.UpdateSize = (EventHandler)Delegate.Combine(box1.UpdateSize, new EventHandler(this.DoUpdateSize));
        }
コード例 #8
0
ファイル: CodeCompletionHint.cs プロジェクト: stevencohn/Orqa
        // Methods
        public CodeCompletionHint(SyntaxEdit Owner) : base(Owner)
        {
            base.SizeAble        = false;
            base.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            this.curPos          = new Point(0, 0);
            base.SetStyle(ControlStyles.AllPaintingInWmPaint | (ControlStyles.StandardDoubleClick | (ControlStyles.StandardClick | (ControlStyles.Opaque | ControlStyles.UserPaint))), true);
            CompletionHint hint1 = this.Hint;

            hint1.UpdateSize      = (EventHandler)Delegate.Combine(hint1.UpdateSize, new EventHandler(this.DoUpdateSize));
            base.CompletionFlags &= ((CodeCompletionFlags)(-291));
        }
コード例 #9
0
        public void Paint(ITextPainter Painter, Rectangle Rect, int PageIndex, int PageCount, bool PageNumbers)
        {
            System.Drawing.Font font1 = Painter.Font;
            Color color1 = Painter.Color;

            Painter.BkMode = 1;
            try
            {
                DrawInfo info1;
                Painter.Font  = this.Font;
                Painter.Color = this.fontColor;
                EditPages pages1 = this.GetPages();
                info1 = new DrawInfo();
                info1.Init();
                info1.Page = (this.page != null) ? this.page.Index : -1;
                SyntaxEdit edit1 = ((pages1 != null) && (pages1.Owner != null)) ? ((SyntaxEdit)pages1.Owner) : null;
                if ((edit1 == null) || !edit1.OnCustomDraw(Painter, Rect, DrawStage.Before, DrawState.PageHeader, info1))
                {
                    bool   flag1 = ((pages1 != null) && this.reverseOnEvenPages) && (((PageIndex + 1) % 2) == 0);
                    string text2 = PageNumbers ? ((PageIndex + 1)).ToString() : this.RightText;
                    string text1 = flag1 ? text2 : this.LeftText;
                    if ((text1 != null) && (text1 != string.Empty))
                    {
                        Painter.TextOut(this.GetTextToPaint(text1, PageIndex, PageCount), -1, Rect);
                    }
                    text1 = this.CenterText;
                    if ((text1 != null) && (text1 != string.Empty))
                    {
                        text1 = this.GetTextToPaint(text1, PageIndex, PageCount);
                        int num1 = Painter.StringWidth(text1);
                        Painter.TextOut(text1, -1, (int)(((Rect.Left + Rect.Right) - num1) >> 1), Rect.Top);
                    }
                    text1 = flag1 ? this.LeftText : text2;
                    if ((text1 != null) && (text1 != string.Empty))
                    {
                        text1 = this.GetTextToPaint(text1, PageIndex, PageCount);
                        int num2 = Painter.StringWidth(text1);
                        Painter.TextOut(text1, -1, (int)(Rect.Right - num2), Rect.Top);
                    }
                }
                if (edit1 != null)
                {
                    edit1.OnCustomDraw(Painter, Rect, DrawStage.After, DrawState.PageHeader, info1);
                }
            }
            finally
            {
                Painter.BkMode = 2;
                Painter.Font   = font1;
                Painter.Color  = color1;
            }
        }
コード例 #10
0
 public LineStyle(SyntaxEdit Owner, string AName, Color AForeColor, Color ABackColor, int AImageIndex, LineStyleOptions AOptions)
 {
     this.foreColor  = EditConsts.DefaultLineStyleForeColor;
     this.backColor  = EditConsts.DefaultLineStyleBackColor;
     this.imageIndex = -1;
     this.options    = EditConsts.DefaultLineStyleOptions;
     this.owner      = Owner;
     this.name       = AName;
     this.foreColor  = AForeColor;
     this.backColor  = ABackColor;
     this.imageIndex = AImageIndex;
     this.options    = AOptions;
 }
コード例 #11
0
ファイル: CodeCompletionHint.cs プロジェクト: stevencohn/Orqa
        private void MakeBold()
        {
            SyntaxEdit edit1 = base.GetSyntaxEdit();

            if (((edit1 != null) && (base.StartPos.X >= 0)) && ((base.StartPos.Y >= 0) && !this.curPos.Equals(edit1.Position)))
            {
                this.curPos = edit1.Position;
                if (base.StartPos.Y == this.curPos.Y)
                {
                    this.Hint.MakeBold(edit1.RemovePlainText(this.curPos.Y), base.StartPos.X, this.curPos.X);
                }
            }
        }
コード例 #12
0
        private bool IsPositionValid()
        {
            SyntaxEdit edit1 = this.GetSyntaxEdit();

            if (edit1 == null)
            {
                return(true);
            }
            Point point1 = edit1.Position;

            if ((((this.startPos.Y < 0) || (point1.Y == this.startPos.Y)) && ((this.endPos.Y < 0) || (point1.Y == this.endPos.Y))) && ((this.startPos.X < 0) || (point1.X >= this.startPos.X)))
            {
                if (this.endPos.X >= 0)
                {
                    return(point1.X <= this.endPos.X);
                }
                return(true);
            }
            return(false);
        }
コード例 #13
0
        protected override bool PerformSearch()
        {
            if (base.Provider == null)
            {
                return(false);
            }
            SyntaxEdit edit1 = base.GetSyntaxEdit();

            if (edit1 != null)
            {
                Point point1 = edit1.Position;
                if ((point1.Y == base.StartPos.Y) && (point1.X > base.StartPos.X))
                {
                    string text1 = edit1.Lines[point1.Y];
                    if (base.StartPos.X >= text1.Length)
                    {
                        goto Label_0117;
                    }
                    text1 = (point1.X < text1.Length) ? text1.Substring(base.StartPos.X, point1.X - base.StartPos.X) : text1.Substring(base.StartPos.X);
                    if (this.Filtered)
                    {
                        this.Filter = text1.Trim();
                    }
                    else
                    {
                        int num1 = this.IndexOfString(text1);
                        if (num1 >= 0)
                        {
                            this.ListBox.SelectedIndex = num1;
                        }
                    }
                    return(true);
                }
                if (this.Filtered)
                {
                    this.Filter = string.Empty;
                }
            }
Label_0117:
            return(false);
        }
コード例 #14
0
        protected override bool ProcessKeyPreview(ref Message m)
        {
            if ((m.Msg == 0x100) || (m.Msg == 260))
            {
                Keys keys1 = ((Keys)m.WParam.ToInt32()) & Keys.KeyCode;
                if (Array.IndexOf(this.ListBox.NavKeys, keys1) >= 0)
                {
                    return(false);
                }
            }
            SyntaxEdit edit1 = base.GetSyntaxEdit();

            if (((m.Msg == 0x102) && (edit1 != null)) && (Control.ModifierKeys == Keys.None))
            {
                char ch1 = (char)((ushort)m.WParam.ToInt32());
                if ((((base.CompletionFlags & CodeCompletionFlags.AcceptOnDelimiter) != CodeCompletionFlags.None) && (ch1 >= ' ')) && edit1.Lines.IsDelimiter(ch1))
                {
                    this.Close(true);
                }
            }
            return(base.ProcessKeyPreview(ref m));
        }
コード例 #15
0
ファイル: Margin.cs プロジェクト: stevencohn/Orqa
 protected internal void DrawLine(int X, int Y, bool Erase)
 {
     this.drawX = X;
     this.drawY = Y;
     if (this.owner != null)
     {
         Rectangle  rectangle1;
         SyntaxEdit edit1 = (SyntaxEdit)this.owner;
         if (edit1.Pages.PageType == PageType.PageLayout)
         {
             IEditPage page1 = edit1.Pages.GetPageAtPoint(X, Y);
             if (page1 == null)
             {
                 return;
             }
             rectangle1 = page1.ClientRect;
         }
         else
         {
             rectangle1 = edit1.ClientRect;
         }
         if (Erase)
         {
             edit1.Invalidate(new Rectangle(X, rectangle1.Top, 1, rectangle1.Height));
         }
         else
         {
             Graphics graphics1 = edit1.CreateGraphics();
             try
             {
                 graphics1.DrawLine(this.pen, X, rectangle1.Top, X, (int)(rectangle1.Bottom - 1));
             }
             finally
             {
                 graphics1.Dispose();
             }
         }
     }
 }
コード例 #16
0
        protected override bool ProcessKeyPreview(ref Message m)
        {
            Keys keys1 = Keys.None;

            if ((m.Msg == 0x100) || (m.Msg == 260))
            {
                keys1 = ((Keys)m.WParam.ToInt32()) & Keys.KeyCode;
                Keys keys2 = keys1;
                if (keys2 != Keys.Return)
                {
                    if ((keys2 == Keys.Escape) && ((this.CompletionFlags & CodeCompletionFlags.CloseOnEscape) != CodeCompletionFlags.None))
                    {
                        this.Close(false);
                        return(true);
                    }
                }
                else if ((this.CompletionFlags & CodeCompletionFlags.AcceptOnEnter) != CodeCompletionFlags.None)
                {
                    this.Close(true);
                    return(true);
                }
            }
            SyntaxEdit edit1 = this.GetSyntaxEdit();

            if (edit1 != null)
            {
                edit1.DoProcessKeyMessage(ref m);
            }
            if (((this.CompletionFlags & CodeCompletionFlags.KeepActive) == CodeCompletionFlags.None) && !this.IsPositionValid())
            {
                this.Close(false);
            }
            if (((m.Msg == 0x102) || (keys1 == Keys.Back)) && this.PerformSearch())
            {
                return(true);
            }
            return(base.ProcessKeyPreview(ref m));
        }
コード例 #17
0
ファイル: SyntaxSettings.cs プロジェクト: stevencohn/Orqa
 public void LoadFromEdit(SyntaxEdit SyntaxEdit)
 {
     this.Font             = SyntaxEdit.Font;
     this.GutterOptions    = SyntaxEdit.Gutter.Options;
     this.GutterWidth      = SyntaxEdit.Gutter.Width;
     this.HighlightUrls    = SyntaxEdit.HyperText.HighlightUrls;
     this.MarginPos        = SyntaxEdit.Margin.Position;
     this.NavigateOptions  = SyntaxEdit.NavigateOptions;
     this.AllowOutlining   = SyntaxEdit.Outlining.AllowOutlining;
     this.OutlineOptions   = SyntaxEdit.Outlining.OutlineOptions;
     this.ScrollBars       = SyntaxEdit.Scrolling.ScrollBars;
     this.SelectionOptions = SyntaxEdit.Selection.Options;
     this.ShowGutter       = SyntaxEdit.Gutter.Visible;
     this.ShowMargin       = SyntaxEdit.Margin.Visible;
     this.TabStops         = SyntaxEdit.Source.Lines.TabStops;
     this.UseSpaces        = SyntaxEdit.Source.Lines.UseSpaces;
     this.WordWrap         = SyntaxEdit.WordWrap;
     this.CopyStyles(this.GetLexStyles(SyntaxEdit), this.lexStyles);
     this.lexStyles[this.LexStyles.Length - 1].ForeColor = SyntaxEdit.Spelling.SpellColor;
     this.lexStyles[this.LexStyles.Length - 2].ForeColor = SyntaxEdit.HyperText.UrlColor;
     this.lexStyles[this.LexStyles.Length - 2].FontStyle = SyntaxEdit.HyperText.UrlStyle;
     this.lexStyles[this.LexStyles.Length - 3].ForeColor = SyntaxEdit.Gutter.LineNumbersForeColor;
 }
コード例 #18
0
        /// <summary>
        ///   Registers a new <paramref name="edit"/> that is to be applied to any <see cref="SyntaxNode"/>
        ///   found on the <see cref="CSharpCompilation"/>.
        /// </summary>
        /// <param name="editor"></param>
        /// <param name="edit"></param>
        public static void EditSyntax(this CompilationEditor editor, SyntaxEdit edit)
        {
            IList <SyntaxEdit> GetDefaultValue()
            {
                editor.CompilationPipeline += EditCompilation;

                return(new LightList <SyntaxEdit>());
            }

            CSharpCompilation EditCompilation(CSharpCompilation compilation, CancellationToken cancellationToken)
            {
                IList <SyntaxEdit> edits          = editor.Storage.Get <IList <SyntaxEdit> >(SyntaxKey);
                SyntaxTreeRewriter syntaxRewriter = new SyntaxTreeRewriter(compilation, edits, cancellationToken);

                for (int i = 0; i < compilation.SyntaxTrees.Length; i++)
                {
                    CSharpSyntaxTree tree = compilation.SyntaxTrees[i] as CSharpSyntaxTree;

                    if (tree == null)
                    {
                        continue;
                    }

                    CSharpSyntaxNode root    = tree.GetRoot(cancellationToken);
                    SyntaxNode       newRoot = syntaxRewriter.Visit(root);

                    if (root != newRoot)
                    {
                        compilation = compilation.ReplaceSyntaxTree(tree, tree.WithRootAndOptions(newRoot, tree.Options));
                    }
                }

                return(compilation);
            }

            editor.Storage.GetOrAdd(SyntaxKey, GetDefaultValue).Add(edit);
        }
コード例 #19
0
ファイル: XmlSyntaxEditInfo.cs プロジェクト: stevencohn/Orqa
 public void FixupReferences(SyntaxEdit Owner)
 {
     this.owner              = Owner;
     this.HideCaret          = this.hideCaret;
     this.DisableColorPaint  = this.disableColorPaint;
     this.DisableSyntaxPaint = this.disableSyntaxPaint;
     this.WantTabs           = this.wantTabs;
     this.WantReturns        = this.wantReturns;
     this.DisplayStrings     = this.displayStrings;
     this.Selection          = this.selection;
     this.Gutter             = this.gutter;
     this.Margin             = this.margin;
     this.LineStyles         = this.lineStyles;
     this.LineSeparator      = this.lineSeparator;
     this.Printing           = this.printing;
     this.WhiteSpace         = this.whiteSpace;
     this.TextSource         = this.textSource;
     this.Scrolling          = this.scrolling;
     this.Outlining          = this.outlining;
     this.HyperText          = this.hyperText;
     this.Spelling           = this.spelling;
     this.Pages              = this.pages;
     this.Transparent        = this.transparent;
 }
コード例 #20
0
ファイル: LineStylesEx.cs プロジェクト: stevencohn/Orqa
 // Methods
 public LineStylesEx(SyntaxEdit Owner)
 {
     this.owner = Owner;
 }
コード例 #21
0
        private void FindNext(bool replace, bool replaceAll)
        {
            bool found = false;

            if (FDesigner.ActiveReportTab.ActivePage == null)
            {
                // search in the code tab
                SyntaxEdit Edit = (FDesigner.ActiveReportTab.ActivePageDesigner as CodePageDesigner).Edit;
                if (FFirstSearch)
                {
                    Edit.FirstSearch = true;
                }

                SearchOptions options = SearchOptions.None;
                if (cbMatchCase.Checked)
                {
                    options |= SearchOptions.CaseSensitive;
                }
                if (cbMatchWholeWord.Checked)
                {
                    options |= SearchOptions.WholeWordsOnly;
                }

                if (Edit.Selection.SelectedText == cbxFind.Text && replace && !replaceAll)
                {
                    Edit.Selection.SelectedText = cbxReplace.Text;
                    found = true;
                }
                else
                {
                    while (true)
                    {
                        if (Edit.Find(cbxFind.Text, options))
                        {
                            found = true;

                            if (replace)
                            {
                                Edit.Selection.SelectedText = cbxReplace.Text;
                            }

                            if (!replaceAll)
                            {
                                break;
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                ObjectCollection allObjects = FDesigner.ActiveReportTab.ActivePage.AllObjects;
                for (; FIndex < allObjects.Count; FIndex++)
                {
                    Base   c    = allObjects[FIndex];
                    string text = "";
                    if (c is TextObject)
                    {
                        text = (c as TextObject).Text;
                    }
                    else if (c is RichObject)
                    {
                        text = (c as RichObject).Text;
                    }

                    List <CharacterRange> ranges = FindText(text, 0);
                    if (ranges.Count > 0)
                    {
                        found = true;

                        if (!replaceAll)
                        {
                            FDesigner.SelectedObjects.Clear();
                            FDesigner.SelectedObjects.Add(c);
                            FDesigner.SelectionChanged(null);
                        }

                        if (replace)
                        {
                            int correction = 0;
                            foreach (CharacterRange range in ranges)
                            {
                                text        = text.Remove(range.First + correction, range.Length);
                                text        = text.Insert(range.First + correction, cbxReplace.Text);
                                correction += cbxReplace.Text.Length - range.Length;
                            }

                            if (c is TextObject)
                            {
                                (c as TextObject).Text = text;
                            }
                            else if (c is RichObject)
                            {
                                (c as RichObject).Text = text;
                            }
                        }

                        if (!replaceAll)
                        {
                            FIndex++;
                            break;
                        }
                    }
                }
            }

            if (found && replace)
            {
                FDesigner.SetModified(null, "Change");
            }

            if (FFirstSearch)
            {
                if (!found)
                {
                    FRMessageBox.Information(Res.Get("Forms,SearchReplace,NotFound"));
                }
                FFirstSearch = false;
            }
            else
            {
                if (!found)
                {
                    FRMessageBox.Information(Res.Get("Forms,SearchReplace,NoMoreFound"));
                }
            }
        }
コード例 #22
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ADXExcelTaskPaneSessEditor));
     this.parserBES                         = new QWhale.Syntax.Parser();
     this.textSourceBES                     = new QWhale.Editor.TextSource.TextSource(this.components);
     this.tabControl1                       = new System.Windows.Forms.TabControl();
     this.tabPageSessEditor                 = new System.Windows.Forms.TabPage();
     this.syntaxEditBES                     = new QWhale.Editor.SyntaxEdit(this.components);
     this.toolStripStatusLabelMessage       = new System.Windows.Forms.ToolStripStatusLabel();
     this.toolStripDropDownButtonRun        = new System.Windows.Forms.ToolStripDropDownButton();
     this.toolStripStatusLabelEvalTime      = new System.Windows.Forms.ToolStripStatusLabel();
     this.toolStripStatusLabelConnectedUser = new System.Windows.Forms.ToolStripStatusLabel();
     this.tableLayoutPanel1                 = new System.Windows.Forms.TableLayoutPanel();
     this.statusStrip1                      = new System.Windows.Forms.StatusStrip();
     this.toolStripDropDownButton1          = new System.Windows.Forms.ToolStripDropDownButton();
     this.toolStripMenuItemWrap             = new System.Windows.Forms.ToolStripMenuItem();
     this.toolStripMenuItemSplit            = new System.Windows.Forms.ToolStripMenuItem();
     this.parser1 = new QWhale.Syntax.Parser();
     this.adxExcelControlAdapter1 = new AddinExpress.ToolbarControls.ADXExcelControlAdapter(this.components);
     this.adxExcelControlAdapter2 = new AddinExpress.ToolbarControls.ADXExcelControlAdapter(this.components);
     this.tabControl1.SuspendLayout();
     this.tabPageSessEditor.SuspendLayout();
     this.tableLayoutPanel1.SuspendLayout();
     this.statusStrip1.SuspendLayout();
     this.SuspendLayout();
     //
     // parserBES
     //
     this.parserBES.DefaultState = 0;
     this.parserBES.XmlScheme    = resources.GetString("parserBES.XmlScheme");
     //
     // textSourceBES
     //
     this.textSourceBES.Lexer = this.parserBES;
     //
     // tabControl1
     //
     this.tabControl1.Controls.Add(this.tabPageSessEditor);
     this.tabControl1.Dock          = System.Windows.Forms.DockStyle.Fill;
     this.tabControl1.Font          = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     this.tabControl1.Location      = new System.Drawing.Point(0, 0);
     this.tabControl1.Margin        = new System.Windows.Forms.Padding(0);
     this.tabControl1.Name          = "tabControl1";
     this.tabControl1.SelectedIndex = 0;
     this.tabControl1.Size          = new System.Drawing.Size(726, 108);
     this.tabControl1.TabIndex      = 1;
     //
     // tabPageSessEditor
     //
     this.tabPageSessEditor.Controls.Add(this.syntaxEditBES);
     this.tabPageSessEditor.Location = new System.Drawing.Point(4, 22);
     this.tabPageSessEditor.Name     = "tabPageSessEditor";
     this.tabPageSessEditor.Padding  = new System.Windows.Forms.Padding(3);
     this.tabPageSessEditor.Size     = new System.Drawing.Size(718, 82);
     this.tabPageSessEditor.TabIndex = 0;
     this.tabPageSessEditor.Text     = "Session Relevance";
     this.tabPageSessEditor.UseVisualStyleBackColor = true;
     //
     // syntaxEditBES
     //
     this.syntaxEditBES.BackColor = System.Drawing.SystemColors.Window;
     this.syntaxEditBES.Cursor    = System.Windows.Forms.Cursors.IBeam;
     this.syntaxEditBES.Dock      = System.Windows.Forms.DockStyle.Fill;
     this.syntaxEditBES.Font      = new System.Drawing.Font("Courier New", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.syntaxEditBES.Lexer     = this.parserBES;
     this.syntaxEditBES.Location  = new System.Drawing.Point(3, 3);
     this.syntaxEditBES.Name      = "syntaxEditBES";
     this.syntaxEditBES.Size      = new System.Drawing.Size(712, 76);
     this.syntaxEditBES.Source    = this.textSourceBES;
     this.syntaxEditBES.TabIndex  = 0;
     this.syntaxEditBES.Click    += new System.EventHandler(this.syntaxEditBES_Click);
     this.syntaxEditBES.Enter    += new System.EventHandler(this.syntaxEditBES_Enter);
     //
     // toolStripStatusLabelMessage
     //
     this.toolStripStatusLabelMessage.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top)
                                                                                                              | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
                                                                                                             | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
     this.toolStripStatusLabelMessage.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenInner;
     this.toolStripStatusLabelMessage.Name        = "toolStripStatusLabelMessage";
     this.toolStripStatusLabelMessage.Size        = new System.Drawing.Size(542, 17);
     this.toolStripStatusLabelMessage.Spring      = true;
     this.toolStripStatusLabelMessage.TextAlign   = System.Drawing.ContentAlignment.MiddleLeft;
     //
     // toolStripDropDownButtonRun
     //
     this.toolStripDropDownButtonRun.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButtonRun.Image")));
     this.toolStripDropDownButtonRun.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripDropDownButtonRun.Name        = "toolStripDropDownButtonRun";
     this.toolStripDropDownButtonRun.Size        = new System.Drawing.Size(78, 20);
     this.toolStripDropDownButtonRun.Text        = "Evaluate";
     this.toolStripDropDownButtonRun.ToolTipText = "Evaluate (Ctrl-Enter or Ctrl-E)";
     this.toolStripDropDownButtonRun.Click      += new System.EventHandler(this.toolStripDropDownButtonRun_Click);
     //
     // toolStripStatusLabelEvalTime
     //
     this.toolStripStatusLabelEvalTime.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top)
                                                                                                               | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
                                                                                                              | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
     this.toolStripStatusLabelEvalTime.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenInner;
     this.toolStripStatusLabelEvalTime.Name        = "toolStripStatusLabelEvalTime";
     this.toolStripStatusLabelEvalTime.Padding     = new System.Windows.Forms.Padding(0, 0, 5, 0);
     this.toolStripStatusLabelEvalTime.Size        = new System.Drawing.Size(9, 17);
     //
     // toolStripStatusLabelConnectedUser
     //
     this.toolStripStatusLabelConnectedUser.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top)
                                                                                                                    | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
                                                                                                                   | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
     this.toolStripStatusLabelConnectedUser.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenInner;
     this.toolStripStatusLabelConnectedUser.Name        = "toolStripStatusLabelConnectedUser";
     this.toolStripStatusLabelConnectedUser.Padding     = new System.Windows.Forms.Padding(0, 0, 5, 0);
     this.toolStripStatusLabelConnectedUser.Size        = new System.Drawing.Size(9, 17);
     //
     // tableLayoutPanel1
     //
     this.tableLayoutPanel1.ColumnCount = 1;
     this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     this.tableLayoutPanel1.Controls.Add(this.tabControl1, 0, 0);
     this.tableLayoutPanel1.Controls.Add(this.statusStrip1, 0, 1);
     this.tableLayoutPanel1.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
     this.tableLayoutPanel1.Name     = "tableLayoutPanel1";
     this.tableLayoutPanel1.RowCount = 2;
     this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
     this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 22F));
     this.tableLayoutPanel1.Size     = new System.Drawing.Size(726, 130);
     this.tableLayoutPanel1.TabIndex = 5;
     //
     // statusStrip1
     //
     this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.toolStripStatusLabelMessage,
         this.toolStripStatusLabelEvalTime,
         this.toolStripStatusLabelConnectedUser,
         this.toolStripDropDownButton1,
         this.toolStripDropDownButtonRun
     });
     this.statusStrip1.Location = new System.Drawing.Point(0, 108);
     this.statusStrip1.Name     = "statusStrip1";
     this.statusStrip1.Size     = new System.Drawing.Size(726, 22);
     this.statusStrip1.TabIndex = 0;
     this.statusStrip1.Text     = "statusStrip1";
     //
     // toolStripDropDownButton1
     //
     this.toolStripDropDownButton1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.toolStripMenuItemWrap,
         this.toolStripMenuItemSplit
     });
     this.toolStripDropDownButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripDropDownButton1.Image")));
     this.toolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripDropDownButton1.Name = "toolStripDropDownButton1";
     this.toolStripDropDownButton1.Size = new System.Drawing.Size(73, 20);
     this.toolStripDropDownButton1.Text = "Options";
     //
     // toolStripMenuItemWrap
     //
     this.toolStripMenuItemWrap.Checked      = true;
     this.toolStripMenuItemWrap.CheckOnClick = true;
     this.toolStripMenuItemWrap.CheckState   = System.Windows.Forms.CheckState.Checked;
     this.toolStripMenuItemWrap.Image        = ((System.Drawing.Image)(resources.GetObject("toolStripMenuItemWrap.Image")));
     this.toolStripMenuItemWrap.Name         = "toolStripMenuItemWrap";
     this.toolStripMenuItemWrap.Size         = new System.Drawing.Size(100, 22);
     this.toolStripMenuItemWrap.Text         = "Wrap";
     this.toolStripMenuItemWrap.Click       += new System.EventHandler(this.toolStripMenuItemWrap_Click);
     //
     // toolStripMenuItemSplit
     //
     this.toolStripMenuItemSplit.Checked      = true;
     this.toolStripMenuItemSplit.CheckOnClick = true;
     this.toolStripMenuItemSplit.CheckState   = System.Windows.Forms.CheckState.Checked;
     this.toolStripMenuItemSplit.Image        = ((System.Drawing.Image)(resources.GetObject("toolStripMenuItemSplit.Image")));
     this.toolStripMenuItemSplit.Name         = "toolStripMenuItemSplit";
     this.toolStripMenuItemSplit.Size         = new System.Drawing.Size(100, 22);
     this.toolStripMenuItemSplit.Text         = "Split";
     this.toolStripMenuItemSplit.Click       += new System.EventHandler(this.toolStripMenuItemSplit_Click);
     //
     // parser1
     //
     this.parser1.DefaultState = 0;
     this.parser1.XmlScheme    = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<LexScheme xmlns:xsi=\"http://www.w3.org/" +
                                 "2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n  <Versi" +
                                 "on>1.5</Version>\r\n</LexScheme>";
     //
     // ADXExcelTaskPaneSessEditor
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(726, 130);
     this.Controls.Add(this.tableLayoutPanel1);
     this.Icon          = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Location      = new System.Drawing.Point(0, 0);
     this.Name          = "ADXExcelTaskPaneSessEditor";
     this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
     this.Text          = "IBM BigFix Session Relevance Editor";
     this.tabControl1.ResumeLayout(false);
     this.tabPageSessEditor.ResumeLayout(false);
     this.tableLayoutPanel1.ResumeLayout(false);
     this.tableLayoutPanel1.PerformLayout();
     this.statusStrip1.ResumeLayout(false);
     this.statusStrip1.PerformLayout();
     this.ResumeLayout(false);
 }
コード例 #23
0
ファイル: XmlSyntaxEditInfo.cs プロジェクト: stevencohn/Orqa
 public XmlSyntaxEditInfo(SyntaxEdit Owner) : this()
 {
     this.owner = Owner;
 }
コード例 #24
0
 public void Paint(ITextPainter Painter)
 {
     if ((this.pages != null) && (this.pages.PageType != PageType.Normal))
     {
         DrawInfo   info1;
         SyntaxEdit edit1      = (SyntaxEdit)this.pages.Owner;
         Rectangle  rectangle1 = this.ClientRect;
         info1 = new DrawInfo();
         if (this.pages.PageType == PageType.PageBreaks)
         {
             Rectangle rectangle2 = edit1.ClientRect;
             rectangle1.X     = rectangle2.Left + ((Gutter)edit1.Gutter).GetWidth();
             rectangle1.Width = rectangle2.Right - rectangle1.Left;
             if (!this.IsLastPage)
             {
                 info1.Init();
                 info1.Page = this.Index;
                 if (edit1.OnCustomDraw(Painter, rectangle1, DrawStage.Before, DrawState.PageBorder, info1))
                 {
                     return;
                 }
                 Painter.DrawLine(rectangle1.Left, rectangle1.Bottom - 1, rectangle1.Right, rectangle1.Bottom - 1, this.pages.BorderColor, 1, DashStyle.Dot);
                 edit1.OnCustomDraw(Painter, rectangle1, DrawStage.After, DrawState.PageBorder, info1);
             }
         }
         else
         {
             Rectangle rectangle3 = this.BoundsRect;
             info1.Init();
             info1.Page = this.Index;
             if (!edit1.OnCustomDraw(Painter, rectangle3, DrawStage.Before, DrawState.PageBorder, info1))
             {
                 bool flag1 = this.pages.DisplayWhiteSpace;
                 int  num1  = edit1.Painter.FontHeight;
                 if (num1 != 0)
                 {
                     rectangle1.Height = (rectangle1.Height / num1) * num1;
                 }
                 Rectangle rectangle4 = this.PaintRect;
                 rectangle3.Inflate(1, 1);
                 this.FrameRect(Painter, ref rectangle3, this.pages.BorderColor, this.pages.BackColor, flag1);
                 this.FillBoundsRect(Painter, rectangle4, rectangle3, this.pages.BackColor, false);
                 rectangle3 = this.BoundsRect;
                 this.FillBoundsRect(Painter, rectangle3, rectangle1, edit1.BackColor, this.pages.Transparent);
                 if ((this.pages == null) || this.pages.DisplayWhiteSpace)
                 {
                     int       num2       = Math.Max((int)(rectangle1.Left - this.header.Offset.X), rectangle3.Left);
                     int       num3       = Math.Min((int)((rectangle1.Left + rectangle1.Width) + this.header.Offset.X), rectangle3.Right);
                     Rectangle rectangle5 = new Rectangle(num2, Math.Max((int)(rectangle1.Top - (this.header.Offset.Y + this.header.Font.Height)), this.BoundsRect.Top), num3 - num2, this.header.Font.Height);
                     this.header.Paint(Painter, rectangle5, this.Index, this.pages.Count, false);
                     num2       = Math.Max((int)(rectangle1.Left - this.footer.Offset.X), rectangle3.Left);
                     num3       = Math.Min((int)((rectangle1.Left + rectangle1.Width) + this.footer.Offset.X), rectangle3.Right);
                     rectangle5 = new Rectangle(num2, Math.Min((int)(rectangle1.Bottom + this.footer.Offset.Y), (int)(rectangle3.Bottom - this.footer.Font.Height)), num3 - num2, this.footer.Font.Height);
                     this.footer.Paint(Painter, rectangle5, this.Index, this.pages.Count, this.paintNumber);
                 }
                 edit1.OnCustomDraw(Painter, rectangle3, DrawStage.After, DrawState.PageBorder, info1);
             }
             edit1.PaintWindow(Painter, this.startLine, new Rectangle(0, 0, rectangle1.Width, rectangle1.Height), rectangle1.Location, 1f, 1f, true);
         }
     }
 }
コード例 #25
0
ファイル: MainForm.cs プロジェクト: shadabahmed/megaide
        /// <summary>
        /// Creates a new tab displaying the text content of the specified file.
        /// </summary>
        /// <param name="fileName">
        /// Path of the file.
        /// </param>
        public void OpenFile(string fileName)
        {
            //Check for file existence
            if(!System.IO.File.Exists(fileName))
            {
                MessageBox.Show(fileName+" does not exist!","MegaIDE",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Warning);
                RecentDocuments.RemoveFromRecentFiles(fileName);
                UpdateRecentDocumentsList();
                return;
            }

            SyntaxEdit syntaxEdit;

            //Check if already open
            if(tabbedGroups.RootSequence.Count != 0)
            {
                foreach(NETXP.Controls.Docking.TabPage selectedPage in tabNode.TabPages)
                {
                    if(selectedPage.ToolTipText.ToLower().Equals(fileName.ToLower()))
                    {
                        tabNode.TabControl.SelectedTab=selectedPage;
                        syntaxEdit=(selectedPage.Control as SyntaxEdit);
                        syntaxEdit.Refresh();
                        /*if(!(bool)selectedPage.Tag)
                        {
                            syntaxEdit=(selectedPage.Control as SyntaxEdit);
                            syntaxEdit.Source.LoadFile(fileName);
                            syntaxEdit.Refresh();
                        }*/
                        return;
                    }
                }
            }

            //Create a new tab
            syntaxEdit=new SyntaxEdit();

            // Loading syntax highlighter is the file is a source file.
            if(Path.GetExtension(fileName).ToLower()==".c" || Path.GetExtension(fileName).ToLower()==".h")
                syntaxEdit.Lexer=parser;

            syntaxEdit.SourceStateChanged+=new NotifyEvent(syntaxEdit_SourceStateChanged);

            // Code completion event handler declaration.
            if(isProjectOpen && ProjectManagerClass.ProjectManager.GetFileNode(fileName) != null)
                syntaxEdit.NeedCodeCompletion+=new CodeCompletionEvent(syntaxEdit_NeedCodeCompletion);

            // Initialization of syntaxEdit
            syntaxEdit.CodeCompletionHint.Images=treeImageList;
            syntaxEdit.CodeCompletionBox.Images=treeImageList;
            syntaxEdit.Selection.Options=QWEditor.SelectionOptions.UseColors;
            syntaxEdit.Gutter.Options=QWEditor.GutterOptions.PaintLinesOnGutter;
            syntaxEdit.Selection.InActiveBackColor=System.Drawing.Color.Yellow;
            syntaxEdit.Selection.InActiveForeColor=System.Drawing.Color.Black;
            syntaxEdit.Anchor=((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)| System.Windows.Forms.AnchorStyles.Left)| System.Windows.Forms.AnchorStyles.Right)));
            globalSyntaxSettings.ApplyToEdit(syntaxEdit);
            syntaxEdit.Scrolling.UpdateScroll();
            syntaxEdit.ShowScrollHint(10);
            syntaxEdit.ContextMenu=tabContextMenu;
            syntaxEdit.Source.FileName=fileName;
            syntaxEdit.Source.LoadFile(fileName);

            // Creating new tab page
            NETXP.Controls.Docking.TabPage newTabPage=new NETXP.Controls.Docking.TabPage(Path.GetFileName(fileName));
            newTabPage.ToolTipText=fileName;
            newTabPage.Control=syntaxEdit;
            newTabPage.Tag=false; // false means file not modified

            // Check for readonly file. To be reviewed and removed with next QWEditor version.
            if((((byte)System.IO.File.GetAttributes(fileName))&7)>0)
            {
                syntaxEdit.Source.ReadOnly=true;
                newTabPage.Title+="(Read Only)";
            }

            if(tabbedGroups.RootSequence.Count==0)
            {
                tabNode=tabbedGroups.RootSequence.AddNewNode();
                tabNode.TabControl.SelectionChanged+=new EventHandler(TabControl_SelectionChanged);
            }

            tabNode.TabControl.SelectedIndex=tabNode.TabPages.Add(newTabPage);

            // Update recent files list.
            RecentDocuments.AddToRecentFiles(fileName);
            UpdateRecentDocumentsList();
        }