Skip to content

Commit ddea7b2

Browse files
committed
Merge branch 'next' of https://github.com/rubberduck-vba/Rubberduck into typelibs-api-refactor
2 parents cec0859 + fe2d2c0 commit ddea7b2

File tree

65 files changed

+3325
-269
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3325
-269
lines changed

Rubberduck.CodeAnalysis/Rubberduck.CodeAnalysis.xml

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

Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ private void ExecuteRemoveCommand(object param)
386386
public ImportCommand ImportCommand { get; set; }
387387
public ExportCommand ExportCommand { get; set; }
388388
public ExportAllCommand ExportAllCommand { get; set; }
389+
public DeleteCommand DeleteCommand { get; set; }
389390
public CommandBase RemoveCommand { get; }
390391
public PrintCommand PrintCommand { get; set; }
391392
public AddRemoveReferencesCommand AddRemoveReferencesCommand { get; set; }

Rubberduck.Core/Properties/Settings.Designer.cs

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

Rubberduck.Core/Properties/Settings.settings

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,33 @@
185185
<BlockCompletion IsEnabled="false" CompleteOnEnter="false" CompleteOnTab="false" />
186186
&lt;/AutoCompleteSettings&gt;</Value>
187187
</Setting>
188+
<Setting Name="ToDoGridViewColumnInfo_Description" Type="Rubberduck.Settings.ToDoGridViewColumnInfo" Scope="Application">
189+
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
190+
&lt;ToDoGridViewColumnInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
191+
&lt;DisplayIndex&gt;0&lt;/DisplayIndex&gt;
192+
&lt;Width /&gt;
193+
&lt;/ToDoGridViewColumnInfo&gt;</Value>
194+
</Setting>
195+
<Setting Name="ToDoGridViewColumnInfo_Project" Type="Rubberduck.Settings.ToDoGridViewColumnInfo" Scope="Application">
196+
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
197+
&lt;ToDoGridViewColumnInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
198+
&lt;DisplayIndex&gt;1&lt;/DisplayIndex&gt;
199+
&lt;Width /&gt;
200+
&lt;/ToDoGridViewColumnInfo&gt;</Value>
201+
</Setting>
202+
<Setting Name="ToDoGridViewColumnInfo_Module" Type="Rubberduck.Settings.ToDoGridViewColumnInfo" Scope="Application">
203+
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
204+
&lt;ToDoGridViewColumnInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
205+
&lt;DisplayIndex&gt;2&lt;/DisplayIndex&gt;
206+
&lt;Width /&gt;
207+
&lt;/ToDoGridViewColumnInfo&gt;</Value>
208+
</Setting>
209+
<Setting Name="ToDoGridViewColumnInfo_LineNumber" Type="Rubberduck.Settings.ToDoGridViewColumnInfo" Scope="Application">
210+
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
211+
&lt;ToDoGridViewColumnInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
212+
&lt;DisplayIndex&gt;3&lt;/DisplayIndex&gt;
213+
&lt;Width /&gt;
214+
&lt;/ToDoGridViewColumnInfo&gt;</Value>
215+
</Setting>
188216
</Settings>
189217
</SettingsFile>

Rubberduck.Core/Rubberduck.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<Reference Include="Infralution.Localization.Wpf">
2828
<HintPath>..\libs\Infralution.Localization.Wpf.dll</HintPath>
2929
</Reference>
30+
<Reference Include="mscorlib" />
3031
<Reference Include="PresentationCore" />
3132
<Reference Include="PresentationFramework" />
3233
<Reference Include="PresentationFramework.Aero" />
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using System;
2+
using Rubberduck.UI;
3+
using System.Windows.Controls;
4+
using System.Xml.Serialization;
5+
6+
namespace Rubberduck.Settings
7+
{
8+
public interface IGridViewColumnInfo
9+
{
10+
int DisplayIndex { get; set; }
11+
DataGridLength Width { get; set; }
12+
}
13+
14+
public class ToDoGridViewColumnInfo : ViewModelBase, IGridViewColumnInfo, IEquatable<ToDoGridViewColumnInfo>
15+
{
16+
private int _displayIndex;
17+
public int DisplayIndex
18+
{
19+
get => _displayIndex;
20+
set
21+
{
22+
if (value != _displayIndex)
23+
{
24+
_displayIndex = value;
25+
OnPropertyChanged();
26+
}
27+
}
28+
}
29+
30+
[XmlElement(Type = typeof(DataGridLength))]
31+
private DataGridLength _width;
32+
33+
public DataGridLength Width
34+
{
35+
get => _width;
36+
set
37+
{
38+
if (value != _width)
39+
{
40+
_width = value;
41+
OnPropertyChanged();
42+
}
43+
}
44+
}
45+
46+
/// <Summary>
47+
/// Default constructor required for XML serialization.
48+
/// </Summary>
49+
public ToDoGridViewColumnInfo()
50+
{
51+
}
52+
53+
public ToDoGridViewColumnInfo(int displayIndex, DataGridLength width)
54+
{
55+
DisplayIndex = displayIndex;
56+
Width = width;
57+
}
58+
59+
public bool Equals(ToDoGridViewColumnInfo other)
60+
{
61+
return DisplayIndex == other.DisplayIndex
62+
&& Width == other.Width;
63+
}
64+
}
65+
}
Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,40 @@
11
using System.Collections.Generic;
2+
using System.Collections.ObjectModel;
3+
using System.Windows.Controls;
24
using Rubberduck.SettingsProvider;
35

46
namespace Rubberduck.Settings
57
{
68
public class ToDoListConfigProvider : ConfigurationServiceBase<ToDoListSettings>
79
{
8-
private readonly IEnumerable<ToDoMarker> defaultMarkers;
10+
private readonly IEnumerable<ToDoMarker> _defaultMarkers;
11+
private readonly ObservableCollection<ToDoGridViewColumnInfo> _toDoExplorerColumns;
912

1013
public ToDoListConfigProvider(IPersistenceService<ToDoListSettings> persister)
1114
: base(persister, new DefaultSettings<ToDoListSettings, Properties.Settings>())
1215
{
13-
// FIXME replace separated ToDoMarkers with ToDoListSettings
14-
defaultMarkers = new DefaultSettings<ToDoMarker, Properties.Settings>().Defaults;
16+
_defaultMarkers = new DefaultSettings<ToDoMarker, Properties.Settings>().Defaults;
17+
18+
var gvciDefaults = new DefaultSettings<ToDoGridViewColumnInfo, Properties.Settings>().Defaults;
19+
_toDoExplorerColumns = new ObservableCollection<ToDoGridViewColumnInfo>(gvciDefaults);
1520
}
1621

1722
public override ToDoListSettings ReadDefaults()
1823
{
19-
return new ToDoListSettings(defaultMarkers);
24+
return new ToDoListSettings(_defaultMarkers, _toDoExplorerColumns);
25+
}
26+
27+
public override ToDoListSettings Read()
28+
{
29+
var toDoListSettings = base.Read();
30+
31+
if (toDoListSettings.ColumnHeadersInformation == null
32+
|| toDoListSettings.ColumnHeadersInformation.Count == 0)
33+
{
34+
toDoListSettings.ColumnHeadersInformation = _toDoExplorerColumns;
35+
}
36+
37+
return toDoListSettings;
2038
}
2139
}
2240
}

Rubberduck.Core/Settings/ToDoListSettings.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
34
using System.Linq;
45
using System.Xml.Serialization;
6+
using Rubberduck.UI;
57

68
namespace Rubberduck.Settings
79
{
810
internal interface IToDoListSettings
911
{
1012
ToDoMarker[] ToDoMarkers { get; set; }
13+
ObservableCollection<ToDoGridViewColumnInfo> ColumnHeadersInformation { get; set; }
1114
}
1215

1316
[XmlType(AnonymousType = true)]
14-
public class ToDoListSettings : IToDoListSettings, IEquatable<ToDoListSettings>
17+
public class ToDoListSettings : ViewModelBase, IToDoListSettings, IEquatable<ToDoListSettings>
1518
{
1619
private IEnumerable<ToDoMarker> _markers;
1720

@@ -26,21 +29,38 @@ public ToDoMarker[] ToDoMarkers
2629
}
2730
}
2831

32+
private ObservableCollection<ToDoGridViewColumnInfo> _columnHeadersInfo;
33+
public ObservableCollection<ToDoGridViewColumnInfo> ColumnHeadersInformation
34+
{
35+
get => _columnHeadersInfo;
36+
set
37+
{
38+
if (value != _columnHeadersInfo)
39+
{
40+
_columnHeadersInfo = value;
41+
OnPropertyChanged();
42+
}
43+
}
44+
}
45+
2946
/// <Summary>
3047
/// Default constructor required for XML serialization.
3148
/// </Summary>
3249
public ToDoListSettings()
3350
{
3451
}
3552

36-
public ToDoListSettings(IEnumerable<ToDoMarker> defaultMarkers)
53+
public ToDoListSettings(IEnumerable<ToDoMarker> defaultMarkers, ObservableCollection<ToDoGridViewColumnInfo> columnHeaders)
3754
{
3855
_markers = defaultMarkers;
56+
ColumnHeadersInformation = columnHeaders;
3957
}
4058

4159
public bool Equals(ToDoListSettings other)
4260
{
43-
return other != null && ToDoMarkers.SequenceEqual(other.ToDoMarkers);
61+
return other != null
62+
&& ToDoMarkers.SequenceEqual(other.ToDoMarkers)
63+
&& ColumnHeadersInformation.Equals(other.ColumnHeadersInformation);
4464
}
4565
}
4666
}

Rubberduck.Core/UI/AddRemoveReferences/AddRemoveReferencesWindow.xaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@
181181
SelectionMode="Single"
182182
ItemsSource="{Binding AvailableReferences}"
183183
HorizontalContentAlignment="Stretch"
184-
ScrollViewer.HorizontalScrollBarVisibility="Auto">
184+
ScrollViewer.HorizontalScrollBarVisibility="Auto"
185+
GotFocus="ListView_SynchronizeCurrentSelection_OnGotFocus">
185186
<ListView.ItemContainerStyle>
186187
<Style TargetType="ListViewItem">
187188
<Setter Property="Height" Value="20" />
@@ -239,7 +240,8 @@
239240
SelectionMode="Single"
240241
ItemsSource="{Binding ProjectReferences, NotifyOnTargetUpdated=True}"
241242
ScrollViewer.HorizontalScrollBarVisibility="Auto"
242-
HorizontalContentAlignment="Stretch">
243+
HorizontalContentAlignment="Stretch"
244+
GotFocus="ListView_SynchronizeCurrentSelection_OnGotFocus">
243245
<ListView.ItemContainerStyle>
244246
<Style TargetType="ListViewItem">
245247
<Setter Property="Height" Value="20" />
@@ -388,18 +390,22 @@
388390
<ColumnDefinition Width="50" />
389391
<ColumnDefinition Width="100" />
390392
</Grid.ColumnDefinitions>
391-
<TextBox Grid.Row="0" Grid.Column="0" Style="{StaticResource SelectableText}" Text="{Binding CurrentSelection.Description, Mode=OneWay}" />
393+
<TextBox x:Name="Description"
394+
Grid.Row="0" Grid.Column="0" Style="{StaticResource SelectableText}" Text="{Binding CurrentSelection.Description, Mode=OneWay}" />
392395
<Label Grid.Row="0" Grid.Column="1"
393396
Foreground="{x:Static SystemColors.GrayTextBrush}"
394397
VerticalAlignment="Center"
395398
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=References_Version}" />
396-
<TextBox Grid.Row="0" Grid.Column="2" Style="{StaticResource SelectableText}" Text="{Binding CurrentSelection.Version, Mode=OneWay}" />
399+
<TextBox x:Name="Version"
400+
Grid.Row="0" Grid.Column="2" Style="{StaticResource SelectableText}" Text="{Binding CurrentSelection.Version, Mode=OneWay}" />
397401
<Label Grid.Row="0" Grid.Column="3"
398402
Foreground="{x:Static SystemColors.GrayTextBrush}"
399403
VerticalAlignment="Center"
400404
Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=References_Locale}" />
401-
<TextBox Grid.Row="0" Grid.Column="4" Style="{StaticResource SelectableText}" Text="{Binding CurrentSelection.LocaleName, Mode=OneWay}" />
402-
<TextBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" Style="{StaticResource SelectableText}" Text="{Binding CurrentSelection.FullPath, Mode=OneWay}" />
405+
<TextBox x:Name="LocaleName"
406+
Grid.Row="0" Grid.Column="4" Style="{StaticResource SelectableText}" Text="{Binding CurrentSelection.LocaleName, Mode=OneWay}" />
407+
<TextBox x:Name="FullPath"
408+
Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" Style="{StaticResource SelectableText}" Text="{Binding CurrentSelection.FullPath, Mode=OneWay}" />
403409
</Grid>
404410
</Border>
405411
</Border>
Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
1-
using System.Windows.Controls;
1+
using System.Windows;
2+
using System.Windows.Controls.Primitives;
3+
using Rubberduck.AddRemoveReferences;
24

35
namespace Rubberduck.UI.AddRemoveReferences
46
{
57
/// <summary>
68
/// Interaction logic for AddRemoveReferencesWindow.xaml
79
/// </summary>
8-
public partial class AddRemoveReferencesWindow : UserControl
10+
public partial class AddRemoveReferencesWindow
911
{
1012
public AddRemoveReferencesWindow()
1113
{
1214
InitializeComponent();
1315
}
1416

1517
private AddRemoveReferencesViewModel ViewModel => DataContext as AddRemoveReferencesViewModel;
18+
19+
private void ListView_SynchronizeCurrentSelection_OnGotFocus(object sender, RoutedEventArgs e)
20+
{
21+
UpdateCurrentSelection((Selector)sender);
22+
23+
var cs = ViewModel.CurrentSelection;
24+
Description.Text = cs.Description;
25+
Version.Text = cs.Version;
26+
LocaleName.Text = cs.LocaleName;
27+
FullPath.Text = cs.FullPath;
28+
}
29+
30+
private void UpdateCurrentSelection(Selector sender)
31+
{
32+
var selectedReferenceModel = (ReferenceModel)sender.SelectedItem;
33+
ViewModel.CurrentSelection = selectedReferenceModel;
34+
}
1635
}
1736
}

0 commit comments

Comments
 (0)