From 6b73f71876c266fecc393723f844ef450fb13cc1 Mon Sep 17 00:00:00 2001 From: "Mr.k" Date: Mon, 8 Jul 2024 22:59:58 +0300 Subject: [PATCH] [01] Refactoring UI code (#2274) * Update Documentation for 'Get-TabXaml' Function * Add More checks for Passed Parameters for 'Get-TabXaml' Function & A One Line change * Make 'Get-TabXaml' Function do Proper Indentation to the Generated XML String & Add more Theming Options * Re-formatting for a few lines in 'Get-TabXaml' Function * Improve UI a bit * Fix Buttons for Config Tab * Add optional 'ButtonWidth' Field to Config Json Files that use 'Button' Type * Simple Code Formatting in 'inputXML.xaml' File * Make naming More Clear to the Developers Rename the name of an element from 'CheckboxFilterClear' to 'SearchBarClearButton' and renamed style from 'ClearButtonStyle' to 'SearchBarClearButtonStyle' * Rename 'FontFamilyHeading' to 'HeaderFontFamily' to match conventions & Make new Theming Property called 'SearchBarClearButtonFontSize' * Remove Un-necessary 'ToString' Convertion in 'Get-TabXaml' Function * Make naming More Clear to the Developers again Rename the name of an element from 'CheckboxFilter' to 'SearchBar'.. although after some realization.. the naming might make sense at first, because it filters only the checkboxes.. but CheckBoxFilter is less "Intutive" when saying it compared to "SearchBar".. _This's my own opinion, and it can reverted easily with git if needed._ * Remove Un-necessary Attributes in 'Get-TabXaml' Private Function * Improve UI a bit * Improve UI a bit * Re-order some tweaks & Update their Content Fields to be more descriptive * Remove the changing 'Off' & 'On' TextBlock next to Toggle Button/Checkbox Removed it as it only takes up space in the right side of the Toggle Button/Checkbox, as well as making it difficult to correctly align it when change from/to 'On' & 'Off' Text, * Some changes to the Generated Toggle Button/Checkbox in 'Get-TabXaml' Private Function Increase the Side Margins of Toggle Button/Checkbox, as well as Change its side to be on the Left hand-side of the Label, rather then the Right hand-side. --- config/feature.json | 42 +++-- config/themes.json | 231 ++++++++++++++++++------ config/tweaks.json | 149 +++++++-------- functions/private/Get-TabXaml.ps1 | 160 ++++++++++++---- functions/private/Show-CustomDialog.ps1 | 22 ++- scripts/main.ps1 | 46 +++-- xaml/inputXML.xaml | 167 +++++++++-------- 7 files changed, 533 insertions(+), 284 deletions(-) diff --git a/config/feature.json b/config/feature.json index d2f5a161..bd66859a 100644 --- a/config/feature.json +++ b/config/feature.json @@ -184,90 +184,104 @@ "category": "Features", "panel": "1", "Order": "a060_", - "Type": "150" + "Type": "Button", + "ButtonWidth": "300" }, "WPFPanelAutologin": { "Content": "Set Up Autologin", "category": "Fixes", "Order": "a040_", "panel": "1", - "Type": "300" + "Type": "Button", + "ButtonWidth": "300" }, "WPFFixesUpdate": { "Content": "Reset Windows Update", "category": "Fixes", "panel": "1", "Order": "a041_", - "Type": "300" + "Type": "Button", + "ButtonWidth": "300" }, "WPFFixesNetwork": { "Content": "Reset Network", "category": "Fixes", "Order": "a042_", "panel": "1", - "Type": "300" + "Type": "Button", + "ButtonWidth": "300" }, "WPFPanelDISM": { "Content": "System Corruption Scan", "category": "Fixes", "panel": "1", "Order": "a043_", - "Type": "300" + "Type": "Button", + "ButtonWidth": "300" }, "WPFFixesWinget": { "Content": "WinGet Reinstall", "category": "Fixes", "panel": "1", "Order": "a044_", - "Type": "300" + "Type": "Button", + "ButtonWidth": "300" }, "WPFRunAdobeCCCleanerTool": { "Content": "Remove Adobe Creative Cloud", "category": "Fixes", "panel": "1", "Order": "a045_", - "Type": "300" + "Type": "Button", + "ButtonWidth": "300" }, "WPFPanelnetwork": { "Content": "Network Connections", "category": "Legacy Windows Panels", "panel": "2", - "Type": "200" + "Type": "Button", + "ButtonWidth": "300" }, "WPFPanelcontrol": { "Content": "Control Panel", "category": "Legacy Windows Panels", "panel": "2", - "Type": "200" + "Type": "Button", + "ButtonWidth": "300" }, "WPFPanelpower": { "Content": "Power Panel", "category": "Legacy Windows Panels", "panel": "2", - "Type": "200" + "Type": "Button", + "ButtonWidth": "300" }, "WPFPanelregion": { "Content": "Region", "category": "Legacy Windows Panels", "panel": "2", - "Type": "200" + "Type": "Button", + "ButtonWidth": "300" }, "WPFPanelsound": { "Content": "Sound Settings", "category": "Legacy Windows Panels", "panel": "2", - "Type": "200" + "Type": "Button", + "ButtonWidth": "300" }, "WPFPanelsystem": { "Content": "System Properties", "category": "Legacy Windows Panels", "panel": "2", - "Type": "200" + "Type": "Button", + "ButtonWidth": "300" }, "WPFPaneluser": { "Content": "User Accounts", "category": "Legacy Windows Panels", "panel": "2", - "Type": "200" + "Type": "Button", + "ButtonWidth": "300" } } diff --git a/config/themes.json b/config/themes.json index 7500bb87..4bc3766b 100644 --- a/config/themes.json +++ b/config/themes.json @@ -1,5 +1,30 @@ { "Classic": { + "CustomDialogFontSize": "12", + "CustomDialogFontSizeHeader": "14", + "CustomDialogIconSize": "25", + "CustomDialogWidth": "400", + "CustomDialogHeight": "200", + + "FontSize": "12", + "FontFamily": "Arial", + "FontSizeHeading": "14", + "HeaderFontFamily": "Consolas, Monaco", + + "CheckBoxBulletDecoratorFontSize": "14", + "CheckBoxMargin": "15,0,0,2", + + "TabButtonFontSize": "14", + "TabButtonWidth": "100", + "TabButtonHeight": "25", + "TabRowHeightInPixels": "50", + "IconFontSize": "14", + "IconButtonSize": "35", + "WinUtilIconSize": "Auto", + "SettingsIconFontSize": "18", + + "MicroWinLogoSize": "10", + "ComboBoxBackgroundColor": "#FFFFFF", "LabelboxForegroundColor": "#000000", "MainForegroundColor": "#000000", @@ -9,6 +34,18 @@ "LinkHoverForegroundColor": "#000000", "GroupBorderBackgroundColor": "#000000", "ComboBoxForegroundColor": "#000000", + + "ButtonFontSize": "12", + "ButtonFontFamily": "Arial", + "ButtonWidth": "200", + "ButtonHeight": "25", + "ConfigTabButtonFontSize": "16", + + "SearchBarWidth": "200", + "SearchBarHeight": "25", + "SearchBarTextBoxFontSize": "16", + "SearchBarClearButtonFontSize": "14", + "ButtonInstallBackgroundColor": "#FFFFFF", "ButtonTweaksBackgroundColor": "#FFFFFF", "ButtonConfigBackgroundColor": "#FFFFFF", @@ -24,74 +61,148 @@ "ButtonBackgroundSelectedColor": "#F0F0F0", "ButtonForegroundColor": "#000000", "ToggleButtonOnColor": "#2e77ff", + "ButtonBorderThickness": "1", "ButtonMargin": "1", "ButtonCornerRadius": "2", - "ToggleButtonHeight": "25", "BorderColor": "#000000", "BorderOpacity": "0.2", "ShadowPulse": "Forever" }, "Matrix": { - "ComboBoxBackgroundColor": "#000000", - "LabelboxForegroundColor": "#FFEE58", - "MainForegroundColor": "#9CCC65", - "MainBackgroundColor": "#000000", - "LabelBackgroundColor": "#000000", - "LinkForegroundColor": "#add8e6", - "LinkHoverForegroundColor": "#FFFFFF", - "ComboBoxForegroundColor": "#FFEE58", - "ButtonInstallBackgroundColor": "#222222", - "ButtonTweaksBackgroundColor": "#333333", - "ButtonConfigBackgroundColor": "#444444", - "ButtonUpdatesBackgroundColor": "#555555", - "ButtonInstallForegroundColor": "#FFFFFF", - "ButtonTweaksForegroundColor": "#FFFFFF", - "ButtonConfigForegroundColor": "#FFFFFF", - "ButtonUpdatesForegroundColor": "#FFFFFF", - "ButtonBackgroundColor": "#000019", - "ButtonBackgroundPressedColor": "#FFFFFF", - "ButtonBackgroundMouseoverColor": "#A55A64", - "ButtonBackgroundSelectedColor": "#FF5733", - "ButtonForegroundColor": "#9CCC65", - "ToggleButtonOnColor": "#2e77ff", - "ButtonBorderThickness": "1", - "ButtonMargin": "1", - "ButtonCornerRadius": "2", - "ToggleButtonHeight": "25", - "BorderColor": "#FFAC1C", - "BorderOpacity": "0.8", - "ShadowPulse": "0:0:3" + "CustomDialogFontSize": "12", + "CustomDialogFontSizeHeader": "14", + "CustomDialogIconSize": "25", + "CustomDialogWidth": "400", + "CustomDialogHeight": "200", + + "FontSize": "12", + "FontFamily": "Arial", + "FontSizeHeading": "14", + "HeaderFontFamily": "Consolas, Monaco", + + "CheckBoxBulletDecoratorFontSize": "14", + "CheckBoxMargin": "15,0,0,2", + + "TabButtonFontSize": "14", + "TabButtonWidth": "100", + "TabButtonHeight": "25", + "TabRowHeightInPixels": "50", + "IconFontSize": "14", + "IconButtonSize": "35", + "WinUtilIconSize": "Auto", + "SettingsIconFontSize": "18", + + "MicroWinLogoSize": "10", + + "ComboBoxBackgroundColor": "#000000", + "LabelboxForegroundColor": "#FFEE58", + "MainForegroundColor": "#9CCC65", + "MainBackgroundColor": "#000000", + "LabelBackgroundColor": "#000000", + "LinkForegroundColor": "#add8e6", + "LinkHoverForegroundColor": "#FFFFFF", + "ComboBoxForegroundColor": "#FFEE58", + + "ButtonFontSize": "12", + "ButtonFontFamily": "Arial", + "ButtonWidth": "200", + "ButtonHeight": "25", + "ConfigTabButtonFontSize": "16", + + "SearchBarWidth": "200", + "SearchBarHeight": "25", + "SearchBarTextBoxFontSize": "16", + "SearchBarClearButtonFontSize": "14", + + "ButtonInstallBackgroundColor": "#222222", + "ButtonTweaksBackgroundColor": "#333333", + "ButtonConfigBackgroundColor": "#444444", + "ButtonUpdatesBackgroundColor": "#555555", + "ButtonInstallForegroundColor": "#FFFFFF", + "ButtonTweaksForegroundColor": "#FFFFFF", + "ButtonConfigForegroundColor": "#FFFFFF", + "ButtonUpdatesForegroundColor": "#FFFFFF", + "ButtonBackgroundColor": "#000019", + "ButtonBackgroundPressedColor": "#FFFFFF", + "ButtonBackgroundMouseoverColor": "#A55A64", + "ButtonBackgroundSelectedColor": "#FF5733", + "ButtonForegroundColor": "#9CCC65", + "ToggleButtonOnColor": "#2e77ff", + + "ButtonBorderThickness": "1", + "ButtonMargin": "1", + "ButtonCornerRadius": "2", + "BorderColor": "#FFAC1C", + "BorderOpacity": "0.8", + "ShadowPulse": "0:0:3" }, "Dark": { - "ComboBoxBackgroundColor": "#000000", - "LabelboxForegroundColor": "#FFEE58", - "MainForegroundColor": "#9CCC65", - "MainBackgroundColor": "#000000", - "LabelBackgroundColor": "#000000", - "LinkForegroundColor": "#add8e6", - "LinkHoverForegroundColor": "#FFFFFF", - "ComboBoxForegroundColor": "#FFEE58", - "ButtonInstallBackgroundColor": "#222222", - "ButtonTweaksBackgroundColor": "#333333", - "ButtonConfigBackgroundColor": "#444444", - "ButtonUpdatesBackgroundColor": "#555555", - "ButtonInstallForegroundColor": "#FFFFFF", - "ButtonTweaksForegroundColor": "#FFFFFF", - "ButtonConfigForegroundColor": "#FFFFFF", - "ButtonUpdatesForegroundColor": "#FFFFFF", - "ButtonBackgroundColor": "#000019", - "ButtonBackgroundPressedColor": "#9CCC65", - "ButtonBackgroundMouseoverColor": "#FF5733", - "ButtonBackgroundSelectedColor": "#FF5733", - "ButtonForegroundColor": "#9CCC65", - "ToggleButtonOnColor": "#2e77ff", - "ButtonBorderThickness": "1", - "ButtonMargin": "1", - "ButtonCornerRadius": "2", - "ToggleButtonHeight": "25", - "BorderColor": "#FFAC1C", - "BorderOpacity": "0.2", - "ShadowPulse": "Forever" + "CustomDialogFontSize": "12", + "CustomDialogFontSizeHeader": "14", + "CustomDialogIconSize": "25", + "CustomDialogWidth": "400", + "CustomDialogHeight": "200", + + "FontSize": "12", + "FontFamily": "Arial", + "FontSizeHeading": "14", + "HeaderFontFamily": "Consolas, Monaco", + + "CheckBoxBulletDecoratorFontSize": "14", + "CheckBoxMargin": "15,0,0,2", + + "TabButtonFontSize": "14", + "TabButtonWidth": "100", + "TabButtonHeight": "25", + "TabRowHeightInPixels": "50", + "IconFontSize": "14", + "IconButtonSize": "35", + "WinUtilIconSize": "Auto", + "SettingsIconFontSize": "18", + + "MicroWinLogoSize": "10", + + "ComboBoxBackgroundColor": "#000000", + "LabelboxForegroundColor": "#FFEE58", + "MainForegroundColor": "#9CCC65", + "MainBackgroundColor": "#000000", + "LabelBackgroundColor": "#000000", + "LinkForegroundColor": "#add8e6", + "LinkHoverForegroundColor": "#FFFFFF", + "ComboBoxForegroundColor": "#FFEE58", + + "ButtonFontSize": "12", + "ButtonFontFamily": "Arial", + "ButtonWidth": "200", + "ButtonHeight": "25", + "ConfigTabButtonFontSize": "16", + + "SearchBarWidth": "200", + "SearchBarHeight": "25", + "SearchBarTextBoxFontSize": "16", + "SearchBarClearButtonFontSize": "14", + + "ButtonInstallBackgroundColor": "#222222", + "ButtonTweaksBackgroundColor": "#333333", + "ButtonConfigBackgroundColor": "#444444", + "ButtonUpdatesBackgroundColor": "#555555", + "ButtonInstallForegroundColor": "#FFFFFF", + "ButtonTweaksForegroundColor": "#FFFFFF", + "ButtonConfigForegroundColor": "#FFFFFF", + "ButtonUpdatesForegroundColor": "#FFFFFF", + "ButtonBackgroundColor": "#000019", + "ButtonBackgroundPressedColor": "#9CCC65", + "ButtonBackgroundMouseoverColor": "#FF5733", + "ButtonBackgroundSelectedColor": "#FF5733", + "ButtonForegroundColor": "#9CCC65", + "ToggleButtonOnColor": "#2e77ff", + + "ButtonBorderThickness": "1", + "ButtonMargin": "1", + "ButtonCornerRadius": "2", + "BorderColor": "#FFAC1C", + "BorderOpacity": "0.2", + "ShadowPulse": "Forever" } -} \ No newline at end of file +} diff --git a/config/tweaks.json b/config/tweaks.json index 637aa9dc..125c0c62 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -2983,35 +2983,75 @@ ] }, "WPFToggleDarkMode": { - "Content": "Dark Theme", + "Content": "Enable Dark Theme for Windows", "Description": "Enable/Disable Dark Mode.", "category": "Customize Preferences", "panel": "2", - "Order": "a060_", + "Order": "a100_", "Type": "Toggle" }, "WPFToggleBingSearch": { - "Content": "Bing Search in Start Menu", + "Content": "Enable Bing Search in Start Menu", "Description": "If enable then includes web search results from Bing in your Start Menu search.", "category": "Customize Preferences", "panel": "2", - "Order": "a061_", + "Order": "a101_", "Type": "Toggle" }, "WPFToggleNumLock": { - "Content": "NumLock on Startup", + "Content": "Enable NumLock on Startup", "Description": "Toggle the Num Lock key state when your computer starts.", "category": "Customize Preferences", "panel": "2", - "Order": "a062_", + "Order": "a102_", "Type": "Toggle" }, "WPFToggleVerboseLogon": { - "Content": "Verbose Logon Messages", + "Content": "Enable Verbose Messages During Logon", "Description": "Show detailed messages during the login process for troubleshooting and diagnostics.", "category": "Customize Preferences", "panel": "2", - "Order": "a063_", + "Order": "a103_", + "Type": "Toggle" + }, + "WPFToggleSnapWindow": { + "Content": "Enable Snap Window", + "Description": "If enabled you can align windows by dragging them. | Relogin Required", + "category": "Customize Preferences", + "panel": "2", + "Order": "a104_", + "Type": "Toggle" + }, + "WPFToggleSnapFlyout": { + "Content": "Enable Snap Assist Flyout", + "Description": "If enabled then Snap preview is disabled when maximize button is hovered.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a105_", + "Type": "Toggle" + }, + "WPFToggleSnapSuggestion": { + "Content": "Enable Snap Assist Suggestion", + "Description": "If enabled then you will get suggestions to snap other applications in the left over spaces.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a106_", + "Type": "Toggle" + }, + "WPFToggleMouseAcceleration": { + "Content": "Enable Mouse Acceleration", + "Description": "If Enabled then Cursor movement is affected by the speed of your physical mouse movements.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a107_", + "Type": "Toggle" + }, + "WPFToggleStickyKeys": { + "Content": "Enable Sticky Keys", + "Description": "If Enabled then Sticky Keys is activated - Sticky keys is an accessibility feature of some graphical user interfaces which assists users who have physical disabilities or help users reduce repetitive strain injury.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a108_", "Type": "Toggle" }, "WPFToggleShowExt": { @@ -3019,55 +3059,31 @@ "Description": "If enabled then File extensions (e.g., .txt, .jpg) are visible.", "category": "Customize Preferences", "panel": "2", - "Order": "a064_", - "Type": "Toggle" - }, - "WPFToggleSnapWindow": { - "Content": "Snap Window", - "Description": "If enabled you can align windows by dragging them. | Relogin Required", - "category": "Customize Preferences", - "panel": "2", - "Order": "a065_", - "Type": "Toggle" - }, - "WPFToggleSnapFlyout": { - "Content": "Snap Assist Flyout", - "Description": "If enabled then Snap preview is disabled when maximize button is hovered.", - "category": "Customize Preferences", - "panel": "2", - "Order": "a066_", - "Type": "Toggle" - }, - "WPFToggleSnapSuggestion": { - "Content": "Snap Assist Suggestion", - "Description": "If enabled then you will get suggestions to snap other applications in the left over spaces.", - "category": "Customize Preferences", - "panel": "2", - "Order": "a067_", - "Type": "Toggle" - }, - "WPFToggleMouseAcceleration": { - "Content": "Mouse Acceleration", - "Description": "If Enabled then Cursor movement is affected by the speed of your physical mouse movements.", - "category": "Customize Preferences", - "panel": "2", - "Order": "a068_", - "Type": "Toggle" - }, - "WPFToggleStickyKeys": { - "Content": "Sticky Keys", - "Description": "If Enabled then Sticky Keys is activated - Sticky keys is an accessibility feature of some graphical user interfaces which assists users who have physical disabilities or help users reduce repetitive strain injury.", - "category": "Customize Preferences", - "panel": "2", - "Order": "a070_", + "Order": "a200_", "Type": "Toggle" }, "WPFToggleTaskbarSearch": { - "Content": "Taskbar Search", + "Content": "Show Search Button in Taskbar", "Description": "If Enabled Search Button will be on the taskbar.", "category": "Customize Preferences", "panel": "2", - "Order": "a068_", + "Order": "a201_", + "Type": "Toggle" + }, + "WPFToggleTaskView": { + "Content": "Show Task View Button in Taskbar", + "Description": "If Enabled then Task View Button in Taskbar will be shown.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a202_", + "Type": "Toggle" + }, + "WPFToggleTaskbarWidgets": { + "Content": "Show Widgets Button in Taskbar", + "Description": "If Enabled then Widgets Button in Taskbar will be shown.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a203_", "Type": "Toggle" }, "WPFOOSUbutton": { @@ -3075,15 +3091,7 @@ "category": "z__Advanced Tweaks - CAUTION", "panel": "1", "Order": "a039_", - "Type": "220" - }, - "WPFToggleTaskbarWidgets": { - "Content": "Taskbar Widgets", - "Description": "If Enabled then Widgets Icon in Taskbar will be shown.", - "category": "Customize Preferences", - "panel": "2", - "Order": "a069_", - "Type": "Toggle" + "Type": "Button" }, "WPFchangedns": { "Content": "DNS", @@ -3098,42 +3106,37 @@ "category": "z__Advanced Tweaks - CAUTION", "panel": "1", "Order": "a041_", - "Type": "160" + "Type": "Button" }, "WPFUndoall": { "Content": "Undo Selected Tweaks", "category": "z__Advanced Tweaks - CAUTION", "panel": "1", "Order": "a042_", - "Type": "160" + "Type": "Button" }, "WPFAddUltPerf": { "Content": "Add and Activate Ultimate Performance Profile", "category": "Performance Plans", "panel": "2", "Order": "a080_", - "Type": "300" + "Type": "Button", + "ButtonWidth": "300" }, "WPFRemoveUltPerf": { "Content": "Remove Ultimate Performance Profile", "category": "Performance Plans", "panel": "2", "Order": "a081_", - "Type": "300" + "Type": "Button", + "ButtonWidth": "300" }, "WPFWinUtilShortcut": { "Content": "Create WinUtil Shortcut", "category": "Shortcuts", "panel": "2", "Order": "a082_", - "Type": "300" - }, - "WPFToggleTaskView": { - "Content": "Task View", - "Description": "If Enabled then Task View Icon in Taskbar will be shown.", - "category": "Customize Preferences", - "panel": "2", - "Order": "a069_", - "Type": "Toggle" + "Type": "Button", + "ButtonWidth": "300" } } diff --git a/functions/private/Get-TabXaml.ps1 b/functions/private/Get-TabXaml.ps1 index ea6d69f5..231af7af 100644 --- a/functions/private/Get-TabXaml.ps1 +++ b/functions/private/Get-TabXaml.ps1 @@ -6,8 +6,10 @@ function Get-TabXaml { It takes the tabname and the number of columns to display the applications in as input and returns the XAML for the tab as output .PARAMETER tabname The name of the tab to generate XAML for + Note: the 'tabname' parameter must equal one of the json files found in $sync.configs variable + Otherwise, it'll throw an exception .PARAMETER columncount - The number of columns to display the applications in + The number of columns to display the applications in, default is 0 .OUTPUTS The XAML for the tab .EXAMPLE @@ -15,10 +17,20 @@ function Get-TabXaml { #> - param( [Parameter(Mandatory=$true)] - $tabname, - $columncount = 0 + param( + [Parameter(Mandatory, position=0)] + [string]$tabname, + + [Parameter(position=1)] + [ValidateRange(0,10)] # 10 panels as max number is more then enough + [int]$columncount = 0 ) + + # Validate tabname + if ($sync.configs.$tabname -eq $null) { + throw "Invalid parameter passed, can't find '$tabname' in '`$sync.configs' variable, please double check any calls to 'Get-TabXaml' function." + } + $organizedData = @{} # Iterate through JSON data and organize by panel and category foreach ($appName in $sync.configs.$tabname.PSObject.Properties.Name) { @@ -39,6 +51,7 @@ function Get-TabXaml { ComboItems = $appInfo.ComboItems # Checked is the property to set startup checked status of checkbox (Default is false) Checked = $appInfo.Checked + ButtonWidth = $appInfo.ButtonWidth } if (-not $organizedData.ContainsKey($appObject.panel)) { @@ -53,7 +66,22 @@ function Get-TabXaml { # Add Order property to keep the original order of tweaks and features $organizedData[$appObject.panel][$appInfo.Category]["$($appInfo.order)$appName"] = $appObject } - $panelcount=0 + + # Same tab amount in last line of 'inputXML.xaml' file + # TODO: Get the base repeat (amount) of tabs from last line (or even lines) + # so it can dynamicly react to whatever is before this generated XML string. + # .. may be solve this even before calling this function, and pass the result as a parameter? + $tab_repeat = 7 + $spaces_per_tab = 4 # The convenction used across the code base + $tab_as_spaces = $(" " * $spaces_per_tab) + $precal_indent = $($tab_as_spaces * $tab_repeat) + $precal_indent_p1 = $($tab_as_spaces * ($tab_repeat + 1)) + $precal_indent_p2 = $($tab_as_spaces * ($tab_repeat + 2)) + $precal_indent_m1 = $($tab_as_spaces * ($tab_repeat - 1)) + $precal_indent_m2 = $($tab_as_spaces * ($tab_repeat - 2)) + + # Calculate the needed number of panels + $panelcount = 0 $paneltotal = $organizedData.Keys.Count if ($columncount -gt 0) { $appcount = $sync.configs.$tabname.PSObject.Properties.Name.count + $organizedData["0"].Keys.count @@ -61,19 +89,27 @@ function Get-TabXaml { $paneltotal = $columncount } # add ColumnDefinitions to evenly draw colums - $blockXml="`r`n"+("`r`n"*($paneltotal))+"`r`n" - # Iterate through organizedData by panel, category, and application + $blockXml = "" + $blockXml += $("`r`n" + " " * ($spaces_per_tab * $tab_repeat) + + "") * $paneltotal + $blockXml += $("`r`n" + " " * ($spaces_per_tab * ($tab_repeat - 1))) + + "" + "`r`n" + + # Iterate through 'organizedData' by panel, category, and application $count = 0 foreach ($panel in ($organizedData.Keys | Sort-Object)) { - $blockXml += "`r`n`r`n" + $blockXml += $precal_indent_m1 + "" + "`r`n" + $blockXml += $precal_indent + "" + "`r`n" $panelcount++ foreach ($category in ($organizedData[$panel].Keys | Sort-Object)) { $count++ if ($columncount -gt 0) { $panelcount2 = [Int](($count)/$maxcount-0.5) if ($panelcount -eq $panelcount2 ) { - $blockXml +="`r`n`r`n`r`n" - $blockXml += "`r`n`r`n" + $blockXml += $precal_indent_p2 + "" + "`r`n" + $blockXml += $precal_indent_p1 + "" + "`r`n" + $blockXml += $precal_indent_p1 + "" + "`r`n" + $blockXml += $precal_indent_p2 + "" + "`r`n" $panelcount++ } } @@ -83,49 +119,99 @@ function Get-TabXaml { $categorycontent = $($category -replace '^.__', '') $categoryname = Get-WPFObjectName -type "Label" -name $categorycontent - $blockXml += "`r`n`r`n" - $blockXml += "`r`n`r`n" + $blockXml += $precal_indent_m1 + + "" + "`r`n" + $blockXml += $precal_indent_m2 + + "" + "`r`n" + $blockXml += $precal_indent_m2 + + "" + "`r`n" + $blockXml += $precal_indent_m1 + + "" + "`r`n" $panelcount++ } } + $appInfo = $organizedData[$panel][$category][$appName] - if ("Toggle" -eq $appInfo.Type) { - $blockXml += "`r`n`r`n" - } elseif ("Combobox" -eq $appInfo.Type) { - $blockXml += "`r`n" - # If it is a digit, type is button and button length is digits - } elseif ($appInfo.Type -match "^[\d\.]+$") { - $blockXml += "