Browse Source

Converted GoTo dialog to WPF, add LocalizeExtension to ICSharpCode.Core.Presentation.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0wpf@3373 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
24507c638c
  1. 10
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Configuration/AssemblyInfo.cs
  2. 7
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  3. 70
      src/Main/Base/Project/Resources/GotoDialog.xfrm
  4. 2
      src/Main/Base/Project/Src/Commands/AutostartCommands.cs
  5. 19
      src/Main/Base/Project/Src/Gui/App.xaml
  6. 16
      src/Main/Base/Project/Src/Gui/App.xaml.cs
  7. 10
      src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.xaml
  8. 158
      src/Main/Base/Project/Src/Services/ClassBrowserIcons/ClassBrowserIconService.cs
  9. 106
      src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs
  10. 68
      src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.xaml
  11. 1
      src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj
  12. 30
      src/Main/ICSharpCode.Core.Presentation/LocalizeExtension.cs
  13. 4
      src/Main/ICSharpCode.Core.Presentation/Properties/AssemblyInfo.cs

10
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Configuration/AssemblyInfo.cs

@ -41,10 +41,10 @@ using System.Windows.Markup; @@ -41,10 +41,10 @@ using System.Windows.Markup;
// app, or any theme specific resource dictionaries)
)]
[assembly: XmlnsPrefix("http://sharpdevelop.net", "sd")]
[assembly: XmlnsPrefix("http://icsharpcode.net/sharpdevelop/wpfdesigner", "wpfdesigner")]
[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer")]
[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer.Controls")]
[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer.PropertyGrid")]
[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors")]
[assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/wpfdesigner", "ICSharpCode.WpfDesign.Designer")]
[assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/wpfdesigner", "ICSharpCode.WpfDesign.Designer.Controls")]
[assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/wpfdesigner", "ICSharpCode.WpfDesign.Designer.PropertyGrid")]
[assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/wpfdesigner", "ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors")]

7
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -70,6 +70,10 @@ @@ -70,6 +70,10 @@
<Compile Include="Src\Gui\AbstractSecondaryViewContent.cs" />
<Compile Include="Src\Gui\AbstractViewContentHandlingLoadErrors.cs" />
<Compile Include="Src\Gui\AbstractViewContentWithoutFile.cs" />
<Compile Include="Src\Gui\App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Gui\BrowserDisplayBinding\BrowserDisplayBinding.cs" />
<Compile Include="Src\Gui\Components\SideBar\TextEditorSideBar.cs" />
<Compile Include="Src\Gui\Dialogs\AddOpenWithEntryDialog.cs" />
@ -477,7 +481,6 @@ @@ -477,7 +481,6 @@
<EmbeddedResource Include="Resources\TreeViewOptionsDialog.xfrm" />
<EmbeddedResource Include="Resources\WordCountDialog.xfrm" />
<EmbeddedResource Include="Resources\BehaviorTextEditorPanel.xfrm" />
<EmbeddedResource Include="Resources\GotoDialog.xfrm" />
<EmbeddedResource Include="Resources\GeneralTextEditorPanel.xfrm" />
<EmbeddedResource Include="Resources\CodeTemplatePanel.xfrm" />
<EmbeddedResource Include="Resources\MarkersTextEditorPanel.xfrm" />
@ -796,7 +799,9 @@ @@ -796,7 +799,9 @@
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
<Private>True</Private>
</ProjectReference>
<Page Include="Src\Gui\App.xaml" />
<Page Include="Src\Gui\Workbench\WpfWorkbench.xaml" />
<Page Include="Src\TextEditor\Gui\Dialogs\GotoDialog.xaml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

70
src/Main/Base/Project/Resources/GotoDialog.xfrm

@ -1,70 +0,0 @@ @@ -1,70 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="MyForm" />
<ShowInTaskbar value="False" />
<AcceptButton value="okButton [System.Windows.Forms.Button], Text: ${res:Global.OKButtonText}" />
<MinimizeBox value="False" />
<StartPosition value="CenterParent" />
<MinimumSize value="{Width=308, Height=208}" />
<FormBorderStyle value="SizableToolWindow" />
<Text value="${res:Dialog.Goto.DialogName}" />
<MaximizeBox value="False" />
<ClientSize value="{Width=397, Height=234}" />
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: ${res:Global.CancelButtonText}" />
<Controls>
<System.Windows.Forms.ListView>
<Name value="listView" />
<Size value="{Width=372, Height=106}" />
<TabIndex value="5" />
<MultiSelect value="False" />
<View value="Details" />
<HeaderStyle value="None" />
<Activation value="OneClick" />
<HotTracking value="True" />
<Location value="{X=13,Y=92}" />
<Anchor value="Top, Bottom, Left, Right" />
<Columns>
<System.Windows.Forms.ColumnHeader>
<Name value="columnHeader" />
</System.Windows.Forms.ColumnHeader>
</Columns>
</System.Windows.Forms.ListView>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<Location value="{X=315,Y=205}" />
<Text value="${res:Global.CancelButtonText}" />
<Size value="{Width=75, Height=23}" />
<Anchor value="Bottom, Right" />
<TabIndex value="4" />
<DialogResult value="Cancel" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="okButton" />
<Location value="{X=235,Y=205}" />
<Text value="${res:Global.OKButtonText}" />
<Size value="{Width=75, Height=23}" />
<Anchor value="Bottom, Right" />
<TabIndex value="3" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TextBox>
<Name value="textBox" />
<TabIndex value="1" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=372, Height=21}" />
<Location value="{X=13,Y=64}" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label" />
<Location value="{X=8,Y=0}" />
<Text value="${res:Dialog.Goto.IntroText}" />
<TextAlign value="BottomLeft" />
<Size value="{Width=381, Height=61}" />
<TabIndex value="0" />
<Anchor value="Top, Left, Right" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.Form>
<System.Windows.Forms.ColumnHeader>
<Name value="columnHeader" />
</System.Windows.Forms.ColumnHeader>
</Components>

2
src/Main/Base/Project/Src/Commands/AutostartCommands.cs

@ -125,7 +125,7 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -125,7 +125,7 @@ namespace ICSharpCode.SharpDevelop.Commands
// finally run the workbench window ...
//Application.AddMessageFilter(new FormKeyHandler());
//Application.Run(WorkbenchSingleton.MainForm);
var application = new System.Windows.Application();
App application = new App();
System.Windows.Forms.Integration.WindowsFormsHost.EnableWindowsFormsInterop();
application.Run(WorkbenchSingleton.MainWindow);

19
src/Main/Base/Project/Src/Gui/App.xaml

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
<Application x:Class="ICSharpCode.SharpDevelop.Gui.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core = "http://icsharpcode.net/sharpdevelop/core">
<Application.Resources>
<Style TargetType="{x:Type Image}" x:Key="{x:Static core:ToolBarService.ImageStyleKey}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
<Setter Property="Opacity" Value="0.50" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type Window}" x:Key="DialogWindow">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
<Setter Property="ShowInTaskbar" Value="False" />
</Style>
</Application.Resources>
</Application>

16
src/Main/Base/Project/Src/Gui/App.xaml.cs

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
using System;
using System.Windows;
namespace ICSharpCode.SharpDevelop.Gui
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
partial class App : Application
{
public App()
{
InitializeComponent();
}
}
}

10
src/Main/Base/Project/Src/Gui/Workbench/WpfWorkbench.xaml

@ -1,20 +1,10 @@ @@ -1,20 +1,10 @@
<Window x:Class = "ICSharpCode.SharpDevelop.Gui.WpfWorkbench"
xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:corePresentation = "clr-namespace:ICSharpCode.Core.Presentation;assembly=ICSharpCode.Core.Presentation"
Title = "SharpDevelop (experimental WPF build)"
WindowStartupLocation = "Manual"
Background="{DynamicResource {x:Static SystemColors.MenuBarBrushKey}}"
>
<Window.Resources>
<Style TargetType="{x:Type Image}" x:Key="{x:Static corePresentation:ToolBarService.ImageStyleKey}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
<Setter Property="Opacity" Value="0.50" />
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<DockPanel Name="dockPanel">
<Menu Name="mainMenu" DockPanel.Dock="Top"/>
<!-- Toolbars will be inserted here (index: 1) -->

158
src/Main/Base/Project/Src/Services/ClassBrowserIcons/ClassBrowserIconService.cs

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
// </file>
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows.Forms;
@ -214,85 +215,92 @@ namespace ICSharpCode.SharpDevelop @@ -214,85 +215,92 @@ namespace ICSharpCode.SharpDevelop
return BASE;
}
public static readonly IList<string> ResourceNames;
static ClassBrowserIconService()
{
imglist = new ImageList();
imglist.ColorDepth = ColorDepth.Depth32Bit;
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Assembly"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.OpenAssembly"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Library"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.NameSpace"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.SubTypes"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.SuperTypes"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ClosedFolderBitmap"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.OpenFolderBitmap"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Reference"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ClosedReferenceFolder"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.OpenReferenceFolder"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ResourceFileIcon"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Event"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.SelectionArrow"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.CombineIcon"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Literal")); // const
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Local"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Parameter"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.TextFileIcon"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Class")); //19
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.InternalClass"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ProtectedClass"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.PrivateClass"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Struct"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.InternalStruct"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ProtectedStruct"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.PrivateStruct"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Interface"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.InternalInterface"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ProtectedInterface"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.PrivateInterface"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Enum"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.InternalEnum"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ProtectedEnum"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.PrivateEnum"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Method"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.InternalMethod"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ProtectedMethod"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.PrivateMethod"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Property"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.InternalProperty"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ProtectedProperty"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.PrivateProperty"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Field"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.InternalField"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ProtectedField"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.PrivateField"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Delegate"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.InternalDelegate"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ProtectedDelegate"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.PrivateDelegate"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Event"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.InternalEvent"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ProtectedEvent"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.PrivateEvent"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.Indexer"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.InternalIndexer"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.ProtectedIndexer"));
imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.16x16.PrivateIndexer"));
ResourceNames = new List<string> {
"Icons.16x16.Assembly",
"Icons.16x16.OpenAssembly",
"Icons.16x16.Library",
"Icons.16x16.NameSpace",
"Icons.16x16.SubTypes",
"Icons.16x16.SuperTypes",
"Icons.16x16.ClosedFolderBitmap",
"Icons.16x16.OpenFolderBitmap",
"Icons.16x16.Reference",
"Icons.16x16.ClosedReferenceFolder",
"Icons.16x16.OpenReferenceFolder",
"Icons.16x16.ResourceFileIcon",
"Icons.16x16.Event",
"Icons.16x16.SelectionArrow",
"Icons.16x16.CombineIcon",
"Icons.16x16.Literal", // const
"Icons.16x16.Local",
"Icons.16x16.Parameter",
"Icons.16x16.TextFileIcon",
"Icons.16x16.Class", //19
"Icons.16x16.InternalClass",
"Icons.16x16.ProtectedClass",
"Icons.16x16.PrivateClass",
"Icons.16x16.Struct",
"Icons.16x16.InternalStruct",
"Icons.16x16.ProtectedStruct",
"Icons.16x16.PrivateStruct",
"Icons.16x16.Interface",
"Icons.16x16.InternalInterface",
"Icons.16x16.ProtectedInterface",
"Icons.16x16.PrivateInterface",
"Icons.16x16.Enum",
"Icons.16x16.InternalEnum",
"Icons.16x16.ProtectedEnum",
"Icons.16x16.PrivateEnum",
"Icons.16x16.Method",
"Icons.16x16.InternalMethod",
"Icons.16x16.ProtectedMethod",
"Icons.16x16.PrivateMethod",
"Icons.16x16.Property",
"Icons.16x16.InternalProperty",
"Icons.16x16.ProtectedProperty",
"Icons.16x16.PrivateProperty",
"Icons.16x16.Field",
"Icons.16x16.InternalField",
"Icons.16x16.ProtectedField",
"Icons.16x16.PrivateField",
"Icons.16x16.Delegate",
"Icons.16x16.InternalDelegate",
"Icons.16x16.ProtectedDelegate",
"Icons.16x16.PrivateDelegate",
"Icons.16x16.Event",
"Icons.16x16.InternalEvent",
"Icons.16x16.ProtectedEvent",
"Icons.16x16.PrivateEvent",
"Icons.16x16.Indexer",
"Icons.16x16.InternalIndexer",
"Icons.16x16.ProtectedIndexer",
"Icons.16x16.PrivateIndexer"
}.AsReadOnly();
foreach (string r in ResourceNames) {
imglist.Images.Add(WinFormsResourceService.GetBitmap(r));
}
}
}
}

106
src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs

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

68
src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.xaml

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="ICSharpCode.SharpDevelop.Gui.GotoDialog"
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core = "http://icsharpcode.net/sharpdevelop/core"
Title="{core:Localize Dialog.Goto.DialogName}"
Height="298"
Width="578"
Style = "{StaticResource DialogWindow}">
<Grid>
<Label
Grid.Column="0"
Grid.Row="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Margin="8,8,8,0"
Content="{core:Localize Dialog.Goto.IntroText}" />
<TextBox
Grid.Column="0"
Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Margin="8,4,8,4"
Name="textBox"
TextChanged="textBoxTextChanged"
PreviewKeyDown="textBoxPreviewKeyDown" />
<ListBox
Grid.Column="0"
Grid.Row="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Margin="8,4,8,4"
Name="listBox"/>
<Button
Content="{core:Localize Global.OKButtonText}"
Grid.Column="0"
Grid.Row="3"
HorizontalAlignment="Right"
VerticalAlignment="Stretch"
Margin="0,6,117,8"
Width="100"
IsDefault="True"
Name="okButton"
Click="okButtonClick" />
<Button
Content="{core:Localize Global.CancelButtonText}"
Grid.Column="0"
Grid.Row="3"
HorizontalAlignment="Right"
VerticalAlignment="Stretch"
Margin="0,6,8,8"
Width="100"
IsCancel="True"
Name="cancelButton"
Click="cancelButtonClick" />
<Grid.RowDefinitions>
<RowDefinition
Height="60" />
<RowDefinition
Height="30" />
<RowDefinition
Height="1*" />
<RowDefinition
Height="37" />
</Grid.RowDefinitions>
</Grid>
</Window>

1
src/Main/ICSharpCode.Core.Presentation/ICSharpCode.Core.Presentation.csproj

@ -61,6 +61,7 @@ @@ -61,6 +61,7 @@
</Compile>
<Compile Include="ConditionalSeparator.cs" />
<Compile Include="IStatusUpdate.cs" />
<Compile Include="LocalizeExtension.cs" />
<Compile Include="Menu\IMenuItemBuilder.cs" />
<Compile Include="Menu\MenuCommand.cs" />
<Compile Include="Menu\MenuService.cs" />

30
src/Main/ICSharpCode.Core.Presentation/LocalizeExtension.cs

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Markup;
namespace ICSharpCode.Core.Presentation
{
/// <summary>
/// Markup extension that retrieves localized resource strings.
/// </summary>
public class LocalizeExtension : MarkupExtension
{
public LocalizeExtension(string key)
{
this.key = key;
}
protected string key;
public override object ProvideValue(IServiceProvider sp)
{
return ResourceService.GetString(key);
}
}
}

4
src/Main/ICSharpCode.Core.Presentation/Properties/AssemblyInfo.cs

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Windows.Markup;
[assembly: CLSCompliant(true)]
[assembly: StringFreezing()]
@ -17,3 +18,6 @@ using System.Runtime.CompilerServices; @@ -17,3 +18,6 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: XmlnsPrefix("http://icsharpcode.net/sharpdevelop/core", "core")]
[assembly: XmlnsDefinition("http://icsharpcode.net/sharpdevelop/core", "ICSharpCode.Core.Presentation")]

Loading…
Cancel
Save