Browse Source

Use TextFormattingMode.Display for tooltips and context menus.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5267 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Daniel Grunwald 16 years ago
parent
commit
c16985247f
  1. 3
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs
  2. 2
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs
  3. 4
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs
  4. 1
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.xaml
  5. 8
      src/Main/Base/Project/Src/Bookmarks/ClassMemberBookmark.cs
  6. 7
      src/Main/Base/Project/Src/Gui/App.xaml
  7. 9
      src/Main/ICSharpCode.Core.Presentation/Menu/MenuService.cs

3
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs

@ -169,7 +169,6 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -169,7 +169,6 @@ namespace ICSharpCode.AvalonEdit.AddIn
textView.Services.AddService(typeof(ITextEditor), adapter);
textView.Services.AddService(typeof(CodeEditor), this);
textEditor.Background = Brushes.White;
textEditor.TextArea.TextEntering += TextAreaTextEntering;
textEditor.TextArea.TextEntered += TextAreaTextEntered;
textEditor.TextArea.Caret.PositionChanged += TextAreaCaretPositionChanged;
@ -218,7 +217,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -218,7 +217,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
void TextAreaContextMenuOpening(object sender, ContextMenuEventArgs e)
{
ITextEditor adapter = GetAdapterFromSender(sender);
MenuService.CreateContextMenu(adapter, contextMenuPath).IsOpen = true;
MenuService.ShowContextMenu(sender as UIElement, adapter, contextMenuPath);
}
void TextAreaMouseRightButtonDown(object sender, MouseButtonEventArgs e)

2
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs

@ -195,6 +195,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -195,6 +195,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
toolTip = new ToolTip();
toolTip.Closed += ToolTipClosed;
}
toolTip.PlacementTarget = this; // required for property inheritance
toolTip.Content = args.ContentToShow;
toolTip.IsOpen = true;
e.Handled = true;
@ -254,6 +255,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -254,6 +255,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
{
popup = new Popup();
popup.Closed += PopupClosed;
popup.PlacementTarget = this; // required for property inheritance
popup.Placement = PlacementMode.Absolute;
popup.StaysOpen = true;
return popup;

4
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Views/ProfilerView.xaml.cs

@ -47,7 +47,7 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -47,7 +47,7 @@ namespace ICSharpCode.Profiler.AddIn.Views
view.SetRange(this.timeLine.SelectedStartIndex, this.timeLine.SelectedEndIndex);
view.ContextMenuOpening += delegate(object sender, ContextMenuEventArgs e) {
object source = (e.OriginalSource is Shape) ? e.OriginalSource : view;
MenuService.CreateContextMenu(source, "/AddIns/Profiler/QueryView/ContextMenu").IsOpen = true;
MenuService.ShowContextMenu(view, source, "/AddIns/Profiler/QueryView/ContextMenu");
};
}
}
@ -197,7 +197,7 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -197,7 +197,7 @@ namespace ICSharpCode.Profiler.AddIn.Views
view.ShowQueryItems = true;
view.ContextMenuOpening += delegate(object sender, ContextMenuEventArgs e) {
object source = (e.OriginalSource is Shape) ? e.OriginalSource : view;
MenuService.CreateContextMenu(source, "/AddIns/Profiler/QueryView/ContextMenu").IsOpen = true;
MenuService.ShowContextMenu(view, source, "/AddIns/Profiler/QueryView/ContextMenu");
};
view.CurrentQueryChanged += delegate { ViewCurrentQueryChanged(header, view); };

1
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.xaml

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
xmlns:editing="clr-namespace:ICSharpCode.AvalonEdit.Editing"
>
<Style TargetType="{x:Type AvalonEdit:TextEditor}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type AvalonEdit:TextEditor}">

8
src/Main/Base/Project/Src/Bookmarks/ClassMemberBookmark.cs

@ -6,9 +6,11 @@ @@ -6,9 +6,11 @@
// </file>
using System;
using System.Windows;
using System.Windows.Input;
using ICSharpCode.Core.Presentation;
using ICSharpCode.SharpDevelop.Dom;
using System.Windows.Input;
namespace ICSharpCode.SharpDevelop.Bookmarks
{
@ -45,7 +47,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -45,7 +47,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
public virtual void MouseDown(MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left) {
MenuService.CreateContextMenu(this, ContextMenuPath).IsOpen = true;
MenuService.ShowContextMenu(e.Source as UIElement, this, ContextMenuPath);
e.Handled = true;
}
}
@ -84,7 +86,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks @@ -84,7 +86,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks
public virtual void MouseDown(MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left) {
MenuService.CreateContextMenu(this, ContextMenuPath).IsOpen = true;
MenuService.ShowContextMenu(e.Source as UIElement, this, ContextMenuPath);
e.Handled = true;
}
}

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

@ -1,7 +1,12 @@ @@ -1,7 +1,12 @@
<Application x:Class="ICSharpCode.SharpDevelop.Gui.App" x:ClassModifier="internal"
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">
xmlns:core = "http://icsharpcode.net/sharpdevelop/core"
xmlns:avalondock = "clr-namespace:AvalonDock;assembly=AvalonDock">
<Application.Resources>
<!-- Style AvalonDock windows -->
<Style TargetType="{x:Type avalondock:DockableFloatingWindow}" BasedOn="{x:Static core:GlobalStyles.WindowStyle}"/>
<Style TargetType="{x:Type avalondock:DocumentFloatingWindow}" BasedOn="{x:Static core:GlobalStyles.WindowStyle}"/>
<Style TargetType="{x:Type avalondock:FlyoutPaneWindow}" BasedOn="{x:Static core:GlobalStyles.WindowStyle}"/>
</Application.Resources>
</Application>

9
src/Main/ICSharpCode.Core.Presentation/Menu/MenuService.cs

@ -11,6 +11,7 @@ using System.Collections.Generic; @@ -11,6 +11,7 @@ using System.Collections.Generic;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace ICSharpCode.Core.Presentation
@ -104,9 +105,17 @@ namespace ICSharpCode.Core.Presentation @@ -104,9 +105,17 @@ namespace ICSharpCode.Core.Presentation
}
public static ContextMenu CreateContextMenu(object owner, string addInTreePath)
{
IList items = CreateUnexpandedMenuItems(null, AddInTree.BuildItems<MenuItemDescriptor>(addInTreePath, owner, false));
return CreateContextMenu(items);
}
public static ContextMenu ShowContextMenu(UIElement parent, object owner, string addInTreePath)
{
ContextMenu menu = new ContextMenu();
menu.ItemsSource = CreateMenuItems(menu, owner, addInTreePath);
menu.PlacementTarget = parent;
menu.IsOpen = true;
return menu;
}

Loading…
Cancel
Save