Browse Source

Enhanced look of ContextActionPopup.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6080 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Martin Koníček 16 years ago
parent
commit
b8195879d5
  1. 12
      src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml
  2. 66
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsControl.xaml
  3. 4
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsPopup.cs
  4. 10
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActionsHelper.cs
  5. 4
      src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs

12
src/Main/Base/Project/Src/Services/Debugger/Tooltips/DebuggerTooltipControl.xaml

@ -113,12 +113,12 @@
<DataGrid.Background> <DataGrid.Background>
<!-- Control backgound --> <!-- Control backgound -->
<LinearGradientBrush StartPoint="0,-0.03" EndPoint="0,1"> <LinearGradientBrush StartPoint="0,-0.03" EndPoint="0,1">
<GradientStop Color="White"/> <GradientStop Color="White"/>
<GradientStop Color="#FFFAFCFE" Offset="0.983"/> <GradientStop Color="#FFFAFCFE" Offset="0.983"/>
<GradientStop Color="#FFECF7FC" Offset="0.07"/> <GradientStop Color="#FFECF7FC" Offset="0.07"/>
<GradientStop Color="#FFEEF7FA" Offset="0.436"/> <GradientStop Color="#FFEEF7FA" Offset="0.436"/>
</LinearGradientBrush> </LinearGradientBrush>
</DataGrid.Background> </DataGrid.Background>
<DataGrid.RowStyle> <DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">

66
src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsControl.xaml

@ -3,9 +3,13 @@
x:Class="ICSharpCode.SharpDevelop.Refactoring.ContextActionsControl" x:Class="ICSharpCode.SharpDevelop.Refactoring.ContextActionsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
> xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
<UserControl.Resources> <UserControl.Resources>
<SolidColorBrush x:Key="OuterBorderBrush" Color="#436C82"></SolidColorBrush>
<BitmapImage x:Key="Magnifier" UriSource="magnifier.png" />
<Style x:Key="ClearButton" TargetType="Button"> <Style x:Key="ClearButton" TargetType="Button">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter> <!-- Disable the dashed focus rectangle --> <Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter> <!-- Disable the dashed focus rectangle -->
<Setter Property="Template"> <Setter Property="Template">
@ -14,22 +18,31 @@
To be able to associate actions with TreeViewItems, we use Buttons as content of TreeViewItems. --> To be able to associate actions with TreeViewItems, we use Buttons as content of TreeViewItems. -->
<ControlTemplate TargetType="Button"> <ControlTemplate TargetType="Button">
<Border Name="Border" <Border Name="Border"
Padding="4" Padding="2"
BorderThickness="1"
CornerRadius="1"
BorderBrush="Transparent"
Background="Transparent"> Background="Transparent">
<ContentPresenter></ContentPresenter> <ContentPresenter></ContentPresenter>
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsFocused" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Border" Value="LightBlue"> <Setter Property="Background" TargetName="Border" Value="#E8F2FF">
<!--<Setter.Value>
<DynamicResource ResourceKey="{x:Static SystemColors.HighlightTextBrushKey}" />
</Setter.Value>-->
</Setter> </Setter>
<Setter Property="TextElement.Foreground"> </Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" TargetName="Border">
<Setter.Value> <Setter.Value>
<DynamicResource ResourceKey="{x:Static SystemColors.HighlightTextBrushKey}" /> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#E5F1FF" Offset="0"/>
<GradientStop Color="#D6E9FF" Offset="0.5"/>
</LinearGradientBrush>
</Setter.Value> </Setter.Value>
<!--<Setter.Value #A3CEFF darker>
<DynamicResource ResourceKey="{x:Static SystemColors.HighlightTextBrushKey}" />
</Setter.Value>-->
</Setter> </Setter>
<Setter Property="BorderBrush" TargetName="Border" Value="#4F7AA8" />
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
@ -38,7 +51,7 @@
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
<Grid Background="White"> <Grid Background="Transparent">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
@ -46,27 +59,48 @@
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border Grid.Row="0" Grid.Column="0" BorderThickness="1" BorderBrush="Black" HorizontalAlignment="Left">
<!-- Header -->
<Border Grid.Row="0" Grid.Column="0" Padding="4" BorderThickness="1 1 1 0"
BorderBrush="{StaticResource OuterBorderBrush}" HorizontalAlignment="Left">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#D6E9FF" Offset="0"/>
<GradientStop Color="#A3CEFF" Offset="0.5"/>
</LinearGradientBrush>
</Border.Background>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Image Source="{Binding Image}"></Image> <Image Source="{Binding Image}"></Image>
<TextBlock Text="{Binding Title}"></TextBlock> <TextBlock Text="{Binding Title}"></TextBlock>
</StackPanel> </StackPanel>
</Border> </Border>
<Border Grid.Row="1" Grid.Column="0" BorderThickness="1" BorderBrush="Black" HorizontalAlignment="Stretch">
<!-- Content - TreeView -->
<Border Grid.Row="1" Grid.Column="0" Padding="0 0 8 8">
<aero:SystemDropShadowChrome>
<Border BorderThickness="1" BorderBrush="{StaticResource OuterBorderBrush}" HorizontalAlignment="Stretch">
<TreeView ItemsSource="{Binding Actions}" x:Name="TreeView"> <TreeView ItemsSource="{Binding Actions}" x:Name="TreeView">
<TreeView.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
<GradientStop Color="White"/>
</LinearGradientBrush>
</TreeView.Background>
<TreeView.ItemContainerStyle> <TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}"> <Style TargetType="{x:Type TreeViewItem}">
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="TreeViewItem"> <ControlTemplate TargetType="TreeViewItem">
<StackPanel> <StackPanel>
<!-- ActionButtonClick is used just to close the Popup -->
<Button Command="{Binding ActionCommand}" Style="{StaticResource ClearButton}" Click="ActionButtonClick"> <Button Command="{Binding ActionCommand}" Style="{StaticResource ClearButton}" Click="ActionButtonClick">
<Border SnapsToDevicePixels="True"> <Border SnapsToDevicePixels="True">
<ContentPresenter Content="{TemplateBinding HeaderedContentControl.Header}" ContentTemplate="{TemplateBinding HeaderedContentControl.HeaderTemplate}" ContentStringFormat="{TemplateBinding HeaderedItemsControl.HeaderStringFormat}" ContentSource="Header" Name="PART_Header" <ContentPresenter Content="{TemplateBinding HeaderedContentControl.Header}" ContentTemplate="{TemplateBinding HeaderedContentControl.HeaderTemplate}" ContentStringFormat="{TemplateBinding HeaderedItemsControl.HeaderStringFormat}" ContentSource="Header" Name="PART_Header"
HorizontalAlignment="Stretch" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" /> HorizontalAlignment="Stretch" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
</Border> </Border>
</Button> </Button>
<ItemsPresenter Name="ItemsHost" Margin="14 0 0 0" /> <Border Padding="14 0 0 0">
<ItemsPresenter Name="ItemsHost" />
</Border>
</StackPanel> </StackPanel>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<!-- Disable collapsing --> <!-- Disable collapsing -->
@ -86,14 +120,14 @@
</Setter> </Setter>
<!-- Make all items expanded --> <!-- Make all items expanded -->
<Setter Property="IsExpanded" Value="True"></Setter> <Setter Property="IsExpanded" Value="True"></Setter>
<!-- Make items not focusable so that contained button gets focus on Down arrow, not the item --> <!-- Make items not focusable so that contained button (not the TreeViewItem) gets focus on Down arrow -->
<Setter Property="Focusable" Value="False"></Setter> <Setter Property="Focusable" Value="False"></Setter>
<!--<EventSetter Event="GotFocus" Handler="GotFocusHandler"></EventSetter>-->
</Style> </Style>
</TreeView.ItemContainerStyle> </TreeView.ItemContainerStyle>
<TreeView.ItemTemplate> <TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding ChildActions}"> <HierarchicalDataTemplate ItemsSource="{Binding ChildActions}">
<DockPanel HorizontalAlignment="Stretch"> <DockPanel HorizontalAlignment="Stretch">
<Image Source="{Binding Image}" Margin="3 2 4 2" />
<TextBlock Text="{Binding Name}" Margin="0 2 20 2" /> <TextBlock Text="{Binding Name}" Margin="0 2 20 2" />
<TextBlock Text="{Binding Comment}" Foreground="Gray" TextAlignment="Right" HorizontalAlignment="Right"/> <TextBlock Text="{Binding Comment}" Foreground="Gray" TextAlignment="Right" HorizontalAlignment="Right"/>
</DockPanel> </DockPanel>
@ -101,5 +135,7 @@
</TreeView.ItemTemplate> </TreeView.ItemTemplate>
</TreeView> </TreeView>
</Border> </Border>
</aero:SystemDropShadowChrome>
</Border>
</Grid> </Grid>
</UserControl> </UserControl>

4
src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsPopup.cs

@ -17,7 +17,9 @@ namespace ICSharpCode.SharpDevelop.Refactoring
{ {
public ContextActionsPopup() public ContextActionsPopup()
{ {
this.StaysOpen = false; // Close on lost focus this.StaysOpen = false;
// Close on lost focus
this.AllowsTransparency = true;
this.ActionsControl = new ContextActionsControl(); this.ActionsControl = new ContextActionsControl();
// Close when any action excecuted // Close when any action excecuted
this.ActionsControl.ActionExecuted += delegate { this.Close(); }; this.ActionsControl.ActionExecuted += delegate { this.Close(); };

10
src/Main/Base/Project/Src/Services/RefactoringService/ContextActionsHelper.cs

@ -47,7 +47,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
{ {
var derivedClassesTree = RefactoringService.FindDerivedClassesTree(member.DeclaringType); var derivedClassesTree = RefactoringService.FindDerivedClassesTree(member.DeclaringType);
var popupViewModel = new ContextActionsViewModel { Title = MenuService.ConvertLabel(StringParser.Parse( var popupViewModel = new ContextActionsViewModel { Title = MenuService.ConvertLabel(StringParser.Parse(
"${res:SharpDevelop.Refactoring.OverridesOf}", new string[,] {{ "Name", member.Name }}))}; "${res:SharpDevelop.Refactoring.OverridesOf}", new string[,] {{ "Name", member.FullyQualifiedName }}))};
popupViewModel.Actions = new OverridesPopupTreeViewModelBuilder(member).BuildTreeViewModel(derivedClassesTree); popupViewModel.Actions = new OverridesPopupTreeViewModelBuilder(member).BuildTreeViewModel(derivedClassesTree);
return new ContextActionsPopup { Actions = popupViewModel }; return new ContextActionsPopup { Actions = popupViewModel };
} }
@ -66,6 +66,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
{ {
return new ContextActionViewModel { return new ContextActionViewModel {
Name = this.LabelAmbience.Convert(@class), Name = this.LabelAmbience.Convert(@class),
Image = ClassBrowserIconService.GetIcon(@class).ImageSource,
Comment = string.Format("(in {0})", @class.Namespace), Comment = string.Format("(in {0})", @class.Namespace),
Action = new GoToClassAction(@class), Action = new GoToClassAction(@class),
ChildActions = childActions ChildActions = childActions
@ -103,15 +104,16 @@ namespace ICSharpCode.SharpDevelop.Refactoring
this.member = member; this.member = member;
} }
protected ContextActionViewModel MakeGoToMemberAction(IClass @class, ObservableCollection<ContextActionViewModel> childActions) protected ContextActionViewModel MakeGoToMemberAction(IClass containingClass, ObservableCollection<ContextActionViewModel> childActions)
{ {
var overridenMember = MemberLookupHelper.FindSimilarMember(@class, this.member); var overridenMember = MemberLookupHelper.FindSimilarMember(containingClass, this.member);
if (overridenMember == null || overridenMember.Region.IsEmpty) if (overridenMember == null || overridenMember.Region.IsEmpty)
return null; return null;
return new ContextActionViewModel { return new ContextActionViewModel {
Name = this.LabelAmbience.Convert(overridenMember), Name = this.LabelAmbience.Convert(overridenMember),
Comment = string.Format("(in {0})", @class.FullyQualifiedName), Image = ClassBrowserIconService.GetIcon(overridenMember).ImageSource,
Comment = string.Format("(in {0})", containingClass.FullyQualifiedName),
Action = new GoToMemberAction(overridenMember), Action = new GoToMemberAction(overridenMember),
ChildActions = childActions ChildActions = childActions
}; };

4
src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs

@ -203,7 +203,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
{ {
if (@class == null) if (@class == null)
return null; return null;
var item = new MenuItem { Header = MenuService.ConvertLabel("Go to base class..") }; var item = new MenuItem { Header = MenuService.ConvertLabel("Find base classes..") };
item.Icon = ClassBrowserIconService.Interface.CreateImage(); item.Icon = ClassBrowserIconService.Interface.CreateImage();
item.InputGestureText = new KeyGesture(Key.F10).GetDisplayStringForCulture(Thread.CurrentThread.CurrentUICulture); item.InputGestureText = new KeyGesture(Key.F10).GetDisplayStringForCulture(Thread.CurrentThread.CurrentUICulture);
item.Click += delegate { item.Click += delegate {
@ -216,7 +216,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
{ {
if (member == null) if (member == null)
return null; return null;
var item = new MenuItem { Header = MenuService.ConvertLabel(StringParser.Parse("${res:SharpDevelop.Refactoring.OverridesOf}", new string[,] {{ "Name", member.Name }})) }; var item = new MenuItem { Header = MenuService.ConvertLabel(StringParser.Parse("${res:SharpDevelop.Refactoring.FindOverridesCommand}")) };
item.Icon = ClassBrowserIconService.Method.CreateImage(); item.Icon = ClassBrowserIconService.Method.CreateImage();
item.InputGestureText = new KeyGesture(Key.F11).GetDisplayStringForCulture(Thread.CurrentThread.CurrentUICulture); item.InputGestureText = new KeyGesture(Key.F11).GetDisplayStringForCulture(Thread.CurrentThread.CurrentUICulture);
item.Click += delegate { item.Click += delegate {

Loading…
Cancel
Save