Browse Source

fix shortcut and focus woes (#553)

pull/569/head
Siegfried Pammer 11 years ago
parent
commit
9815cf4537
  1. 7
      AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchCommands.cs
  2. 9
      AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchPanel.cs
  3. 2
      AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchPanel.xaml
  4. 3
      ILSpy/MainWindow.xaml
  5. 2
      ILSpy/MainWindow.xaml.cs
  6. 5
      ILSpy/SearchPane.cs
  7. 6
      ILSpy/TextView/DecompilerTextView.cs

7
AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchCommands.cs

@ -83,6 +83,13 @@ namespace ICSharpCode.AvalonEdit.Search @@ -83,6 +83,13 @@ namespace ICSharpCode.AvalonEdit.Search
this.panel = panel;
}
internal void RegisterGlobalCommands(CommandBindingCollection commandBindings)
{
commandBindings.Add(new CommandBinding(ApplicationCommands.Find, ExecuteFind));
commandBindings.Add(new CommandBinding(SearchCommands.FindNext, ExecuteFindNext, CanExecuteWithOpenSearchPanel));
commandBindings.Add(new CommandBinding(SearchCommands.FindPrevious, ExecuteFindPrevious, CanExecuteWithOpenSearchPanel));
}
void RegisterCommands(ICollection<CommandBinding> commandBindings)
{
commandBindings.Add(new CommandBinding(ApplicationCommands.Find, ExecuteFind));

9
AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchPanel.cs

@ -179,8 +179,7 @@ namespace ICSharpCode.AvalonEdit.Search @@ -179,8 +179,7 @@ namespace ICSharpCode.AvalonEdit.Search
/// <summary>
/// Creates a new SearchPanel.
/// </summary>
[Obsolete("Use the Install method instead")]
public SearchPanel()
SearchPanel()
{
}
@ -213,13 +212,17 @@ namespace ICSharpCode.AvalonEdit.Search @@ -213,13 +212,17 @@ namespace ICSharpCode.AvalonEdit.Search
{
if (textArea == null)
throw new ArgumentNullException("textArea");
#pragma warning disable 618
SearchPanel panel = new SearchPanel();
panel.AttachInternal(textArea);
panel.handler = new SearchInputHandler(textArea, panel);
textArea.DefaultInputHandler.NestedInputHandlers.Add(panel.handler);
return panel;
}
public void RegisterCommands(CommandBindingCollection commandBindings)
{
handler.RegisterGlobalCommands(commandBindings);
}
/// <summary>
/// Removes the SearchPanel from the TextArea.

2
AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchPanel.xaml

@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
<Image Width="16" Height="16" Stretch="Fill" Source="next.png" />
</Button>
<Button Height="16" Width="16" HorizontalAlignment="Right" VerticalAlignment="Top" Command="search:SearchCommands.CloseSearchPanel"
VerticalContentAlignment="Center" HorizontalContentAlignment="Center">
VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Focusable="False">
<Path Data="M 0,0 L 8,8 M 8,0 L 0,8" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" />
</Button>
</StackPanel>

3
ILSpy/MainWindow.xaml

@ -125,6 +125,7 @@ @@ -125,6 +125,7 @@
BorderThickness="5,0"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
Focusable="False"
BorderBrush="Transparent" />
<!-- Right pane: Text Editor -->
<Grid Grid.Column="2">
@ -162,6 +163,7 @@ @@ -162,6 +163,7 @@
BorderBrush="Transparent"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Focusable="False"
Visibility="{Binding Visibility, ElementName=topPane}" />
<!-- decompilerTextView is into the mainPane by code -->
@ -175,6 +177,7 @@ @@ -175,6 +177,7 @@
BorderBrush="Transparent"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Focusable="False"
Visibility="{Binding Visibility, ElementName=bottomPane}" />
<controls:DockedPane x:Name="bottomPane" Grid.Row="5" Title="Bottom" Visibility="Collapsed"

2
ILSpy/MainWindow.xaml.cs

@ -359,8 +359,6 @@ namespace ICSharpCode.ILSpy @@ -359,8 +359,6 @@ namespace ICSharpCode.ILSpy
}
}
NavigationCommands.Search.InputGestures.Add(new KeyGesture(Key.E, ModifierKeys.Control));
AvalonEditTextOutput output = new AvalonEditTextOutput();
if (FormatExceptions(App.StartupExceptions.ToArray(), output))
decompilerTextView.ShowText(output);

5
ILSpy/SearchPane.cs

@ -294,12 +294,15 @@ namespace ICSharpCode.ILSpy @@ -294,12 +294,15 @@ namespace ICSharpCode.ILSpy
}
[ExportMainMenuCommand(Menu = "_View", Header = "_Search", MenuIcon = "Images/Find.png", MenuCategory = "ShowPane", MenuOrder = 100)]
[ExportToolbarCommand(ToolTip = "Search (F3)", ToolbarIcon = "Images/Find.png", ToolbarCategory = "View", ToolbarOrder = 100)]
[ExportToolbarCommand(ToolTip = "Search (Ctrl+Shift+F or Ctrl+E)", ToolbarIcon = "Images/Find.png", ToolbarCategory = "View", ToolbarOrder = 100)]
sealed class ShowSearchCommand : CommandWrapper
{
public ShowSearchCommand()
: base(NavigationCommands.Search)
{
NavigationCommands.Search.InputGestures.Clear();
NavigationCommands.Search.InputGestures.Add(new KeyGesture(Key.F, ModifierKeys.Control | ModifierKeys.Shift));
NavigationCommands.Search.InputGestures.Add(new KeyGesture(Key.E, ModifierKeys.Control));
}
}

6
ILSpy/TextView/DecompilerTextView.cs

@ -102,10 +102,12 @@ namespace ICSharpCode.ILSpy.TextView @@ -102,10 +102,12 @@ namespace ICSharpCode.ILSpy.TextView
textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
textEditor.ShowLineNumbers = true;
DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged += CurrentDisplaySettings_PropertyChanged;
// SearchPanel
SearchPanel.Install(textEditor.TextArea)
.RegisterCommands(Application.Current.MainWindow.CommandBindings);
// Bookmarks context menu
SearchPanel.Install(textEditor.TextArea);
ShowLineMargin();
// add marker service & margin

Loading…
Cancel
Save