Skip to content

Commit fa6eedf

Browse files
committed
Merge pull request #968 from Hosch250/BugBlipper
Fix bug where entire group opens and closes together. Also prevent r…
2 parents 9c919f5 + b09ee5e commit fa6eedf

File tree

8 files changed

+95
-71
lines changed

8 files changed

+95
-71
lines changed

RetailCoder.VBE/Controls/GroupingGrid/GroupingGrid.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
mc:Ignorable="d"
88
d:DesignHeight="300" d:DesignWidth="300">
99
<DataGrid.Resources>
10-
<Style x:Key="GrouHeaderStyle" TargetType="{x:Type GroupItem}">
10+
<Style x:Key="GroupHeaderStyle" TargetType="{x:Type GroupItem}">
1111
<Setter Property="Template">
1212
<Setter.Value>
1313
<ControlTemplate>
14-
<Expander Background="White" Foreground="Black" Header="{Binding Name}" IsExpanded="{Binding IsExpanded, RelativeSource={RelativeSource AncestorType=DataGrid}}">
14+
<Expander Background="WhiteSmoke" Foreground="Black" Header="{Binding Name}" IsExpanded="True">
1515
<ItemsPresenter></ItemsPresenter>
1616
</Expander>
1717
</ControlTemplate>
@@ -20,7 +20,7 @@
2020
</Style>
2121
</DataGrid.Resources>
2222
<DataGrid.GroupStyle>
23-
<GroupStyle ContainerStyle="{StaticResource GrouHeaderStyle}">
23+
<GroupStyle ContainerStyle="{StaticResource GroupHeaderStyle}">
2424
<GroupStyle.Panel>
2525
<ItemsPanelTemplate>
2626
<DataGridRowsPresenter></DataGridRowsPresenter>

RetailCoder.VBE/ToDoItems/ToDoItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class ToDoItem
3535
public QualifiedSelection GetSelection() { return _selection; }
3636

3737
public ToDoItem(TodoPriority priority, CommentNode comment)
38-
: this(priority, comment.CommentText, comment.QualifiedSelection)
38+
: this(priority, comment.Comment.Remove(0, 1).Trim(), comment.QualifiedSelection)
3939
{
4040
}
4141

RetailCoder.VBE/UI/ToDoItems/ToDoExplorerControl.xaml

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,70 @@
1010
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance toDoItems:ToDoExplorerViewModel, IsDesignTimeCreatable=False}">
1111
<UserControl.Resources>
1212
<BitmapImage x:Key="RefreshImage" UriSource="../../Resources/arrow-circle-double.png" />
13-
<BitmapImage x:Key="ClearImage" UriSource="../../Resources/cross-script.png" />
13+
<BitmapImage x:Key="DeleteImage" UriSource="../../Resources/cross-script.png" />
14+
15+
<LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" EndPoint="0,1" StartPoint="0,0">
16+
<GradientStop Color="#FFD9F4FF" Offset="0"/>
17+
<GradientStop Color="#FF9BDDFB" Offset="1"/>
18+
</LinearGradientBrush>
19+
<LinearGradientBrush x:Key="{x:Static SystemColors.ControlBrushKey}" EndPoint="0,1" StartPoint="0,0">
20+
<GradientStop Color="#FFEEEDED" Offset="0"/>
21+
<GradientStop Color="#FFDDDDDD" Offset="1"/>
22+
</LinearGradientBrush>
23+
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
24+
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" />
25+
26+
<Style x:Key="PrettifyRow" TargetType="DataGridRow">
27+
<EventSetter Event="MouseDoubleClick" Handler="GroupingGridItem_MouseDoubleClick" />
28+
<Setter Property="BorderThickness" Value="0,.5,0,0" />
29+
<Setter Property="BorderBrush" Value="DarkGray" />
30+
<Setter Property="Height" Value="22" />
31+
<Setter Property="TextBlock.FontWeight" Value="Normal" />
32+
<Style.Triggers>
33+
<Trigger Property="IsSelected" Value="True">
34+
<Setter Property="BorderThickness" Value="1.5" />
35+
<Setter Property="BorderBrush" Value="#adc6e5"/>
36+
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
37+
</Trigger>
38+
</Style.Triggers>
39+
<Style.Resources>
40+
<Style TargetType="Border">
41+
<Setter Property="CornerRadius" Value="2"/>
42+
</Style>
43+
</Style.Resources>
44+
</Style>
1445
</UserControl.Resources>
1546
<DockPanel LastChildFill="True">
16-
<ToolBarTray DockPanel.Dock="Top">
47+
<ToolBarTray DockPanel.Dock="Top" IsLocked="True">
1748
<ToolBar>
18-
<StackPanel Orientation="Horizontal">
19-
<Button ToolTip="Refresh" Command="{Binding RefreshCommand, Mode=OneWay}">
20-
<Image Source="{StaticResource RefreshImage}"></Image>
21-
</Button>
22-
<Button ToolTip="Clear" Command="{Binding Clear}">
23-
<Image Source="{StaticResource ClearImage}"></Image>
24-
</Button>
25-
</StackPanel>
49+
<Button ToolTip="{x:Static resx:RubberduckUI.Refresh}" Command="{Binding RefreshCommand, Mode=OneWay}" BorderThickness="0" Background="Transparent">
50+
<Image Source="{StaticResource RefreshImage}" />
51+
</Button>
52+
<Separator />
53+
<Button ToolTip="{x:Static resx:RubberduckUI.Remove}" Command="{Binding Remove}" BorderThickness="0" Background="Transparent">
54+
<Image Source="{StaticResource DeleteImage}" />
55+
</Button>
2656
</ToolBar>
2757
</ToolBarTray>
28-
<controls:GroupingGrid ItemsSource="{Binding ToDos}" AutoGenerateColumns="False" SelectedItem="{Binding SelectedToDo}" IsExpanded="True">
58+
<controls:GroupingGrid ItemsSource="{Binding ToDos}" AutoGenerateColumns="False"
59+
SelectedItem="{Binding SelectedToDo}" IsExpanded="True"
60+
CanUserReorderColumns="False" IsReadOnly="True"
61+
HorizontalGridLinesBrush="Transparent" VerticalGridLinesBrush="Transparent"
62+
HeadersVisibility="Column" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
63+
ItemContainerStyle="{StaticResource PrettifyRow}">
64+
<DataGrid.CellStyle>
65+
<Style TargetType="DataGridCell">
66+
<Setter Property="BorderThickness" Value="0" />
67+
<Setter Property="VerticalAlignment" Value="Center" />
68+
<Setter Property="Background" Value="Transparent" />
69+
</Style>
70+
</DataGrid.CellStyle>
2971
<DataGrid.Columns>
30-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.Priority}" Binding="{Binding Priority}">
31-
</DataGridTextColumn>
32-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.TodoExplorer_Description}" Binding="{Binding Description}"></DataGridTextColumn>
33-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.ProjectName}" Binding="{Binding ProjectName}"></DataGridTextColumn>
34-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.ModuleName}" Binding="{Binding ModuleName}"></DataGridTextColumn>
35-
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.TodoExplorer_LineNumber}" Binding="{Binding LineNumber}"></DataGridTextColumn>
72+
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.Priority}" Binding="{Binding Priority}" />
73+
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.TodoExplorer_Description}" Binding="{Binding Description}" Width="*"/>
74+
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.ProjectName}" Binding="{Binding ProjectName}" />
75+
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.ModuleName}" Binding="{Binding ModuleName}" />
76+
<DataGridTextColumn Header="{x:Static resx:RubberduckUI.TodoExplorer_LineNumber}" Binding="{Binding LineNumber}" />
3677
</DataGrid.Columns>
3778
</controls:GroupingGrid>
3879
</DockPanel>
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
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;
1+
using System.Windows.Input;
152

163
namespace Rubberduck.UI.ToDoItems
174
{
@@ -24,5 +11,15 @@ public ToDoExplorerControl()
2411
{
2512
InitializeComponent();
2613
}
14+
15+
private void GroupingGridItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
16+
{
17+
var viewModel = DataContext as ToDoExplorerViewModel;
18+
19+
if (viewModel != null)
20+
{
21+
viewModel.NavigateToToDo.Execute(new NavigateCodeEventArgs(viewModel.SelectedToDo.GetSelection()));
22+
}
23+
}
2724
}
2825
}

RetailCoder.VBE/UI/ToDoItems/ToDoExplorerDockablePresenter.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.ComponentModel;
4-
using System.Linq;
5-
using System.Threading.Tasks;
6-
using System.Windows.Forms;
7-
using Microsoft.Vbe.Interop;
8-
using Rubberduck.Parsing;
9-
using Rubberduck.Parsing.Nodes;
10-
using Rubberduck.Settings;
11-
using Rubberduck.ToDoItems;
12-
using Rubberduck.VBEditor.VBEInterfaces.RubberduckCodePane;
1+
using Microsoft.Vbe.Interop;
132

143
namespace Rubberduck.UI.ToDoItems
154
{

RetailCoder.VBE/UI/ToDoItems/ToDoExplorerViewModel.cs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Collections.ObjectModel;
1+
using System.Collections.Generic;
42
using System.Linq;
5-
using System.Text;
63
using System.Threading.Tasks;
74
using System.Windows.Data;
85
using System.Windows.Input;
96
using System.Windows.Threading;
10-
using Microsoft.Vbe.Interop;
11-
using Rubberduck.Common;
12-
using Rubberduck.Parsing;
137
using Rubberduck.Parsing.Nodes;
148
using Rubberduck.Parsing.VBA;
159
using Rubberduck.Settings;
1610
using Rubberduck.ToDoItems;
1711
using Rubberduck.UI.Command;
18-
using Rubberduck.VBEditor.VBEInterfaces.RubberduckCodePane;
1912

2013
namespace Rubberduck.UI.ToDoItems
2114
{
@@ -28,10 +21,15 @@ public ToDoExplorerViewModel(RubberduckParserState state, IGeneralConfigService
2821
{
2922
_state = state;
3023
_markers = configService.GetDefaultConfiguration().UserSettings.ToDoListSettings.ToDoMarkers;
24+
25+
_uiDispatcher = Dispatcher.CurrentDispatcher;
3126
}
3227

3328
public ListCollectionView ToDos {
34-
get { return _toDos; }
29+
get
30+
{
31+
return _toDos;
32+
}
3533
set
3634
{
3735
_toDos = value;
@@ -63,17 +61,21 @@ private async void _state_StateChanged(object sender, ParserStateEventArgs e)
6361
return;
6462
}
6563
var results = await GetItems();
66-
Dispatcher.CurrentDispatcher.Invoke(() =>
64+
65+
_uiDispatcher.Invoke(() =>
6766
{
6867
ToDos = new ListCollectionView(results.ToList());
69-
ToDos.GroupDescriptions.Add(new PropertyGroupDescription("Type"));
68+
if (ToDos.GroupDescriptions != null)
69+
{
70+
ToDos.GroupDescriptions.Add(new PropertyGroupDescription("Type"));
71+
}
7072
});
7173
}
7274

7375
public ToDoItem SelectedToDo { get; set; }
7476

7577
private ICommand _clear;
76-
public ICommand Clear
78+
public ICommand Remove
7779
{
7880
get
7981
{
@@ -101,6 +103,8 @@ public ICommand Clear
101103
}
102104

103105
private ICommand _navigateToToDo;
106+
private readonly Dispatcher _uiDispatcher;
107+
104108
public ICommand NavigateToToDo
105109
{
106110
get

RetailCoder.VBE/UI/ToDoItems/ToDoExplorerWindow.Designer.cs

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

RetailCoder.VBE/UI/ToDoItems/ToDoExplorerWindow.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.ComponentModel;
4-
using System.Diagnostics.CodeAnalysis;
5-
using System.Linq;
1+
using System.Diagnostics.CodeAnalysis;
62
using System.Windows.Forms;
7-
using System.Windows.Forms.Integration;
8-
using Rubberduck.ToDoItems;
9-
using Rubberduck.UI.CodeInspections;
103

114
namespace Rubberduck.UI.ToDoItems
125
{
@@ -29,7 +22,7 @@ public ToDoExplorerViewModel ViewModel
2922
set
3023
{
3124
_viewModel = value;
32-
this.toDoExplorerControl1.DataContext = _viewModel;
25+
TodoExplorerControl.DataContext = _viewModel;
3326
if (_viewModel != null)
3427
{
3528
_viewModel.RefreshCommand.Execute(null);

0 commit comments

Comments
 (0)