CodeCompletionWindow(ICompletionDataProvider completionDataProvider, ICompletionData[] completionData, Form parentForm, TextEditorControl control, bool showDeclarationWindow, bool fixedListViewWidth) : base(parentForm, control) { this.dataProvider = completionDataProvider; this.completionData = completionData; this.document = control.Document; this.showDeclarationWindow = showDeclarationWindow; this.fixedListViewWidth = fixedListViewWidth; workingScreen = Screen.GetWorkingArea(Location); startOffset = control.ActiveTextAreaControl.Caret.Offset + 1; endOffset = startOffset; if (completionDataProvider.PreSelection != null) { startOffset -= completionDataProvider.PreSelection.Length + 1; endOffset--; } codeCompletionListView = new CodeCompletionListView(completionData); codeCompletionListView.Font = new System.Drawing.Font(FontFamily.GenericMonospace, codeCompletionListView.Font.Size); codeCompletionListView.ImageList = completionDataProvider.ImageList; codeCompletionListView.Dock = DockStyle.Fill; codeCompletionListView.SelectedItemChanged += new EventHandler(CodeCompletionListViewSelectedItemChanged); codeCompletionListView.DoubleClick += new EventHandler(CodeCompletionListViewDoubleClick); codeCompletionListView.Click += new EventHandler(CodeCompletionListViewClick); Controls.Add(codeCompletionListView); if (completionData.Length > MaxListLength) { vScrollBar.Dock = DockStyle.Right; vScrollBar.Minimum = 0; vScrollBar.Maximum = completionData.Length - 1; vScrollBar.SmallChange = 1; vScrollBar.LargeChange = MaxListLength; codeCompletionListView.FirstItemChanged += new EventHandler(CodeCompletionListViewFirstItemChanged); Controls.Add(vScrollBar); } this.drawingSize = GetListViewSize(); SetLocation(); if (declarationViewWindow == null) { declarationViewWindow = new DeclarationViewWindow(parentForm); } SetDeclarationViewLocation(); declarationViewWindow.ShowDeclarationViewWindow(); declarationViewWindow.MouseMove += ControlMouseMove; control.Focus(); CodeCompletionListViewSelectedItemChanged(this, EventArgs.Empty); if (completionDataProvider.DefaultIndex >= 0) { codeCompletionListView.SelectIndex(completionDataProvider.DefaultIndex); } if (completionDataProvider.PreSelection != null) { CaretOffsetChanged(this, EventArgs.Empty); } vScrollBar.ValueChanged += VScrollBarValueChanged; document.DocumentAboutToBeChanged += DocumentAboutToBeChanged; }
private CodeCompletionWindow(ICompletionDataProvider completionDataProvider, ICompletionData[] completionData, Form parentForm, TextEditorControl control, bool showDeclarationWindow, bool fixedListViewWidth) : base(parentForm, control) { this.dataProvider = completionDataProvider; this.completionData = completionData; this.document = control.Document; this.showDeclarationWindow = showDeclarationWindow; this.fixedListViewWidth = fixedListViewWidth; this.workingScreen = Screen.GetWorkingArea(base.Location); this.startOffset = control.ActiveTextAreaControl.Caret.Offset + 1; this.endOffset = this.startOffset; if (completionDataProvider.PreSelection != null) { CodeCompletionWindow length = this; length.startOffset = length.startOffset - (completionDataProvider.PreSelection.Length + 1); this.endOffset--; } this.codeCompletionListView = new CodeCompletionListView(completionData) { ImageList = completionDataProvider.ImageList, Dock = DockStyle.Fill }; this.codeCompletionListView.SelectedItemChanged += new EventHandler(this.CodeCompletionListViewSelectedItemChanged); this.codeCompletionListView.DoubleClick += new EventHandler(this.CodeCompletionListViewDoubleClick); this.codeCompletionListView.Click += new EventHandler(this.CodeCompletionListViewClick); base.Controls.Add(this.codeCompletionListView); if ((int)completionData.Length > 10) { this.vScrollBar.Dock = DockStyle.Right; this.vScrollBar.Minimum = 0; this.vScrollBar.Maximum = (int)completionData.Length - 1; this.vScrollBar.SmallChange = 1; this.vScrollBar.LargeChange = 10; this.codeCompletionListView.FirstItemChanged += new EventHandler(this.CodeCompletionListViewFirstItemChanged); base.Controls.Add(this.vScrollBar); } this.drawingSize = this.GetListViewSize(); this.SetLocation(); if (this.declarationViewWindow == null) { this.declarationViewWindow = new DeclarationViewWindow(parentForm); } this.SetDeclarationViewLocation(); this.declarationViewWindow.ShowDeclarationViewWindow(); this.declarationViewWindow.MouseMove += new MouseEventHandler(this.ControlMouseMove); control.Focus(); this.CodeCompletionListViewSelectedItemChanged(this, EventArgs.Empty); if (completionDataProvider.DefaultIndex >= 0) { this.codeCompletionListView.SelectIndex(completionDataProvider.DefaultIndex); } if (completionDataProvider.PreSelection != null) { this.CaretOffsetChanged(this, EventArgs.Empty); } this.vScrollBar.ValueChanged += new EventHandler(this.VScrollBarValueChanged); this.document.DocumentAboutToBeChanged += new DocumentEventHandler(this.DocumentAboutToBeChanged); }
CodeCompletionWindow(ICompletionDataProvider completionDataProvider, ICompletionData[] completionData, Form parentForm, TextEditorControl control, string fileName) : base(parentForm, control, fileName) { this.dataProvider = completionDataProvider; this.completionData = completionData; workingScreen = Screen.GetWorkingArea(Location); startOffset = control.ActiveTextAreaControl.Caret.Offset + 1; endOffset = startOffset; if (completionDataProvider.PreSelection != null) { startOffset -= completionDataProvider.PreSelection.Length + 1; endOffset--; } codeCompletionListView = new CodeCompletionListView(completionData); codeCompletionListView.ImageList = completionDataProvider.ImageList; codeCompletionListView.Dock = DockStyle.Fill; codeCompletionListView.SelectedItemChanged += new EventHandler(CodeCompletionListViewSelectedItemChanged); codeCompletionListView.DoubleClick += new EventHandler(CodeCompletionListViewDoubleClick); codeCompletionListView.Click += new EventHandler(CodeCompletionListViewClick); Controls.Add(codeCompletionListView); if (completionData.Length > 10) { vScrollBar.Dock = DockStyle.Right; vScrollBar.Minimum = 0; vScrollBar.Maximum = completionData.Length - 8; vScrollBar.SmallChange = 1; vScrollBar.LargeChange = 3; codeCompletionListView.FirstItemChanged += new EventHandler(CodeCompletionListViewFirstItemChanged); Controls.Add(vScrollBar); } this.drawingSize = new Size(codeCompletionListView.ItemHeight * 10, codeCompletionListView.ItemHeight * Math.Min(10, completionData.Length)); SetLocation(); if (declarationViewWindow == null) { declarationViewWindow = new DeclarationViewWindow(parentForm); } SetDeclarationViewLocation(); declarationViewWindow.ShowDeclarationViewWindow(); control.Focus(); CodeCompletionListViewSelectedItemChanged(this, EventArgs.Empty); if (completionDataProvider.DefaultIndex >= 0) { codeCompletionListView.SelectIndex(completionDataProvider.DefaultIndex); } if (completionDataProvider.PreSelection != null) { CaretOffsetChanged(this, EventArgs.Empty); } vScrollBar.Scroll += new ScrollEventHandler(DoScroll); }
protected override void OnClosed(EventArgs e) { base.OnClosed(e); Dispose(); codeCompletionListView.Dispose(); codeCompletionListView = null; declarationViewWindow.Dispose(); declarationViewWindow = null; }
AutoCompleteWindow(ICompletionDataProvider completionDataProvider, Form parentForm, TextEditorControl control, string fileName, bool showDeclarationWindow) : base(parentForm, control) { this.showDeclarationWindow = showDeclarationWindow; workingScreen = Screen.GetWorkingArea(Location); startOffset = control.ActiveTextAreaControl.Caret.Offset + 1; endOffset = startOffset; if (completionDataProvider.PreSelection != null) { startOffset -= completionDataProvider.PreSelection.Length + 1; endOffset--; } codeCompletionListView = new CodeCompletionListView(completionData); codeCompletionListView.ImageList = completionDataProvider.ImageList; codeCompletionListView.Dock = DockStyle.Fill; codeCompletionListView.SelectedItemChanged += new EventHandler(CodeCompletionListViewSelectedItemChanged); codeCompletionListView.DoubleClick += new EventHandler(CodeCompletionListViewDoubleClick); codeCompletionListView.Click += new EventHandler(CodeCompletionListViewClick); Controls.Add(codeCompletionListView); if (completionData.Length > 10) { vScrollBar.Dock = DockStyle.Right; vScrollBar.Minimum = 0; vScrollBar.Maximum = completionData.Length - 8; vScrollBar.SmallChange = 1; vScrollBar.LargeChange = 3; codeCompletionListView.FirstItemChanged += new EventHandler(CodeCompletionListViewFirstItemChanged); Controls.Add(vScrollBar); } this.drawingSize = GetListViewSize(); SetLocation(); declarationViewWindow = new DeclarationViewWindow(parentForm); SetDeclarationViewLocation(); declarationViewWindow.ShowDeclarationViewWindow(); control.Focus(); CodeCompletionListViewSelectedItemChanged(this, EventArgs.Empty); if (completionDataProvider.DefaultIndex >= 0) { codeCompletionListView.SelectIndex(completionDataProvider.DefaultIndex); } if (completionDataProvider.PreSelection != null) { CaretOffsetChanged(this, EventArgs.Empty); } vScrollBar.Scroll += new ScrollEventHandler(DoScroll); }
protected override void Dispose(bool disposing) { if (disposing) { document.DocumentAboutToBeChanged -= DocumentAboutToBeChanged; if (codeCompletionListView != null) { codeCompletionListView.Dispose(); codeCompletionListView = null; } if (declarationViewWindow != null) { declarationViewWindow.Dispose(); declarationViewWindow = null; } } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { this.document.DocumentAboutToBeChanged -= new DocumentEventHandler(this.DocumentAboutToBeChanged); if (this.codeCompletionListView != null) { this.codeCompletionListView.Dispose(); this.codeCompletionListView = null; } if (this.declarationViewWindow != null) { this.declarationViewWindow.Dispose(); this.declarationViewWindow = null; } } base.Dispose(disposing); }
// DC (this code was in the constructor of this method which was not working on a multithread environment public void loadGui() { var completionDataProvider = this.dataProvider; workingScreen = Screen.GetWorkingArea(Location); // startOffset = control.ActiveTextAreaControl.Caret.Offset;// +1; // endOffset = startOffset; endOffset = control.ActiveTextAreaControl.Caret.Offset; if (completionDataProvider.PreSelection != null) { startOffset -= completionDataProvider.PreSelection.Length + 1; endOffset--; } guiLoaded = true; codeCompletionListView = new CodeCompletionListView(completionData); codeCompletionListView.ImageList = completionDataProvider.ImageList; codeCompletionListView.Dock = DockStyle.Fill; codeCompletionListView.SelectedItemChanged += new EventHandler(CodeCompletionListViewSelectedItemChanged); codeCompletionListView.DoubleClick += new EventHandler(CodeCompletionListViewDoubleClick); codeCompletionListView.Click += new EventHandler(CodeCompletionListViewClick); Controls.Add(codeCompletionListView); if (completionData.Length > MaxListLength) { vScrollBar.Dock = DockStyle.Right; vScrollBar.Minimum = 0; vScrollBar.Maximum = completionData.Length - 1; vScrollBar.SmallChange = 1; vScrollBar.LargeChange = MaxListLength; codeCompletionListView.FirstItemChanged += new EventHandler(CodeCompletionListViewFirstItemChanged); Controls.Add(vScrollBar); } this.drawingSize = GetListViewSize(); SetLocation(); if (declarationViewWindow == null) { declarationViewWindow = new DeclarationViewWindow(parentForm); } SetDeclarationViewLocation(); declarationViewWindow.ShowDeclarationViewWindow(); declarationViewWindow.MouseMove += ControlMouseMove; // control.Focus(); CodeCompletionListViewSelectedItemChanged(this, EventArgs.Empty); if (completionDataProvider.DefaultIndex >= 0) { codeCompletionListView.SelectIndex(completionDataProvider.DefaultIndex); } if (completionDataProvider.PreSelection != null) { CaretOffsetChanged(this, EventArgs.Empty); } vScrollBar.ValueChanged += VScrollBarValueChanged; document.DocumentAboutToBeChanged += DocumentAboutToBeChanged; }