Skip to content

Commit 71bcebb

Browse files
committed
1.7.9-2
[Changes] - Allow editing of profile actions #55 - Add starter profiles #53 - Some ui changes
1 parent 45bf50e commit 71bcebb

File tree

12 files changed

+310
-88
lines changed

12 files changed

+310
-88
lines changed

Source/HDRProfile/App.xaml

Lines changed: 122 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
<SolidColorBrush x:Key="HighlightedBrush" Color="{StaticResource SelectedBackgroundColor}"/>
5151
<SolidColorBrush x:Key="MouseOverBrush" Color="{StaticResource ControlMouseOverColor}"/>
5252
<SolidColorBrush x:Key="InactiveAccentBrush">#ad7b7b</SolidColorBrush>
53+
<SolidColorBrush x:Key="DragScrollBrush">#757575</SolidColorBrush>
54+
<SolidColorBrush x:Key="ScrollBrush">#969696</SolidColorBrush>
55+
<SolidColorBrush x:Key="MouseOverScrollBrush">#a1a1a1</SolidColorBrush>
56+
5357
<SolidColorBrush x:Key="DisabledAccentBrush">#949ea6</SolidColorBrush>
5458
<SolidColorBrush x:Key="HighlightedInactiveAccentBrush" Color="#95bfdb"/>
5559
<StaticResource x:Key="ButtonBackgroundBrush" ResourceKey="AccentBrush"/>
@@ -152,7 +156,7 @@
152156
<Setter.Value>
153157
<ControlTemplate TargetType="Button">
154158
<Border Height="Auto" Width="Auto" BorderBrush="{TemplateBinding Background}" Background="{TemplateBinding Background}" BorderThickness="0" CornerRadius="{StaticResource CornerRadius}">
155-
<TextBlock FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" Background="Transparent" Margin="5" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
159+
<TextBlock FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" Background="Transparent" Margin="5,2" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
156160
</Border>
157161
</ControlTemplate>
158162
</Setter.Value>
@@ -710,6 +714,123 @@
710714

711715

712716

717+
<Style x:Key="ScrollThumbs" TargetType="{x:Type Thumb}">
718+
<Setter Property="Template">
719+
<Setter.Value>
720+
<ControlTemplate TargetType="{x:Type Thumb}">
721+
<Grid x:Name="Grid">
722+
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Fill="Transparent" />
723+
<Border x:Name="Rectangle1" CornerRadius="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Background="{TemplateBinding Background}" />
724+
</Grid>
725+
<ControlTemplate.Triggers>
726+
<Trigger Property="Tag" Value="Vertical">
727+
<Setter TargetName="Rectangle1" Property="Width" Value="6" />
728+
<Setter TargetName="Rectangle1" Property="Height" Value="Auto" />
729+
</Trigger>
730+
<Trigger Property="Tag" Value="Horizontal">
731+
<Setter TargetName="Rectangle1" Property="Width" Value="Auto" />
732+
<Setter TargetName="Rectangle1" Property="Height" Value="6" />
733+
734+
</Trigger>
735+
736+
</ControlTemplate.Triggers>
737+
</ControlTemplate>
738+
</Setter.Value>
739+
</Setter>
740+
</Style>
741+
742+
<!--ScrollBars-->
743+
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
744+
<Setter Property="Stylus.IsFlicksEnabled" Value="false" />
745+
<Setter Property="Foreground" Value="LightGray" />
746+
<Setter Property="Background" Value="{StaticResource ScrollBrush}" />
747+
<Setter Property="Width" Value="10" />
748+
<Setter Property="Template">
749+
<Setter.Value>
750+
<ControlTemplate TargetType="{x:Type ScrollBar}">
751+
<Grid x:Name="GridRoot" Width="19" Background="Transparent">
752+
<Grid.RowDefinitions>
753+
<RowDefinition Height="0.00001*" />
754+
</Grid.RowDefinitions>
755+
756+
<Track x:Name="PART_Track" Grid.Row="0" IsDirectionReversed="true" Focusable="false">
757+
<Track.Thumb>
758+
<Thumb x:Name="Thumb" Background="{TemplateBinding Foreground}" Style="{DynamicResource ScrollThumbs}" />
759+
</Track.Thumb>
760+
<Track.IncreaseRepeatButton>
761+
<RepeatButton x:Name="PageUp" Command="ScrollBar.PageDownCommand" Opacity="0" Focusable="false" />
762+
</Track.IncreaseRepeatButton>
763+
<Track.DecreaseRepeatButton>
764+
<RepeatButton x:Name="PageDown" Command="ScrollBar.PageUpCommand" Opacity="0" Focusable="false" />
765+
</Track.DecreaseRepeatButton>
766+
</Track>
767+
</Grid>
768+
769+
<ControlTemplate.Triggers>
770+
<Trigger SourceName="Thumb" Property="IsMouseOver" Value="true">
771+
<Setter Value="{DynamicResource MouseOverScrollBrush}" TargetName="Thumb" Property="Background" />
772+
</Trigger>
773+
<Trigger SourceName="Thumb" Property="IsDragging" Value="true">
774+
<Setter Value="{DynamicResource DragScrollBrush }" TargetName="Thumb" Property="Background" />
775+
</Trigger>
776+
777+
<Trigger Property="IsEnabled" Value="false">
778+
<Setter TargetName="Thumb" Property="Visibility" Value="Collapsed" />
779+
</Trigger>
780+
<Trigger Property="Orientation" Value="Horizontal">
781+
<Setter TargetName="GridRoot" Property="LayoutTransform">
782+
<Setter.Value>
783+
<RotateTransform Angle="-90" />
784+
</Setter.Value>
785+
</Setter>
786+
<Setter TargetName="PART_Track" Property="LayoutTransform">
787+
<Setter.Value>
788+
<RotateTransform Angle="-90" />
789+
</Setter.Value>
790+
</Setter>
791+
<Setter Property="Width" Value="Auto" />
792+
<Setter Property="Height" Value="10" />
793+
<Setter TargetName="Thumb" Property="Tag" Value="Horizontal" />
794+
<Setter TargetName="PageDown" Property="Command" Value="ScrollBar.PageLeftCommand" />
795+
<Setter TargetName="PageUp" Property="Command" Value="ScrollBar.PageRightCommand" />
796+
</Trigger>
797+
<Trigger Property="Orientation" Value="Vertical">
798+
<!--<Setter TargetName="GridRoot" Property="LayoutTransform">
799+
<Setter.Value>
800+
<RotateTransform Angle="-90" />
801+
</Setter.Value>
802+
</Setter>
803+
<Setter TargetName="PART_Track" Property="LayoutTransform">
804+
<Setter.Value>
805+
<RotateTransform Angle="-90" />
806+
</Setter.Value>
807+
</Setter>-->
808+
<Setter Property="Width" Value="10" />
809+
<Setter Property="Height" Value="Auto" />
810+
<Setter TargetName="Thumb" Property="Tag" Value="Vertical" />
811+
<Setter TargetName="PageDown" Property="Command" Value="ScrollBar.PageLeftCommand" />
812+
<Setter TargetName="PageUp" Property="Command" Value="ScrollBar.PageRightCommand" />
813+
</Trigger>
814+
815+
</ControlTemplate.Triggers>
816+
</ControlTemplate>
817+
</Setter.Value>
818+
</Setter>
819+
</Style>
820+
821+
822+
823+
824+
825+
826+
827+
828+
829+
830+
831+
832+
833+
713834

714835
<local:EnumLocaleConverter x:Key="EnumLocaleConverter"/>
715836
<corewpf:DialogService x:Key="DialogService" />

Source/HDRProfile/Globals.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using CodectoryCore.Logging;
1+
using AutoHDR.Profiles;
2+
using CodectoryCore.Logging;
23
using CodectoryCore.UI.Wpf;
34
using System;
45
using System.Collections.Generic;
@@ -71,10 +72,9 @@ public void LoadSettings()
7172
{
7273
Globals.Logs.Add("No settings found. Creating settings file...", false);
7374
Settings = new UserAppSettings();
74-
_settingsLoadedOnce = true;
75-
75+
Settings.ApplicationProfiles.Add(Profile.DefaultProfile());
76+
_settingsLoadedOnce = true;
7677
}
77-
7878
SaveSettings();
7979

8080
}
@@ -97,6 +97,7 @@ public void LoadSettings()
9797
Globals.Logs.Add("Settings loaded", false);
9898
}
9999

100+
100101
[Obsolete]
101102
private UserAppSettings LoadObsoleteHDRSettings()
102103
{

Source/HDRProfile/Info/AutoHDRInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public AutoHDRInfo()
9494
{
9595
CreateRelayCommands();
9696
Version = VersionExtension.ApplicationVersion(System.Reflection.Assembly.GetExecutingAssembly());
97+
Title = ProjectResources.Locale_Texts.Info;
9798
}
9899

99100
private void CreateRelayCommands()

Source/HDRProfile/Info/AutoHDRLicense.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ namespace AutoHDR.Info
99
{
1010
public class AutoHDRLicense : DialogViewModelBase
1111
{
12+
public AutoHDRLicense()
13+
{
14+
Title = ProjectResources.Locale_Texts.License;
15+
}
1216
}
1317
}

Source/HDRProfile/Profiles/Actions/ProfileActionAdder.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ public class ProfileActionAdder : DialogViewModelBase
1717
{
1818

1919

20+
private bool _editMode = false;
2021
private bool _canCreate = false;
2122

23+
public bool CanCreate { get => _canCreate; set { _canCreate = value; OnPropertyChanged(); } }
24+
public bool EditMode { get => _editMode; set { _editMode = value; OnPropertyChanged(); } }
25+
2226

2327
private ActionTypeDescription _actionType = null;
2428

@@ -52,7 +56,7 @@ public BaseViewModel ContentControlViewModel
5256

5357
private IProfileAction _profileAction = null;
5458

55-
public IProfileAction ProfileAction { get => _profileAction; private set { _profileAction = value; OnPropertyChanged(); } }
59+
public IProfileAction ProfileAction { get => _profileAction; set { _profileAction = value; OnPropertyChanged(); } }
5660

5761
public List<ActionTypeDescription> ProfileActions
5862
{
@@ -69,10 +73,22 @@ public List<ActionTypeDescription> ProfileActions
6973

7074
public ProfileActionAdder()
7175
{
76+
EditMode = false;
7277
Title = Locale_Texts.AddProfileAction;
7378
CreateRelayCommands();
7479
}
7580

81+
public ProfileActionAdder(IProfileAction action)
82+
{
83+
EditMode = true;
84+
ActionType = ProfileActions.First(d => d.ActionType.Equals(action.GetType()));
85+
ContentControlViewModel = (BaseViewModel)action;
86+
87+
Title = Locale_Texts.EditProfileAction;
88+
89+
CreateRelayCommands();
90+
}
91+
7692
private void CreateRelayCommands()
7793
{
7894
OKClickCommand = new RelayCommand<object>(CreateBaseProfileAction);
@@ -85,7 +101,7 @@ private void UpdateCanCreate()
85101
CanCreate = ActionType != null;
86102
}
87103

88-
public bool CanCreate { get => _canCreate; set { _canCreate = value; OnPropertyChanged(); } }
104+
89105

90106

91107
public void CreateBaseProfileAction(object parameter)

Source/HDRProfile/Profiles/Profile.cs

Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace AutoHDR.Profiles
1414
{
1515
public enum ProfileActionListType
1616
{
17+
None,
1718
Started,
1819
Closed,
1920
GotFocus,
@@ -24,17 +25,32 @@ public enum ProfileActionListType
2425
public class Profile : BaseViewModel, IEquatable<Profile>
2526
{
2627

27-
28+
public static Profile DefaultProfile()
29+
{
30+
Profiles.Profile defaultProfile = new Profiles.Profile();
31+
defaultProfile.Name = "HDR";
32+
Profiles.Actions.DisplayAction startAction = new Profiles.Actions.DisplayAction();
33+
startAction.Display = Displays.Display.AllDisplays;
34+
startAction.SetHDR = true;
35+
startAction.EnableHDR = true;
36+
Profiles.Actions.DisplayAction endAction = new Profiles.Actions.DisplayAction();
37+
endAction.Display = Displays.Display.AllDisplays;
38+
endAction.SetHDR = true;
39+
endAction.EnableHDR = false;
40+
defaultProfile.ApplicationStarted.Add(startAction);
41+
defaultProfile.ApplicationClosed.Add(endAction);
42+
return defaultProfile;
43+
}
44+
2845

2946
public RelayCommand AddStartedActionCommand { get; private set; }
3047
public RelayCommand AddClosedActionCommand { get; private set; }
3148
public RelayCommand AddGotFocusActionCommand { get; private set; }
3249
public RelayCommand AddLostFocusActionCommand { get; private set; }
50+
51+
public RelayCommand<ProfileActionBase> EditProfileActionCommand { get; private set; }
3352
public RelayCommand<ProfileActionBase> RemoveProfileActionCommand { get; private set; }
34-
public RelayCommand<ProfileActionBase> RemoveStartedActionCommand { get; private set; }
35-
public RelayCommand<ProfileActionBase> RemoveClosedActionCommand { get; private set; }
36-
public RelayCommand<ProfileActionBase> RemoveGotFocusActionCommand { get; private set; }
37-
public RelayCommand<ProfileActionBase> RemoveLostFocusActionCommand { get; private set; }
53+
3854

3955

4056
public Profile()
@@ -44,12 +60,8 @@ public Profile()
4460
AddClosedActionCommand = new RelayCommand(() => AddProfileAction(ProfileActionListType.Closed));
4561
AddGotFocusActionCommand = new RelayCommand(() => AddProfileAction(ProfileActionListType.GotFocus));
4662
AddLostFocusActionCommand = new RelayCommand(() => AddProfileAction(ProfileActionListType.LostFocus));
63+
EditProfileActionCommand = new RelayCommand<ProfileActionBase>((pa) => EditProfileAction(pa));
4764
RemoveProfileActionCommand = new RelayCommand<ProfileActionBase>((pa) => RemoveProfileAction(pa));
48-
49-
RemoveStartedActionCommand = new RelayCommand<ProfileActionBase>((pa) => RemoveProfileAction(ProfileActionListType.Started, pa));
50-
RemoveClosedActionCommand = new RelayCommand<ProfileActionBase>((pa) => RemoveProfileAction(ProfileActionListType.Closed, pa));
51-
RemoveGotFocusActionCommand = new RelayCommand<ProfileActionBase>((pa) => RemoveProfileAction(ProfileActionListType.GotFocus, pa));
52-
RemoveLostFocusActionCommand = new RelayCommand<ProfileActionBase>((pa) => RemoveProfileAction(ProfileActionListType.LostFocus, pa));
5365
}
5466

5567
private Guid _guid = Guid.Empty;
@@ -143,6 +155,49 @@ public void AddProfileAction(ProfileActionListType listType)
143155
DialogService.ShowDialogModal(adder, new System.Drawing.Size(800, 600));
144156
}
145157

158+
public void EditProfileAction(ProfileActionBase profileAction)
159+
{
160+
ProfileActionListType listType = GetProfileActionListType(profileAction);
161+
ProfileActionAdder adder = new ProfileActionAdder(profileAction);
162+
163+
adder.DialogService = DialogService;
164+
adder.OKClicked += (o, e) =>
165+
{
166+
RemoveProfileAction(listType, profileAction);
167+
switch (listType)
168+
{
169+
case ProfileActionListType.Started:
170+
ApplicationStarted.Add(adder.ProfileAction);
171+
break;
172+
case ProfileActionListType.Closed:
173+
ApplicationClosed.Add(adder.ProfileAction);
174+
break;
175+
case ProfileActionListType.GotFocus:
176+
ApplicationGotFocus.Add(adder.ProfileAction);
177+
break;
178+
case ProfileActionListType.LostFocus:
179+
ApplicationLostFocus.Add(adder.ProfileAction);
180+
break;
181+
182+
}
183+
};
184+
if (DialogService != null)
185+
DialogService.ShowDialogModal(adder, new System.Drawing.Size(800, 600));
186+
}
187+
188+
private ProfileActionListType GetProfileActionListType(ProfileActionBase profileAction)
189+
{
190+
if (ApplicationStarted.Contains(profileAction))
191+
return ProfileActionListType.Started;
192+
if (ApplicationClosed.Contains(profileAction))
193+
return ProfileActionListType.Closed;
194+
if (ApplicationGotFocus.Contains(profileAction))
195+
return ProfileActionListType.GotFocus;
196+
if (ApplicationLostFocus.Contains(profileAction))
197+
return ProfileActionListType.LostFocus;
198+
return ProfileActionListType.None;
199+
}
200+
146201
public void RemoveProfileAction(ProfileActionBase profileAction)
147202
{
148203
if (ApplicationStarted.Contains(profileAction))

Source/HDRProfile/ProjectResources/Locale_Texts.Designer.cs

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

Source/HDRProfile/ProjectResources/Locale_Texts.de.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@
231231
<data name="DownloadNewestVersion" xml:space="preserve">
232232
<value>Download</value>
233233
</data>
234+
<data name="EditProfileAction" xml:space="preserve">
235+
<value>Editieren</value>
236+
</data>
234237
<data name="Error" xml:space="preserve">
235238
<value>Fehler</value>
236239
</data>
@@ -372,6 +375,9 @@
372375
<data name="Status" xml:space="preserve">
373376
<value>Status</value>
374377
</data>
378+
<data name="String1" xml:space="preserve">
379+
<value />
380+
</data>
375381
<data name="Version" xml:space="preserve">
376382
<value>Version</value>
377383
</data>

Source/HDRProfile/ProjectResources/Locale_Texts.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@
240240
<data name="DownloadNewestVersion" xml:space="preserve">
241241
<value>Download</value>
242242
</data>
243+
<data name="EditProfileAction" xml:space="preserve">
244+
<value>Edit</value>
245+
</data>
243246
<data name="Error" xml:space="preserve">
244247
<value>Error</value>
245248
</data>

0 commit comments

Comments
 (0)