Skip to content

Commit d81c52e

Browse files
committed
UI improvements
1 parent acad457 commit d81c52e

File tree

6 files changed

+142
-82
lines changed

6 files changed

+142
-82
lines changed

CSharpCodeAnalyst/Areas/GraphArea/CodeExplorerControl.xaml

Lines changed: 58 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -52,59 +52,64 @@
5252

5353
<!-- Search Control and tool buttons as overlay -->
5454
<!-- The tool buttons replace the global context menu -->
55-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top"
56-
Visibility="{Binding DataContext.IsGraphToolPanelVisible, ElementName=CodeExplorationControl ,Converter={StaticResource BooleanToVisibilityConverter}}"
57-
Margin="0 0 40 0" DataContext="{Binding GraphViewModel}">
58-
59-
<Button Command="{Binding CompleteToContainingTypesCommand}"
60-
ToolTip="{x:Static resources:Strings.CompleteToTypes}"
61-
Style="{StaticResource ToggleButtonStyle}">
62-
<Image Source="/Resources/puzzle.png" Width="24" Height="24" />
63-
</Button>
64-
65-
<Button Command="{Binding CompleteRelationshipsCommand}"
66-
ToolTip="{x:Static resources:Strings.CompleteRelationships}"
67-
Style="{StaticResource ToggleButtonStyle}">
68-
<Image Source="/Resources/synchronize_32.png" Width="24" Height="24" />
69-
</Button>
70-
71-
<Button Command="{Binding ClearAllFlagsCommand}"
72-
ToolTip="{x:Static resources:Strings.ClearAllFlags}"
73-
Style="{StaticResource ToggleButtonStyle}">
74-
<Image Source="/Resources/flag-empty_32.png" Width="24" Height="24" />
75-
</Button>
76-
77-
<Button Command="{Binding FocusOnSelectedCommand}"
78-
ToolTip="{x:Static resources:Strings.SelectedFocus}"
79-
Style="{StaticResource ToggleButtonStyle}">
80-
<Image Source="/Resources/focus_32.png" Width="24" Height="24" />
81-
</Button>
82-
83-
<Button Command="{Binding ExpandEverythingCommand}"
84-
ToolTip="{x:Static resources:Strings.ExpandEverything}"
85-
Style="{StaticResource ToggleButtonStyle}">
86-
<Image Source="/Resources/expand-all_32.png" Width="24" Height="24" />
87-
</Button>
88-
89-
<Button Command="{Binding CollapseEverythingCommand}"
90-
ToolTip="{x:Static resources:Strings.CollapseEverything}"
91-
Style="{StaticResource ToggleButtonStyle}">
92-
<Image Source="/Resources/collapse-all_32.png" Width="24" Height="24" />
93-
</Button>
94-
95-
<Button Command="{Binding AddParentsCommand}"
96-
ToolTip="{x:Static resources:Strings.AddParents_Tooltip}"
97-
Style="{StaticResource ToggleButtonStyle}">
98-
<Image Source="/Resources/add-parent_32.png" Width="24" Height="24" />
99-
</Button>
100-
101-
<Button Command="{Binding RemoveSelectedCommand}"
102-
ToolTip="{x:Static resources:Strings.SelectedRemoveWithChildren}"
103-
Style="{StaticResource ToggleButtonStyle}">
104-
<Image Source="/Resources/trash-can_32.png" Width="24" Height="24" />
105-
</Button>
106-
107-
</StackPanel>
55+
<Border
56+
HorizontalAlignment="Right" VerticalAlignment="Top"
57+
Visibility="{Binding DataContext.IsGraphToolPanelVisible, ElementName=CodeExplorationControl ,Converter={StaticResource BooleanToVisibilityConverter}}"
58+
Margin="0 0 40 0" DataContext="{Binding GraphViewModel}"
59+
CornerRadius="6">
60+
61+
<StackPanel Orientation="Horizontal">
62+
63+
<Button Command="{Binding CompleteToContainingTypesCommand}"
64+
ToolTip="{x:Static resources:Strings.CompleteToTypes}"
65+
Style="{StaticResource ToolbarButtonStyle}">
66+
<Image Source="/Resources/puzzle.png" Width="24" Height="24" />
67+
</Button>
68+
69+
<Button Command="{Binding CompleteRelationshipsCommand}"
70+
ToolTip="{x:Static resources:Strings.CompleteRelationships}"
71+
Style="{StaticResource ToolbarButtonStyle}">
72+
<Image Source="/Resources/synchronize_32.png" Width="24" Height="24" />
73+
</Button>
74+
75+
<Button Command="{Binding ClearAllFlagsCommand}"
76+
ToolTip="{x:Static resources:Strings.ClearAllFlags}"
77+
Style="{StaticResource ToolbarButtonStyle}">
78+
<Image Source="/Resources/flag-empty_32.png" Width="24" Height="24" />
79+
</Button>
80+
81+
<Button Command="{Binding FocusOnSelectedCommand}"
82+
ToolTip="{x:Static resources:Strings.SelectedFocus}"
83+
Style="{StaticResource ToolbarButtonStyle}">
84+
<Image Source="/Resources/focus_32.png" Width="24" Height="24" />
85+
</Button>
86+
87+
<Button Command="{Binding ExpandEverythingCommand}"
88+
ToolTip="{x:Static resources:Strings.ExpandEverything}"
89+
Style="{StaticResource ToolbarButtonStyle}">
90+
<Image Source="/Resources/expand-all_32.png" Width="24" Height="24" />
91+
</Button>
92+
93+
<Button Command="{Binding CollapseEverythingCommand}"
94+
ToolTip="{x:Static resources:Strings.CollapseEverything}"
95+
Style="{StaticResource ToolbarButtonStyle}">
96+
<Image Source="/Resources/collapse-all_32.png" Width="24" Height="24" />
97+
</Button>
98+
99+
<Button Command="{Binding AddParentsCommand}"
100+
ToolTip="{x:Static resources:Strings.AddParents_Tooltip}"
101+
Style="{StaticResource ToolbarButtonStyle}">
102+
<Image Source="/Resources/add-parent_32.png" Width="24" Height="24" />
103+
</Button>
104+
105+
<Button Command="{Binding RemoveSelectedCommand}"
106+
ToolTip="{x:Static resources:Strings.SelectedRemoveWithChildren}"
107+
Style="{StaticResource ToolbarButtonStyle}">
108+
<Image Source="/Resources/trash-can_32.png" Width="24" Height="24" />
109+
</Button>
110+
111+
</StackPanel>
112+
</Border>
108113
<local:GraphSearchControl x:Name="SearchControl"
109114
HorizontalAlignment="Right"
110115
VerticalAlignment="Top"

CSharpCodeAnalyst/Areas/GraphArea/GraphSearchControl.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:resources="clr-namespace:CSharpCodeAnalyst.Resources"
7+
xmlns:analyst="clr-namespace:CSharpCodeAnalyst"
78
mc:Ignorable="d"
89
d:DesignHeight="50" d:DesignWidth="300">
910

@@ -37,14 +38,16 @@
3738

3839
<Grid>
3940
<!-- Toggle Button -->
41+
4042
<Button x:Name="ToggleButton"
41-
Style="{StaticResource ToggleButtonStyle}"
43+
Style="{StaticResource ToolbarButtonStyle}"
4244
Click="ToggleButton_Click"
4345
HorizontalAlignment="Right"
4446
VerticalAlignment="Top"
4547
ToolTip="Toggle Search">
4648
<Image Source="/Resources/search_32.png" Width="24" Height="24" />
4749
</Button>
50+
4851

4952
<!-- Search Panel -->
5053
<Border Style="{StaticResource SearchPanelStyle}"

CSharpCodeAnalyst/Resources/Strings.Designer.cs

Lines changed: 12 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CSharpCodeAnalyst/Resources/Strings.resx

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@
143143
</data>
144144
<data name="Collapse" xml:space="preserve">
145145
<value>Collapse</value>
146-
</data>
147-
<data name="CompleteRelationships" xml:space="preserve">
148-
<value>Adds all missing relationships between code elements that are present in the Code Explorer</value>
149146
</data>
150147
<data name="RemoveWithoutChildren" xml:space="preserve">
151148
<value>_Remove from Code Explorer</value>
@@ -196,13 +193,30 @@
196193
<value>Selected: Add Parent</value>
197194
</data>
198195
<data name="SelectedRemoveWithChildren" xml:space="preserve">
199-
<value>Selected: Remove (with children)</value>
196+
<value>Remove selected code elements from Code Explorer.
197+
Children are included</value>
200198
</data>
201199
<data name="SelectedFocus" xml:space="preserve">
202-
<value>Focus on the selected code elements. All other elements are removed from the Code Explorer.</value>
200+
<value>Focus on the selected code elements.
201+
All other elements are removed from the Code Explorer.</value>
202+
</data>
203+
<data name="AddParents_Tooltip" xml:space="preserve">
204+
<value>Add parents.
205+
If code elements are selected, their parent is added.
206+
If no code element is selected the parent for all code elements is added.</value>
207+
</data>
208+
<data name="CompleteRelationships" xml:space="preserve">
209+
<value>Complete relationships
210+
Adds all missing relationships between code elements in the Code Explorer</value>
203211
</data>
204212
<data name="Layout_Tooltip" xml:space="preserve">
205213
<value>Resets zoom level and fits to screen</value>
214+
</data>
215+
<data name="CompleteToTypes" xml:space="preserve">
216+
<value>Complete to containing types.
217+
For code elements like methods and fields, it is ensured that at least the containing class (or struct)
218+
is present in the Code Explorer. If code elements are missing in the hierarchy of present code elements,
219+
the gaps are filled.</value>
206220
</data>
207221
<data name="TooMuchElementsMessage" xml:space="preserve">
208222
<value>The graph contains {0} elements. It may take extremely long to render this data.
@@ -375,10 +389,6 @@ If you abort the graph is maintained but not rendered. Use undo to get to the pr
375389
</data>
376390
<data name="Hint_GlobalContext" xml:space="preserve">
377391
<value>• Right-click on empty space: global context commands (i.e. selection)</value>
378-
</data>
379-
<data name="CompleteToTypes" xml:space="preserve">
380-
<value>For code elements like methods and fields, it is ensured that at least the containing class (or struct) is present in the Code Explorer.
381-
If code elements are missing in the hierarchy of present code elements, the gaps are filled.</value>
382392
</data>
383393
<data name="ToggleFlag" xml:space="preserve">
384394
<value>Toggle _flag</value>
@@ -943,13 +953,9 @@ ISOLATE: MyApp.Domain.**</value>
943953
</data>
944954
<data name="Restore_Tooltip" xml:space="preserve">
945955
<value>Restores the previously taken snapshot.</value>
946-
</data>
947-
<data name="AddParents_Tooltip" xml:space="preserve">
948-
<value>If code elements are selected, their parent is added.
949-
If no code element is selected the parent for all code elements is added.</value>
950956
</data>
951957
<data name="ImportPlainText_Label" xml:space="preserve">
952958
<value>Import plain text ...</value>
953959
</data>
954-
960+
955961
</root>

CSharpCodeAnalyst/Styles/ButtonStyles.xaml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,52 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
33

4-
5-
<Style TargetType="Button" x:Key="ToggleButtonStyle">
4+
<Style TargetType="Button" x:Key="ToolbarButtonStyle">
65
<Setter Property="Background" Value="Transparent" />
76
<Setter Property="BorderThickness" Value="0" />
8-
<!-- <Setter Property="Padding" Value="5" /> -->
97
<Setter Property="Cursor" Value="Hand" />
8+
<Setter Property="Padding" Value="4" />
109
<Setter Property="Template">
1110
<Setter.Value>
1211
<ControlTemplate TargetType="Button">
13-
<Border Background="{TemplateBinding Background}"
14-
BorderBrush="{TemplateBinding BorderBrush}"
15-
BorderThickness="{TemplateBinding BorderThickness}"
12+
<Border x:Name="border"
13+
Background="{TemplateBinding Background}"
14+
CornerRadius="6"
1615
Padding="{TemplateBinding Padding}">
1716
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
1817
</Border>
18+
<ControlTemplate.Triggers>
19+
<!-- Hover -->
20+
<Trigger Property="IsMouseOver" Value="True">
21+
<Setter TargetName="border" Property="Background" Value="#22000000" />
22+
<Setter TargetName="border" Property="Effect">
23+
<Setter.Value>
24+
<DropShadowEffect Color="Black" BlurRadius="6" Opacity="0.2" />
25+
</Setter.Value>
26+
</Setter>
27+
</Trigger>
28+
29+
<!-- Pressed -->
30+
<Trigger Property="IsPressed" Value="True">
31+
<Setter TargetName="border" Property="Background" Value="#33000000" />
32+
<Setter TargetName="border" Property="RenderTransform">
33+
<Setter.Value>
34+
<ScaleTransform ScaleX="0.95" ScaleY="0.95" />
35+
</Setter.Value>
36+
</Setter>
37+
</Trigger>
38+
39+
<!-- Disabled -->
40+
<Trigger Property="IsEnabled" Value="False">
41+
<Setter TargetName="border" Property="Opacity" Value="0.4" />
42+
</Trigger>
43+
</ControlTemplate.Triggers>
1944
</ControlTemplate>
2045
</Setter.Value>
2146
</Setter>
2247
</Style>
23-
24-
48+
49+
2550
<Style x:Key="ExpandCollapseButtonStyle" TargetType="ToggleButton">
2651
<Setter Property="Template">
2752
<Setter.Value>

CSharpCodeAnalyst/UiConstants.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Windows.Media;
2+
3+
namespace CSharpCodeAnalyst;
4+
5+
public static class UiConstants
6+
{
7+
8+
static UiConstants()
9+
{
10+
ToolbarBackground = new SolidColorBrush(Color.FromArgb(14, 14, 14, 14));
11+
ToolbarBackground.Freeze();
12+
}
13+
14+
public static Brush ToolbarBackground { get; }
15+
}

0 commit comments

Comments
 (0)