|
|
|
@ -5,24 +5,26 @@ |
|
|
|
// <version>$Revision$</version>
|
|
|
|
// <version>$Revision$</version>
|
|
|
|
// </file>
|
|
|
|
// </file>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using ICSharpCode.Core.Presentation; |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Drawing; |
|
|
|
using System.Drawing; |
|
|
|
using System.IO; |
|
|
|
using System.IO; |
|
|
|
using System.Windows.Forms; |
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
using System.Windows; |
|
|
|
|
|
|
|
using System.Windows.Controls; |
|
|
|
|
|
|
|
using System.Windows.Input; |
|
|
|
using ICSharpCode.Core; |
|
|
|
using ICSharpCode.Core; |
|
|
|
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
|
|
|
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
|
|
|
using ICSharpCode.SharpDevelop.Dom; |
|
|
|
using ICSharpCode.SharpDevelop.Dom; |
|
|
|
using ICSharpCode.SharpDevelop.Gui.XmlForms; |
|
|
|
|
|
|
|
using ICSharpCode.SharpDevelop.Project; |
|
|
|
using ICSharpCode.SharpDevelop.Project; |
|
|
|
using ICSharpCode.TextEditor; |
|
|
|
using ICSharpCode.TextEditor; |
|
|
|
using ICSharpCode.TextEditor.Gui.CompletionWindow; |
|
|
|
using ICSharpCode.TextEditor.Gui.CompletionWindow; |
|
|
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
{ |
|
|
|
{ |
|
|
|
public class GotoDialog : BaseSharpDevelopForm |
|
|
|
public partial class GotoDialog : Window |
|
|
|
{ |
|
|
|
{ |
|
|
|
static GotoDialog Instance = null; |
|
|
|
static GotoDialog Instance = null; |
|
|
|
|
|
|
|
|
|
|
|
@ -30,64 +32,49 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (Instance == null) { |
|
|
|
if (Instance == null) { |
|
|
|
Instance = new GotoDialog(); |
|
|
|
Instance = new GotoDialog(); |
|
|
|
Instance.Show(WorkbenchSingleton.MainWin32Window); |
|
|
|
Instance.Owner = WorkbenchSingleton.MainWindow; |
|
|
|
|
|
|
|
Instance.Show(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Instance.Focus(); |
|
|
|
Instance.Activate(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ListView listView; |
|
|
|
|
|
|
|
TextBox textBox; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public GotoDialog() |
|
|
|
public GotoDialog() |
|
|
|
{ |
|
|
|
{ |
|
|
|
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.GotoDialog.xfrm")); |
|
|
|
InitializeComponent(); |
|
|
|
ControlDictionary["okButton"].Click += new EventHandler(OKButtonClick); |
|
|
|
// listView.SmallImageList = ClassBrowserIconService.ImageList;
|
|
|
|
ControlDictionary["cancelButton"].Click += new EventHandler(CancelButtonClick); |
|
|
|
// listView.ItemActivate += OKButtonClick;
|
|
|
|
listView = (ListView)ControlDictionary["listView"]; |
|
|
|
// listView.Sorting = SortOrder.Ascending;
|
|
|
|
textBox = (TextBox)ControlDictionary["textBox"]; |
|
|
|
// listView.HideSelection = false;
|
|
|
|
textBox.TextChanged += TextBoxTextChanged; |
|
|
|
// FormLocationHelper.Apply(this, "ICSharpCode.SharpDevelop.Gui.GotoDialog.Bounds", true);
|
|
|
|
textBox.KeyDown += TextBoxKeyDown; |
|
|
|
textBox.Focus(); |
|
|
|
listView.SmallImageList = ClassBrowserIconService.ImageList; |
|
|
|
|
|
|
|
listView.ItemActivate += OKButtonClick; |
|
|
|
|
|
|
|
listView.Sorting = SortOrder.Ascending; |
|
|
|
|
|
|
|
listView.SizeChanged += ListViewSizeChanged; |
|
|
|
|
|
|
|
listView.HideSelection = false; |
|
|
|
|
|
|
|
ListViewSizeChanged(null, null); |
|
|
|
|
|
|
|
Icon = null; |
|
|
|
|
|
|
|
FormLocationHelper.Apply(this, "ICSharpCode.SharpDevelop.Gui.GotoDialog.Bounds", true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ListViewSizeChanged(object sender, EventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
listView.Columns[0].Width = listView.Width - 24; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void TextBoxKeyDown(object sender, KeyEventArgs e) |
|
|
|
void textBoxPreviewKeyDown(object sender, KeyEventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (listView.SelectedItems.Count == 0) |
|
|
|
if (listBox.SelectedItem == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
if (e.KeyData == Keys.Up) { |
|
|
|
if (e.Key == Key.Up) { |
|
|
|
e.Handled = true; |
|
|
|
e.Handled = true; |
|
|
|
ChangeIndex(-1); |
|
|
|
ChangeIndex(-1); |
|
|
|
} else if (e.KeyData == Keys.Down) { |
|
|
|
} else if (e.Key == Key.Down) { |
|
|
|
e.Handled = true; |
|
|
|
e.Handled = true; |
|
|
|
ChangeIndex(+1); |
|
|
|
ChangeIndex(+1); |
|
|
|
} else if (e.KeyData == Keys.PageUp) { |
|
|
|
} else if (e.Key == Key.PageUp) { |
|
|
|
e.Handled = true; |
|
|
|
e.Handled = true; |
|
|
|
ChangeIndex(-listView.ClientSize.Height / listView.Items[0].Bounds.Height); |
|
|
|
ChangeIndex((int)Math.Round(-listBox.ActualHeight / ((ListBoxItem)listBox.SelectedItem).ActualHeight)); |
|
|
|
} else if (e.KeyData == Keys.PageDown) { |
|
|
|
} else if (e.Key == Key.PageDown) { |
|
|
|
e.Handled = true; |
|
|
|
e.Handled = true; |
|
|
|
ChangeIndex(+listView.ClientSize.Height / listView.Items[0].Bounds.Height); |
|
|
|
ChangeIndex((int)Math.Round(+listBox.ActualHeight / ((ListBoxItem)listBox.SelectedItem).ActualHeight)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ChangeIndex(int increment) |
|
|
|
void ChangeIndex(int increment) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int index = listView.SelectedIndices[0]; |
|
|
|
int index = listBox.SelectedIndex; |
|
|
|
index = Math.Max(0, Math.Min(listView.Items.Count - 1, index + increment)); |
|
|
|
index = Math.Max(0, Math.Min(listBox.Items.Count - 1, index + increment)); |
|
|
|
listView.Items[index].Selected = true; |
|
|
|
((ListBoxItem)listBox.Items[index]).IsSelected = true; |
|
|
|
listView.EnsureVisible(index); |
|
|
|
listBox.ScrollIntoView(listBox.Items[index]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ICompletionData[] ctrlSpaceCompletionData; |
|
|
|
ICompletionData[] ctrlSpaceCompletionData; |
|
|
|
@ -126,21 +113,18 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
Dictionary<string, object> visibleEntries = new Dictionary<string, object>(); |
|
|
|
Dictionary<string, object> visibleEntries = new Dictionary<string, object>(); |
|
|
|
int bestMatchType; |
|
|
|
int bestMatchType; |
|
|
|
double bestPriority; |
|
|
|
double bestPriority; |
|
|
|
ListViewItem bestItem; |
|
|
|
ListBoxItem bestItem; |
|
|
|
|
|
|
|
|
|
|
|
void TextBoxTextChanged(object sender, EventArgs e) |
|
|
|
void textBoxTextChanged(object sender, TextChangedEventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
string text = textBox.Text.Trim(); |
|
|
|
string text = textBox.Text.Trim(); |
|
|
|
listView.BeginUpdate(); |
|
|
|
listBox.Items.Clear(); |
|
|
|
listView.Items.Clear(); |
|
|
|
|
|
|
|
visibleEntries.Clear(); |
|
|
|
visibleEntries.Clear(); |
|
|
|
bestItem = null; |
|
|
|
bestItem = null; |
|
|
|
if (text.Length == 0) { |
|
|
|
if (text.Length == 0) { |
|
|
|
listView.EndUpdate(); |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (text.Length == 1 && !char.IsDigit(text, 0)) { |
|
|
|
if (text.Length == 1 && !char.IsDigit(text, 0)) { |
|
|
|
listView.EndUpdate(); |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
int dotPos = text.IndexOf('.'); |
|
|
|
int dotPos = text.IndexOf('.'); |
|
|
|
@ -190,10 +174,9 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
ShowCtrlSpaceCompletion(text); |
|
|
|
ShowCtrlSpaceCompletion(text); |
|
|
|
} |
|
|
|
} |
|
|
|
if (bestItem != null) { |
|
|
|
if (bestItem != null) { |
|
|
|
bestItem.Selected = true; |
|
|
|
bestItem.IsSelected = true; |
|
|
|
listView.EnsureVisible(bestItem.Index); |
|
|
|
listBox.ScrollIntoView(bestItem); |
|
|
|
} |
|
|
|
} |
|
|
|
listView.EndUpdate(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AddSourceFiles(string text, int lineNumber) |
|
|
|
void AddSourceFiles(string text, int lineNumber) |
|
|
|
@ -335,7 +318,18 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
if (visibleEntries.ContainsKey(text)) |
|
|
|
if (visibleEntries.ContainsKey(text)) |
|
|
|
return; |
|
|
|
return; |
|
|
|
visibleEntries.Add(text, null); |
|
|
|
visibleEntries.Add(text, null); |
|
|
|
ListViewItem item = new ListViewItem(text, imageIndex); |
|
|
|
ListBoxItem item = new ListBoxItem(); |
|
|
|
|
|
|
|
item.Content = new StackPanel { |
|
|
|
|
|
|
|
Orientation = Orientation.Horizontal, |
|
|
|
|
|
|
|
Children = { |
|
|
|
|
|
|
|
PresentationResourceService.GetImage(ClassBrowserIconService.ResourceNames[imageIndex]), |
|
|
|
|
|
|
|
new TextBlock { |
|
|
|
|
|
|
|
Text = text, |
|
|
|
|
|
|
|
Margin = new Thickness(4, 0, 0, 0) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
item.MouseDoubleClick += okButtonClick; |
|
|
|
item.Tag = tag; |
|
|
|
item.Tag = tag; |
|
|
|
if (bestItem == null |
|
|
|
if (bestItem == null |
|
|
|
|| (tag is IMember && bestItem.Tag is IClass) |
|
|
|
|| (tag is IMember && bestItem.Tag is IClass) |
|
|
|
@ -346,7 +340,7 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
bestPriority = priority; |
|
|
|
bestPriority = priority; |
|
|
|
bestMatchType = matchType; |
|
|
|
bestMatchType = matchType; |
|
|
|
} |
|
|
|
} |
|
|
|
listView.Items.Add(item); |
|
|
|
listBox.Items.Add(item); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AddItem(IClass c, int matchType) |
|
|
|
void AddItem(IClass c, int matchType) |
|
|
|
@ -368,7 +362,7 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
AddItem(e.Name + " (" + e.FullyQualifiedName + ")", imageIndex, e, priority, matchType); |
|
|
|
AddItem(e.Name + " (" + e.FullyQualifiedName + ")", imageIndex, e, priority, matchType); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void CancelButtonClick(object sender, EventArgs e) |
|
|
|
void cancelButtonClick(object sender, RoutedEventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Close(); |
|
|
|
Close(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -389,12 +383,12 @@ namespace ICSharpCode.SharpDevelop.Gui |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void OKButtonClick(object sender, EventArgs e) |
|
|
|
void okButtonClick(object sender, RoutedEventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (listView.SelectedItems.Count == 0) |
|
|
|
if (listBox.SelectedItem == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
object tag = listView.SelectedItems[0].Tag; |
|
|
|
object tag = ((ListBoxItem)listBox.SelectedItem).Tag; |
|
|
|
if (tag is int) { |
|
|
|
if (tag is int) { |
|
|
|
TextEditorControl editor = GetEditor(); |
|
|
|
TextEditorControl editor = GetEditor(); |
|
|
|
if (editor != null) { |
|
|
|
if (editor != null) { |
|
|
|
|