Skip to content

Commit fe10c33

Browse files
committed
Improvements to the AnnotateDeclaration UI
1 parent cae0d96 commit fe10c33

File tree

5 files changed

+29
-24
lines changed

5 files changed

+29
-24
lines changed

Rubberduck.Core/UI/Refactorings/AnnotateDeclaration/AnnotateDeclarationPresenter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Rubberduck.UI.Refactorings.AnnotateDeclaration
55
{
66
internal class AnnotateDeclarationPresenter : RefactoringPresenterBase<AnnotateDeclarationModel>, IAnnotateDeclarationPresenter
77
{
8-
private static readonly DialogData DialogData = DialogData.Create(RubberduckUI.AnnotateDeclarationDialog_Caption, 400, 300);
8+
private static readonly DialogData DialogData = DialogData.Create(RubberduckUI.AnnotateDeclarationDialog_Caption, 500, 400);
99

1010
public AnnotateDeclarationPresenter(AnnotateDeclarationModel model, IRefactoringDialogFactory dialogFactory) :
1111
base(DialogData, model, dialogFactory)

Rubberduck.Core/UI/Refactorings/AnnotateDeclaration/AnnotateDeclarationView.xaml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
67
xmlns:converters="clr-namespace:Rubberduck.UI.Converters"
78
xmlns:local="clr-namespace:Rubberduck.UI.Refactorings.AnnotateDeclaration"
89
xmlns:annotations="clr-namespace:Rubberduck.Parsing.Annotations;assembly=Rubberduck.Parsing"
910
mc:Ignorable="d"
10-
d:DesignHeight="400" d:DesignWidth="300">
11+
d:DesignHeight="500" d:DesignWidth="400">
1112
<UserControl.Resources>
1213
<ResourceDictionary>
1314
<ResourceDictionary.MergedDictionaries>
@@ -24,17 +25,14 @@
2425
<Setter Property="Validation.ErrorTemplate">
2526
<Setter.Value>
2627
<ControlTemplate x:Name="TextBoxErrorTemplate">
27-
<Canvas>
28-
<DockPanel LastChildFill="True" ClipToBounds="False">
29-
<AdornedElementPlaceholder/>
30-
<Image Source="{StaticResource InvalidTextImage}"
31-
Height="16"
32-
Margin="0,-8,-8,0"
33-
HorizontalAlignment="Right"
34-
VerticalAlignment="Top"
35-
ClipToBounds="False"/>
36-
</DockPanel>
37-
</Canvas>
28+
<StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal">
29+
<AdornedElementPlaceholder/>
30+
<Image Source="{StaticResource InvalidTextImage}"
31+
Height="16"
32+
Margin="0,-8,-8,0"
33+
HorizontalAlignment="Right"
34+
VerticalAlignment="Top"/>
35+
</StackPanel>
3836
</ControlTemplate>
3937
</Setter.Value>
4038
</Setter>
@@ -53,19 +51,19 @@
5351

5452
<Grid>
5553
<Grid.RowDefinitions>
56-
<RowDefinition Height="auto" />
57-
<RowDefinition Height="auto" />
54+
<RowDefinition Height="Auto" />
55+
<RowDefinition Height="Auto" />
5856
<RowDefinition Height="*" />
5957
<RowDefinition Height="40" />
6058
</Grid.RowDefinitions>
6159
<StackPanel Background="{StaticResource BackgroundLightBrush}">
62-
<Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_TitleText}" FontWeight="Bold" />
63-
<TextBlock Text="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_Instructions}" Margin="5,0" TextWrapping="Wrap" />
60+
<Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_TitleText}" FontWeight="Bold"/>
61+
<TextBlock Text="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_Instructions}" Margin="5,0,0,10" TextWrapping="Wrap" />
6462
</StackPanel>
6563
<StackPanel Grid.Row="1">
66-
<TextBlock Text="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_DeclarationLabel}" Margin="5,0" />
67-
<TextBlock Text="{Binding Model.Target, Converter={StaticResource DeclarationToQualifiedNameConverter}}" Margin="10,0" />
68-
<TextBlock Text="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_AnnotationLabel}" Margin="5,5,0,0" />
64+
<Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_DeclarationLabel}" FontWeight="DemiBold" />
65+
<TextBlock Text="{Binding Model.Target, Converter={StaticResource DeclarationToQualifiedNameConverter}}" Margin="5,0,0,5" FontWeight="Regular" />
66+
<Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_AnnotationLabel}" FontWeight="DemiBold" />
6967
<ComboBox
7068
ItemsSource="{Binding ApplicableAnnotations}"
7169
SelectedItem="{Binding Annotation}"
@@ -77,7 +75,7 @@
7775
</DataTemplate>
7876
</ComboBox.ItemTemplate>
7977
</ComboBox>
80-
<TextBlock Text="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentsLabel}" Margin="5,5,0,0" />
78+
<Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=AnnotateDeclarationDialog_ArgumentsLabel}" FontWeight="DemiBold" Margin="5,5,0,0" />
8179
</StackPanel>
8280
<Grid Grid.Row="2">
8381
<Grid.ColumnDefinitions>
@@ -108,6 +106,13 @@
108106
<converters:SpecificValueToVisibilityConverter SpecialValue="{x:Static annotations:AnnotationArgumentType.Boolean}" CollapseSpecialValue="False" x:Key="BooleanArgumentVisibilityConverter"/>
109107
<converters:SpecificValueToVisibilityConverter SpecialValue="{x:Static annotations:AnnotationArgumentType.Inspection}" CollapseSpecialValue="False" x:Key="InspectionArgumentVisibilityConverter"/>
110108
<DataTemplate DataType="{x:Type local:IAnnotationArgumentViewModel}" x:Key="ArgumentValueTemplate">
109+
<DataTemplate.Resources>
110+
<CollectionViewSource Source="{Binding InspectionNames}" x:Key="InspectionNamesView">
111+
<CollectionViewSource.SortDescriptions>
112+
<scm:SortDescription PropertyName="." /> <!-- This is not really the sort we want. We want a converter here, which is impossible. -->
113+
</CollectionViewSource.SortDescriptions>
114+
</CollectionViewSource>
115+
</DataTemplate.Resources>
111116
<StackPanel>
112117
<TextBox Text="{Binding ArgumentValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
113118
Style="{StaticResource TextBoxErrorStyle}"

Rubberduck.Resources/RubberduckUI.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rubberduck.Resources/RubberduckUI.de.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ Import abgebrochen.</value>
16351635
<value>Hinzufügen</value>
16361636
</data>
16371637
<data name="AnnotateDeclarationDialog_Instructions" xml:space="preserve">
1638-
<value>Wähle eine Annotation (und Werte), die zu der ausgewählten Deklaration hinzugefügt werden soll.</value>
1638+
<value>Wählen Sie eine Annotation (und Werte), die zu der Deklaration hinzugefügt werden soll.</value>
16391639
</data>
16401640
<data name="AnnotationArgument_ValidationError_SpecialCharacters" xml:space="preserve">
16411641
<value>Annotationsargumente dürfen keine Kontrollzeichen enthalten.</value>

Rubberduck.Resources/RubberduckUI.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,7 @@ Import aborted.</value>
18501850
<value>Remove</value>
18511851
</data>
18521852
<data name="AnnotateDeclarationDialog_Instructions" xml:space="preserve">
1853-
<value>Select an annotation (and values) to add to the selected declaration.</value>
1853+
<value>Select an annotation (and values) to add to the declaration.</value>
18541854
</data>
18551855
<data name="AnnotationArgument_ValidationError_SpecialCharacters" xml:space="preserve">
18561856
<value>Annotation arguments must not contain control characters.</value>

0 commit comments

Comments
 (0)