diff --git a/config/appnavigation.json b/config/appnavigation.json index 056af6af..5ccf396b 100644 --- a/config/appnavigation.json +++ b/config/appnavigation.json @@ -73,12 +73,11 @@ "Order": "5", "Description": "Show the selected applications" }, - "WPFToggleFOSSHighlight": { - "Content": "Highlight FOSS", + "WPFInstallFOSSInfo": { + "Content": "Free and Open Source Software", "Category": "__Selection", - "Type": "Toggle", - "Checked": true, - "Order": "6", - "Description": "Toggle the green highlight for FOSS applications" + "Type": "Note", + "Order": "0", + "Description": "Information about the #FOSS label on application entries" } } diff --git a/functions/private/Initialize-InstallAppEntry.ps1 b/functions/private/Initialize-InstallAppEntry.ps1 index 74d72f06..e17b2e7c 100644 --- a/functions/private/Initialize-InstallAppEntry.ps1 +++ b/functions/private/Initialize-InstallAppEntry.ps1 @@ -63,13 +63,14 @@ function Initialize-InstallAppEntry { $appName.Style = $sync.Form.Resources.AppEntryNameStyle $appName.Text = $Apps.$appKey.content - # Change color to Green if FOSS + # Add FOSS label after the name if FOSS if ($Apps.$appKey.foss -eq $true) { - $appName.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "FOSSColor") - $appName.FontWeight = "Bold" - } + $fossRun = [System.Windows.Documents.Run]::new(" $([char]0x25CF)") + $fossRun.Foreground = [Windows.Media.SolidColorBrush]::new([Windows.Media.Color]::FromRgb(110, 255, 114)) + $fossRun.FontSize = 11.5 - # Add the name to the Checkbox + [void]$appName.Inlines.Add($fossRun) + } $checkBox.Content = $appName # Add accessibility properties to make the elements screen reader friendly diff --git a/functions/private/Invoke-WinutilThemeChange.ps1 b/functions/private/Invoke-WinutilThemeChange.ps1 index c85e5c90..466358d5 100644 --- a/functions/private/Invoke-WinutilThemeChange.ps1 +++ b/functions/private/Invoke-WinutilThemeChange.ps1 @@ -150,18 +150,6 @@ function Invoke-WinutilThemeChange { } } - # Set FOSS Highlight Color - $fossEnabled = $true - if ($sync.WPFToggleFOSSHighlight) { - $fossEnabled = $sync.WPFToggleFOSSHighlight.IsChecked - } - - if ($fossEnabled) { - $sync.Form.Resources["FOSSColor"] = [Windows.Media.SolidColorBrush]::new([Windows.Media.Color]::FromRgb(76, 175, 80)) # #4CAF50 - } else { - $sync.Form.Resources["FOSSColor"] = $sync.Form.Resources["MainForegroundColor"] - } - # Update the theme selector button with the appropriate icon $ThemeButton = $sync.Form.FindName("ThemeButton") $ThemeButton.Content = [string]$themeButtonIcon diff --git a/functions/public/Invoke-WPFButton.ps1 b/functions/public/Invoke-WPFButton.ps1 index f7419f64..2c51624d 100644 --- a/functions/public/Invoke-WPFButton.ps1 +++ b/functions/public/Invoke-WPFButton.ps1 @@ -68,12 +68,5 @@ function Invoke-WPFButton { "WPFCloseButton" {$sync.Form.Close(); Write-Host "Bye bye!"} "WPFMinimizeButton" {$sync.Form.WindowState = [Windows.WindowState]::Minimized} "WPFselectedAppsButton" {$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen} - "WPFToggleFOSSHighlight" { - if ($sync.WPFToggleFOSSHighlight.IsChecked) { - $sync.Form.Resources["FOSSColor"] = [Windows.Media.SolidColorBrush]::new([Windows.Media.Color]::FromRgb(76, 175, 80)) # #4CAF50 - } else { - $sync.Form.Resources["FOSSColor"] = $sync.Form.Resources["MainForegroundColor"] - } - } } } diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1 index df85084b..b6badfb3 100644 --- a/functions/public/Invoke-WPFUIElements.ps1 +++ b/functions/public/Invoke-WPFUIElements.ps1 @@ -177,38 +177,25 @@ function Invoke-WPFUIElements { $itemsControl.Items.Add($dockPanel) | Out-Null $sync[$entryInfo.Name] = $checkBox - if ($entryInfo.Name -eq "WPFToggleFOSSHighlight") { - if ($entryInfo.Checked -eq $true) { - $sync[$entryInfo.Name].IsChecked = $true - } + $sync[$entryInfo.Name].IsChecked = (Get-WinUtilToggleStatus $entryInfo.Name) - $sync[$entryInfo.Name].Add_Checked({ - Invoke-WPFButton -Button "WPFToggleFOSSHighlight" - }) - $sync[$entryInfo.Name].Add_Unchecked({ - Invoke-WPFButton -Button "WPFToggleFOSSHighlight" - }) - } else { - $sync[$entryInfo.Name].IsChecked = (Get-WinUtilToggleStatus $entryInfo.Name) + $sync[$entryInfo.Name].Add_Checked({ + [System.Object]$Sender = $args[0] + Invoke-WPFSelectedCheckboxesUpdate -type "Add" -checkboxName $Sender.name + # Skip applying tweaks while an import is restoring toggle states + if (-not $sync.ImportInProgress) { + Invoke-WinUtilTweaks $Sender.name + } + }) - $sync[$entryInfo.Name].Add_Checked({ - [System.Object]$Sender = $args[0] - Invoke-WPFSelectedCheckboxesUpdate -type "Add" -checkboxName $Sender.name - # Skip applying tweaks while an import is restoring toggle states - if (-not $sync.ImportInProgress) { - Invoke-WinUtilTweaks $Sender.name - } - }) - - $sync[$entryInfo.Name].Add_Unchecked({ - [System.Object]$Sender = $args[0] - Invoke-WPFSelectedCheckboxesUpdate -type "Remove" -checkboxName $Sender.name - # Skip undoing tweaks while an import is restoring toggle states - if (-not $sync.ImportInProgress) { - Invoke-WinUtiltweaks $Sender.name -undo $true - } - }) - } + $sync[$entryInfo.Name].Add_Unchecked({ + [System.Object]$Sender = $args[0] + Invoke-WPFSelectedCheckboxesUpdate -type "Remove" -checkboxName $Sender.name + # Skip undoing tweaks while an import is restoring toggle states + if (-not $sync.ImportInProgress) { + Invoke-WinUtiltweaks $Sender.name -undo $true + } + }) } "ToggleButton" { @@ -346,6 +333,28 @@ function Invoke-WPFUIElements { $sync[$entryInfo.Name] = $radioButton } + "Note" { + $textBlock = New-Object Windows.Controls.TextBlock + $textBlock.TextWrapping = "Wrap" + $textBlock.Margin = "5,5,5,5" + $textBlock.UseLayoutRounding = $true + + $bulletRun = New-Object Windows.Documents.Run + $bulletRun.Text = [char]0x25CF + $bulletRun.Foreground = [Windows.Media.SolidColorBrush]::new([Windows.Media.Color]::FromRgb(110, 255, 114)) + $bulletRun.FontSize = 11.5 + + $textRun = New-Object Windows.Documents.Run + $textRun.Text = " $($entryInfo.Content)" + $textRun.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSize") + $textRun.Foreground = [Windows.Media.SolidColorBrush]::new([Windows.Media.Color]::FromRgb(19, 143, 83)) + + $textBlock.Inlines.Add($bulletRun) + $textBlock.Inlines.Add($textRun) + + $itemsControl.Items.Add($textBlock) | Out-Null + } + default { $horizontalStackPanel = New-Object Windows.Controls.StackPanel $horizontalStackPanel.Orientation = "Horizontal"