1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2025-02-21 21:00:21 +01:00

GUI: Added support for hiding pages and page contents

Adds 2 new tags in the settings file that define the start and end of a
logical section, in order to enable the possibility of hiding parts of
the UI based on the current value of some setting:

    ;s Taskbar_Windows10Section IsOldTaskbar <- SECTION BEGIN
    ;g Taskbar_Windows10Section <- SECTION END

For s, the parameters represent these:

* Taskbar_Windows10Section = name of the current section
* IsOldTaskbar = if the check associated with this name (function call)
  returns FALSE, the section will not be displayed on the screen; that
  is, the code will skip drawing whatever is inside the 2 tags
This commit is contained in:
Valentin Radu 2022-05-26 11:23:01 +03:00
parent d0ad8bd1e3
commit 7649805e18
2 changed files with 61 additions and 13 deletions

View File

@ -1058,6 +1058,38 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
{ {
bWasSpecifiedSectionValid = TRUE; bWasSpecifiedSectionValid = TRUE;
} }
if (!strncmp(line, ";g ", 3))
{
continue;
}
if (!strncmp(line, ";s ", 3))
{
if (_this->bCalcExtent) continue;
char* funcName = strchr(line + 3, ' ');
funcName[0] = 0;
char* skipToName = line + 3;
funcName++;
strchr(funcName, '\r')[0] = 0;
BOOL bSkipLines = FALSE;
DWORD dwRes = 0, dwSize = sizeof(DWORD);
if (!_stricmp(funcName, "DoesOSBuildSupportSpotlight") && !DoesOSBuildSupportSpotlight()) bSkipLines = TRUE;
else if (!_stricmp(funcName, "IsSpotlightEnabled") && !IsSpotlightEnabled()) bSkipLines = TRUE;
else if (!_stricmp(funcName, "IsSWSEnabled") && (RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer", L"AltTabSettings", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes != 2))) bSkipLines = TRUE;
else if (!_stricmp(funcName, "IsOldTaskbar") && (RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L"OldTaskbar", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes != 1))) bSkipLines = TRUE;
else if (!_stricmp(funcName, "!IsOldTaskbar") && (RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L"OldTaskbar", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes == 1))) bSkipLines = TRUE;
else if (!_stricmp(funcName, "IsWindows10StartMenu") && (RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", L"Start_ShowClassicMode", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes != 1))) bSkipLines = TRUE;
else if (!_stricmp(funcName, "!IsWindows10StartMenu") && (RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", L"Start_ShowClassicMode", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes == 1))) bSkipLines = TRUE;
else if (!_stricmp(funcName, "IsWeatherEnabled") && (RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\People", L"PeopleBand", RRF_RT_DWORD, NULL, &dwRes, &dwSize), (dwRes != 1))) bSkipLines = TRUE;
if (bSkipLines)
{
do
{
getline(&text, &bufsiz, f);
strchr(text, '\r')[0] = 0;
} while (strncmp(text, ";g ", 3) || _stricmp((char*)text + 3, skipToName));
}
continue;
}
if (!strncmp(line, ";q", 2)) if (!strncmp(line, ";q", 2))
{ {
bResetLastHeading = TRUE; bResetLastHeading = TRUE;

View File

@ -10,7 +10,7 @@
;x 0 Windows 11 (default) ;x 0 Windows 11 (default)
;x 1 Windows 10 ;x 1 Windows 10
"OldTaskbar"=dword:00000001 "OldTaskbar"=dword:00000001
;y More taskbar options in the Settings app 🡕 ;y More taskbar options in the Settings app 🡕
;ms-settings:taskbar ;ms-settings:taskbar
;y Customize notification area icons 🡕 ;y Customize notification area icons 🡕
;shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9} ;shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}
@ -47,7 +47,7 @@
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Automatically hide the taskbar ;b Automatically hide the taskbar
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_AutoHideTaskbar"=dword:00000000 ;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_AutoHideTaskbar"=dword:00000000
;t The following settings only apply to the Windows 10 taskbar: ;s Taskbar_Windows10Section IsOldTaskbar
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 2 Start button style ;c 2 Start button style
;x 0 Windows 10 (default) ;x 0 Windows 10 (default)
@ -83,6 +83,8 @@
;x 0 Large (default) ;x 0 Large (default)
"TaskbarSmallIcons"=dword:00000000 "TaskbarSmallIcons"=dword:00000000
;e ;e
;e
;g Taskbar_Windows10Section
;T System tray ;T System tray
@ -96,7 +98,7 @@
[HKEY_CURRENT_USER\Software\Microsoft\TabletTip\1.7] [HKEY_CURRENT_USER\Software\Microsoft\TabletTip\1.7]
;b Show touch keyboard button * ;b Show touch keyboard button *
"TipbandDesiredVisibility"=dword:00000000 "TipbandDesiredVisibility"=dword:00000000
;t The following settings only apply to the Windows 10 taskbar: ;s SystemTray_Windows10Section IsOldTaskbar
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;p 2 ;p 2
;b Apply Windows 11 style to system tray icons * ;b Apply Windows 11 style to system tray icons *
@ -114,7 +116,7 @@
;x 2 Network Connections in Control Panel ;x 2 Network Connections in Control Panel
"ReplaceNetwork"=dword:00000000 "ReplaceNetwork"=dword:00000000
;q ;q
;t When clicking a system icon in the Windows 10 taskbar system tray, open: ;t When clicking a system icon in the system tray, open:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Control Panel\Settings\Network] [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Control Panel\Settings\Network]
;c 7 Network ;c 7 Network
;x 6 Control Center ;x 6 Control Center
@ -147,6 +149,8 @@
;x 1 Windows 10 (with link to "Language Preferences") ;x 1 Windows 10 (with link to "Language Preferences")
;x 4 Windows 10 ;x 4 Windows 10
"IMEStyle"=dword:00000000 "IMEStyle"=dword:00000000
;g SystemTray_Windows10Section
;T File Explorer ;T File Explorer
@ -200,6 +204,7 @@
"MicaEffectOnTitlebar"=dword:00000000 "MicaEffectOnTitlebar"=dword:00000000
;T Start menu ;T Start menu
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
;z 2 Start menu style ;z 2 Start menu style
@ -252,14 +257,15 @@
;x 8 Monitor #8 ;x 8 Monitor #8
;x 9 Monitor #9 ;x 9 Monitor #9
"MonitorOverride"=dword:00000001 "MonitorOverride"=dword:00000001
;t The following settings only apply to the Windows 11 Start menu: ;s StartMenu_Windows11 !IsWindows10StartMenu
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Disable the "Recommended" section ;b Disable the "Recommended" section
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartDocked_DisableRecommendedSection"=dword:00000000 ;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartDocked_DisableRecommendedSection"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage] [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage]
;b Open Start in All apps by default ;b Open Start in All apps by default
"MakeAllAppsDefault"=dword:00000000 "MakeAllAppsDefault"=dword:00000000
;t The following settings only apply to the Windows 10 Start menu: ;g StartMenu_Windows11
;s StartMenu_Windows10 IsWindows10StartMenu
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Show more tiles ;b Show more tiles
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartUI_ShowMoreTiles"=dword:00000000 ;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_StartUI_ShowMoreTiles"=dword:00000000
@ -281,6 +287,7 @@
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_NoStartMenuMorePrograms"=dword:00000000 ;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_NoStartMenuMorePrograms"=dword:00000000
;u Pin tiles to Windows 10 Start menu from File Explorer ;u Pin tiles to Windows 10 Start menu from File Explorer
;pin_tiles ;pin_tiles
;g StartMenu_Windows10
@ -292,7 +299,7 @@
;x 1 Windows NT ;x 1 Windows NT
;x 2 Simple Window Switcher ;x 2 Simple Window Switcher
"AltTabSettings"=dword:00000000 "AltTabSettings"=dword:00000000
;t The following settings only apply to the Simple Window Switcher: ;s WindowSwitcher_SWS IsSWSEnabled
[HKEY_CURRENT_USER\Software\ExplorerPatcher\sws] [HKEY_CURRENT_USER\Software\ExplorerPatcher\sws]
;b Include desktop ;b Include desktop
"IncludeWallpaper"=dword:00000001 "IncludeWallpaper"=dword:00000001
@ -419,14 +426,16 @@
;q ;q
;y Learn more about Simple Window Switcher 🡕 ;y Learn more about Simple Window Switcher 🡕
;https://github.com/valinet/ExplorerPatcher/wiki/Simple-Window-Switcher ;https://github.com/valinet/ExplorerPatcher/wiki/Simple-Window-Switcher
;g WindowSwitcher_SWS
;s Weather_Windows10 IsOldTaskbar
;T Weather ;T Weather
;t The following settings only apply to the Windows 10 taskbar:
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Show Weather on the taskbar ;b Show Weather on the taskbar
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_PeopleBand"=dword:00000000 ;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_PeopleBand"=dword:00000000
;s Weather_Section1 IsWeatherEnabled
;w Location ;w Location
;Search City or Zip Code; the program looks up "weather in /* what you typed */" on Google. Leave blank for the default value (current location). ;Search City or Zip Code; the program looks up "weather in /* what you typed */" on Google. Leave blank for the default value (current location).
;Current location (default) ;Current location (default)
@ -506,13 +515,17 @@
;x 500 500 % ;x 500 500 %
"WeatherZoomFactor"=dword:00000000 "WeatherZoomFactor"=dword:00000000
;q ;q
;g Weather_Section1
;y Learn more about the Weather taskbar widget 🡕 ;y Learn more about the Weather taskbar widget 🡕
;https://github.com/valinet/ExplorerPatcher/wiki/Weather ;https://github.com/valinet/ExplorerPatcher/wiki/Weather
;s Weather_Section2 IsWeatherEnabled
;t %WEATHERLASTUPDATETEXT% ;t %WEATHERLASTUPDATETEXT%
;u Update weather now ;u Update weather now
;update_weather ;update_weather
;u Clear weather widget local data ;u Clear weather widget local data
;clear_data_weather ;clear_data_weather
;g Weather_Section2
;g Weather_Windows10
@ -615,6 +628,7 @@
"DoNotRedirectNotificationIconsToSettingsApp"=dword:00000000 "DoNotRedirectNotificationIconsToSettingsApp"=dword:00000000
;T Updates ;T Updates
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;z 3 When File Explorer starts ;z 3 When File Explorer starts
@ -671,6 +685,12 @@
"NoPropertiesInContextMenu"=dword:00000000 "NoPropertiesInContextMenu"=dword:00000000
;b Enable symbols download * ;b Enable symbols download *
"EnableSymbolDownload"=dword:00000001 "EnableSymbolDownload"=dword:00000001
;s Advanced_Windows10 IsOldTaskbar
;b Pinned items act as quick launch (don't group pinned items with active apps) *
"PinnedItemsActAsQuickLaunch"=dword:00000000
;b When the taskbar shows button labels, remove the extra gap around pinned items *
"RemoveExtraGapAroundPinnedItems"=dword:00000000
;g Advanced_Windows10
;c 12 Supplementary delay at logon * ;c 12 Supplementary delay at logon *
;x 0 None (default) ;x 0 None (default)
;x 300 300 ms ;x 300 300 ms
@ -685,11 +705,7 @@
;x 8000 8 seconds ;x 8000 8 seconds
;x 10000 10 seconds ;x 10000 10 seconds
"ExplorerReadyDelay"=dword:00000000 "ExplorerReadyDelay"=dword:00000000
;t The following settings only apply to the Windows 10 taskbar:
;b Pinned items act as quick launch (don't group pinned items with active apps) *
"PinnedItemsActAsQuickLaunch"=dword:00000000
;b When the taskbar shows button labels, remove the extra gap around pinned items *
"RemoveExtraGapAroundPinnedItems"=dword:00000000
;T About ;T About