Skip to content

Commit 3f0edbc

Browse files
committed
added CodeExplorerControl.xaml
1 parent b89876f commit 3f0edbc

File tree

7 files changed

+343
-0
lines changed

7 files changed

+343
-0
lines changed

RetailCoder.VBE/Properties/Resources.Designer.cs

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

RetailCoder.VBE/Properties/Resources.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,4 +379,10 @@
379379
<data name="balloon_smiley" type="System.Resources.ResXFileRef, System.Windows.Forms">
380380
<value>..\resources\balloon_smiley.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
381381
</data>
382+
<data name="blue_folder_horizontal" type="System.Resources.ResXFileRef, System.Windows.Forms">
383+
<value>..\Resources\blue-folder-horizontal.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
384+
</data>
385+
<data name="blue_folder_horizontal_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
386+
<value>..\Resources\blue-folder-horizontal-open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
387+
</data>
382388
</root>
Loading
Loading

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,9 @@
344344
<Compile Include="UI\BusyIndicator.xaml.cs">
345345
<DependentUpon>BusyIndicator.xaml</DependentUpon>
346346
</Compile>
347+
<Compile Include="UI\CodeExplorer\CodeExplorerControl.xaml.cs">
348+
<DependentUpon>CodeExplorerControl.xaml</DependentUpon>
349+
</Compile>
347350
<Compile Include="UI\CodeInspections\InspectionDescriptionConverter.cs" />
348351
<Compile Include="UI\CodeInspections\InspectionImageSourceConverter.cs" />
349352
<Compile Include="UI\CodeInspections\InspectionResultsControl.xaml.cs">
@@ -868,6 +871,7 @@
868871
<Resource Include="Resources\magnifier--arrow.png" />
869872
</ItemGroup>
870873
<ItemGroup>
874+
<Folder Include="Common\Namespaces\" />
871875
<Folder Include="Properties\DataSources\" />
872876
<Folder Include="UI\ParserProgress\" />
873877
</ItemGroup>
@@ -1008,6 +1012,8 @@
10081012
<Content Include="Resources\balloon_mask.bmp" />
10091013
<Content Include="Resources\balloon_prohibition.bmp" />
10101014
<Content Include="Resources\balloon_smiley.bmp" />
1015+
<None Include="Resources\blue-folder-horizontal.png" />
1016+
<None Include="Resources\blue-folder-horizontal-open.png" />
10111017
<Content Include="Resources\Microsoft\Mask\AllLoadedTests_8644_24.bmp" />
10121018
<Content Include="Resources\Microsoft\Mask\ExtractMethod_6786_32.bmp" />
10131019
<Content Include="Resources\Microsoft\Mask\FindSymbol_6263_32.bmp" />
@@ -1208,6 +1214,10 @@
12081214
<SubType>Designer</SubType>
12091215
<Generator>MSBuild:Compile</Generator>
12101216
</Page>
1217+
<Page Include="UI\CodeExplorer\CodeExplorerControl.xaml">
1218+
<SubType>Designer</SubType>
1219+
<Generator>MSBuild:Compile</Generator>
1220+
</Page>
12111221
<Page Include="UI\CodeInspections\InspectionResultsControl.xaml">
12121222
<SubType>Designer</SubType>
12131223
<Generator>MSBuild:Compile</Generator>
Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
<UserControl x:Class="Rubberduck.UI.CodeExplorer.CodeExplorerControl"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:explorer="clr-namespace:Rubberduck.UI.CodeExplorer"
7+
xmlns:resx="clr-namespace:Rubberduck.UI"
8+
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
9+
mc:Ignorable="d"
10+
d:DesignHeight="300" d:DesignWidth="300">
11+
<UserControl.Resources>
12+
13+
<BooleanToVisibilityConverter x:Key="BoolToVisibility"/>
14+
15+
<Style x:Key="LinkButton" TargetType="Button" BasedOn="{StaticResource ResourceKey={x:Type Button}}">
16+
17+
<Setter Property="Width" Value="Auto"/>
18+
19+
<Setter Property="Template">
20+
<Setter.Value>
21+
<ControlTemplate TargetType="Button">
22+
<ContentPresenter Content="{TemplateBinding Content}"
23+
ContentTemplate="{TemplateBinding ContentTemplate}"
24+
VerticalAlignment="Center">
25+
<ContentPresenter.Resources>
26+
<Style TargetType="{x:Type TextBlock}">
27+
<Setter Property="TextDecorations" Value="Underline" />
28+
</Style>
29+
</ContentPresenter.Resources>
30+
</ContentPresenter>
31+
</ControlTemplate>
32+
</Setter.Value>
33+
</Setter>
34+
<Setter Property="Foreground" Value="Blue" />
35+
<Setter Property="Cursor" Value="Hand" />
36+
<Style.Triggers>
37+
<Trigger Property="IsMouseOver" Value="true">
38+
<Setter Property="Foreground" Value="Red" />
39+
</Trigger>
40+
<Trigger Property="IsEnabled" Value="false">
41+
<Setter Property="Foreground" Value="Gray" />
42+
</Trigger>
43+
</Style.Triggers>
44+
</Style>
45+
46+
<LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" EndPoint="0,1" StartPoint="0,0">
47+
<GradientStop Color="#FFD9F4FF" Offset="0"/>
48+
<GradientStop Color="#FF9BDDFB" Offset="1"/>
49+
</LinearGradientBrush>
50+
<LinearGradientBrush x:Key="{x:Static SystemColors.ControlBrushKey}" EndPoint="0,1" StartPoint="0,0">
51+
<GradientStop Color="#FFEEEDED" Offset="0"/>
52+
<GradientStop Color="#FFDDDDDD" Offset="1"/>
53+
</LinearGradientBrush>
54+
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
55+
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" />
56+
57+
<Style x:Key="ShinyTreeView"
58+
TargetType="{x:Type TreeViewItem}">
59+
<Setter Property="BorderThickness" Value="1.5"/>
60+
<Style.Triggers>
61+
<Trigger Property="IsSelected" Value="True">
62+
<Setter Property="BorderBrush" Value="#adc6e5"/>
63+
</Trigger>
64+
<MultiTrigger>
65+
<MultiTrigger.Conditions>
66+
<Condition Property="IsSelected" Value="True"/>
67+
<Condition Property="IsSelectionActive" Value="False"/>
68+
</MultiTrigger.Conditions>
69+
<Setter Property="BorderBrush" Value="LightGray"/>
70+
</MultiTrigger>
71+
</Style.Triggers>
72+
<Style.Resources>
73+
<Style TargetType="Border">
74+
<Setter Property="CornerRadius" Value="2"/>
75+
</Style>
76+
</Style.Resources>
77+
</Style>
78+
79+
<!--<explorer:InspectionSeverityImageSourceConverter x:Key="SeverityIconConverter" />
80+
<explorer:InspectionImageSourceConverter x:Key="InspectionIconConverter" />
81+
<explorer:InspectionDescriptionConverter x:Key="InspectionDescriptionConverter" />-->
82+
83+
<Style x:Key="IconStyle" TargetType="Image">
84+
<Setter Property="Height" Value="16" />
85+
<Setter Property="Width" Value="16" />
86+
<Setter Property="Margin" Value="4" />
87+
</Style>
88+
89+
<CollectionViewSource x:Key="InspectionTypeGroupViewSource" Source="{Binding Results}">
90+
<CollectionViewSource.GroupDescriptions>
91+
<PropertyGroupDescription PropertyName="Inspection.InspectionType" />
92+
<PropertyGroupDescription PropertyName="Inspection" />
93+
</CollectionViewSource.GroupDescriptions>
94+
</CollectionViewSource>
95+
96+
<CollectionViewSource x:Key="CodeModuleGroupViewSource" Source="{Binding Results}">
97+
<CollectionViewSource.GroupDescriptions>
98+
<PropertyGroupDescription PropertyName="QualifiedSelection.QualifiedName" />
99+
<PropertyGroupDescription PropertyName="Inspection" />
100+
</CollectionViewSource.GroupDescriptions>
101+
</CollectionViewSource>
102+
103+
<HierarchicalDataTemplate x:Key="InspectionGroupsTemplate"
104+
DataType="{x:Type CollectionViewGroup}"
105+
ItemsSource="{Binding Items}"
106+
ItemTemplate="{StaticResource InspectionResultTemplate}">
107+
108+
<StackPanel Orientation="Horizontal" Margin="2" HorizontalAlignment="Stretch">
109+
<Image Style="{StaticResource IconStyle}"
110+
Source="{Binding Name, Converter={StaticResource InspectionIconConverter}}"
111+
VerticalAlignment="Center" />
112+
<TextBlock Margin="4"
113+
VerticalAlignment="Center"
114+
Text="{Binding Name, Converter={StaticResource InspectionDescriptionConverter}}"
115+
TextWrapping="Wrap"/>
116+
<TextBlock Margin="0,4,4,4"
117+
VerticalAlignment="Center"
118+
Text="{Binding ItemCount, StringFormat=({0})}"
119+
TextWrapping="Wrap"/>
120+
</StackPanel>
121+
</HierarchicalDataTemplate>
122+
123+
<HierarchicalDataTemplate x:Key="InspectionTypeGroupsTemplate"
124+
DataType="{x:Type CollectionViewGroup}"
125+
ItemsSource="{Binding Items}"
126+
ItemTemplate="{StaticResource InspectionGroupsTemplate}">
127+
<StackPanel Orientation="Horizontal" Margin="2" HorizontalAlignment="Stretch">
128+
<TextBlock VerticalAlignment="Center"
129+
Text="{Binding Name}"
130+
FontWeight="Bold"
131+
TextWrapping="Wrap"/>
132+
<TextBlock Margin="4,0,4,0"
133+
VerticalAlignment="Center"
134+
Text="{Binding ItemCount, StringFormat=({0})}"
135+
TextWrapping="Wrap"/>
136+
</StackPanel>
137+
</HierarchicalDataTemplate>
138+
139+
<HierarchicalDataTemplate x:Key="CodeModuleGroupsTemplate"
140+
DataType="{x:Type CollectionViewGroup}"
141+
ItemsSource="{Binding Items}"
142+
ItemTemplate="{StaticResource InspectionGroupsTemplate}">
143+
144+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
145+
<Image Style="{StaticResource IconStyle}" Source="../../Resources/Microsoft/PNG/VSObject_Module.png" />
146+
<TextBlock VerticalAlignment="Center"
147+
Text="{Binding Name}"
148+
FontWeight="Bold"
149+
TextWrapping="Wrap"/>
150+
<TextBlock Margin="4,0,4,0"
151+
VerticalAlignment="Center"
152+
Text="{Binding ItemCount, StringFormat=({0})}"
153+
TextWrapping="Wrap"/>
154+
</StackPanel>
155+
</HierarchicalDataTemplate>
156+
157+
</UserControl.Resources>
158+
159+
<Grid>
160+
<Grid.RowDefinitions>
161+
<RowDefinition Height="30"/>
162+
<RowDefinition Height="*" MinHeight="64" />
163+
<RowDefinition Height="5"/>
164+
<RowDefinition Height="Auto" MinHeight="48"/>
165+
</Grid.RowDefinitions>
166+
167+
<Border Grid.Row="0" Grid.RowSpan="3" Background="#FFEEF5FD" />
168+
169+
<ToolBar Grid.Row="0">
170+
171+
<Button Command="{Binding RefreshCommand}" IsEnabled="{Binding CanRefresh}">
172+
<Image Height="16" Source="../../Resources/arrow-circle-double.png" />
173+
</Button>
174+
175+
<Separator />
176+
177+
178+
<Button Command="{Binding ToggleSignatures}"
179+
IsEnabled="{Binding CanRefresh}"
180+
ToolTip="Toggle signatures">
181+
<Image Height="16" Source="../../Resources/Microsoft/PNG/DisplayFullSignature_13393_32.png" />
182+
</Button>
183+
184+
<Button Command="{Binding ToggleNamespaces}"
185+
IsEnabled="{Binding CanRefresh}"
186+
ToolTip="Toggle namespace folders">
187+
<Image Height="16" Source="../../Resources/blue-folder-horizontal-open.png" />
188+
</Button>
189+
190+
<Button Command="{Binding ToggleFolders}"
191+
IsEnabled="{Binding CanRefresh}"
192+
ToolTip="Toggle component type folders">
193+
<Image Height="16" Source="../../Resources/folder-horizontal.png" />
194+
</Button>
195+
196+
<Separator />
197+
198+
<Label Content="{Binding ToolbarText}" />
199+
200+
</ToolBar>
201+
202+
<!-- todo: implement item template -->
203+
<TreeView Grid.Row="1" x:Name="ExplorerTreeView"
204+
IsEnabled="{Binding CanRefresh}"
205+
ItemsSource="{Binding Source={StaticResource InspectionTypeGroupViewSource}, Path=Groups}"
206+
ItemTemplate="{StaticResource InspectionTypeGroupsTemplate}"
207+
ItemContainerStyle="{StaticResource ShinyTreeView}"
208+
HorizontalContentAlignment="Stretch"
209+
MouseDoubleClick="TreeView_OnMouseDoubleClick">
210+
<i:Interaction.Behaviors>
211+
<resx:BindableSelectedItemBehavior SelectedItem="{Binding SelectedItem, Mode=TwoWay}" />
212+
</i:Interaction.Behaviors>
213+
</TreeView>
214+
215+
<resx:BusyIndicator Grid.Row="1" Width="36" Height="36" Visibility="{Binding IsBusy, Converter={StaticResource BoolToVisibility}}" />
216+
217+
<GridSplitter Grid.Row="2" Height="5" ShowsPreview="True" Cursor="SizeNS" HorizontalAlignment="Stretch"/>
218+
219+
<Border Grid.Row="3" BorderThickness="0,1,0,0" BorderBrush="DimGray">
220+
221+
<Grid Background="Gainsboro">
222+
223+
<Grid.RowDefinitions>
224+
<RowDefinition Height="*" />
225+
<RowDefinition Height="Auto" />
226+
</Grid.RowDefinitions>
227+
228+
<StackPanel Orientation="Vertical">
229+
<StackPanel Orientation="Horizontal"
230+
HorizontalAlignment="Stretch">
231+
232+
<!-- todo: implement converter for SelectedItem.DeclarationType -->
233+
<Image Style="{StaticResource IconStyle}"
234+
Source="{Binding SelectedItem.DeclarationType}"
235+
VerticalAlignment="Center" />
236+
237+
<TextBlock Margin="4" Text="{Binding SelectedItem.IdentifierName}"
238+
FontWeight="Bold" TextWrapping="Wrap" />
239+
240+
</StackPanel>
241+
242+
<TextBlock Margin="8,0,8,0" Text="{Binding SelectedItem.SummaryComment}"
243+
TextWrapping="Wrap"
244+
Visibility="{Binding HasSummaryComment, Converter={StaticResource BoolToVisibility}}" />
245+
246+
<TextBlock Margin="8,0,8,0" Text="{Binding SelectedItem.QualifiedSelection}"
247+
TextWrapping="Wrap" FontSize="8"
248+
Visibility="{Binding HasQualifiedSelection, Converter={StaticResource BoolToVisibility}}" />
249+
</StackPanel>
250+
251+
<WrapPanel Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="1">
252+
<Button Style="{StaticResource LinkButton}" Margin="4"
253+
Visibility="{Binding CanExecuteIndenterCommand, Converter={StaticResource BoolToVisibility}}"
254+
Command="{Binding IndenterCommand}"
255+
Content="Indent" />
256+
<Button Style="{StaticResource LinkButton}" Margin="4"
257+
Visibility="{Binding CanExecuteRefactorRename, Converter={StaticResource BoolToVisibility}}"
258+
Command="{Binding RefactorRenameCommand}"
259+
Content="{x:Static resx:RubberduckUI.RefactorMenu_Rename}" />
260+
<Button Style="{StaticResource LinkButton}" Margin="4"
261+
Visibility="{Binding CanExecuteFindAllReferences, Converter={StaticResource BoolToVisibility}}"
262+
Command="{Binding FindAllReferencesCommand}"
263+
Content="{x:Static resx:RubberduckUI.ContextMenu_FindAllReferences}" />
264+
</WrapPanel>
265+
</Grid>
266+
</Border>
267+
268+
</Grid>
269+
</UserControl>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace Rubberduck.UI.CodeExplorer
17+
{
18+
/// <summary>
19+
/// Interaction logic for CodeExplorerControl.xaml
20+
/// </summary>
21+
public partial class CodeExplorerControl : UserControl
22+
{
23+
public CodeExplorerControl()
24+
{
25+
InitializeComponent();
26+
}
27+
28+
private void ToggleButton_Click(object sender, RoutedEventArgs e)
29+
{
30+
throw new NotImplementedException();
31+
}
32+
33+
private void TreeView_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
34+
{
35+
throw new NotImplementedException();
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)