Skip to content

Commit

Permalink
Implement the new toolbar and use it to replace the old menubar and o…
Browse files Browse the repository at this point in the history
…ld toolbar.
  • Loading branch information
MouriNaruto committed May 21, 2024
1 parent c6ae655 commit 4e70eb1
Show file tree
Hide file tree
Showing 101 changed files with 1,257 additions and 632 deletions.
52 changes: 51 additions & 1 deletion NanaZip.Frieren/NanaZip.Frieren.DarkMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,21 @@ namespace
}
}

static bool IsFileManagerWindow(
_In_ HWND WindowHandle)
{
wchar_t ClassName[256] = { 0 };
if (0 != ::GetClassNameW(
WindowHandle,
ClassName,
256))
{
return (0 == std::wcscmp(ClassName, L"FM"));
}

return false;
}

LRESULT CALLBACK WindowSubclassCallback(
_In_ HWND hWnd,
_In_ UINT uMsg,
Expand Down Expand Up @@ -397,7 +412,17 @@ namespace

bool ShouldExtendFrame =
(g_ShouldAppsUseDarkMode && ::IsStandardDynamicRangeMode());
MARGINS Margins = { (ShouldExtendFrame ? -1 : 0) };
MARGINS Margins = { 0 };
if (ShouldExtendFrame)
{
Margins = { -1 };
}
else if (::IsFileManagerWindow(hWnd))
{
UINT DpiValue = ::GetDpiForWindow(hWnd);
Margins.cyTopHeight =
::MulDiv(48, DpiValue, USER_DEFAULT_SCREEN_DPI);
}
::DwmExtendFrameIntoClientArea(hWnd, &Margins);

::EnumChildWindows(
Expand Down Expand Up @@ -439,6 +464,15 @@ namespace
MARGINS Margins = { -1 };
::DwmExtendFrameIntoClientArea(hWnd, &Margins);
}
else if (::IsFileManagerWindow(hWnd))
{
UINT DpiValue = ::GetDpiForWindow(hWnd);

MARGINS Margins = { 0 };
Margins.cyTopHeight =
::MulDiv(48, DpiValue, USER_DEFAULT_SCREEN_DPI);
::DwmExtendFrameIntoClientArea(hWnd, &Margins);
}

::RefreshWindowTheme(hWnd);

Expand Down Expand Up @@ -485,6 +519,22 @@ namespace

break;
}
case WM_DPICHANGED:
{
bool ShouldExtendFrame =
(g_ShouldAppsUseDarkMode && ::IsStandardDynamicRangeMode());
if (!ShouldExtendFrame && ::IsFileManagerWindow(hWnd))
{
UINT DpiValue = ::GetDpiForWindow(hWnd);

MARGINS Margins = { 0 };
Margins.cyTopHeight =
::MulDiv(48, DpiValue, USER_DEFAULT_SCREEN_DPI);
::DwmExtendFrameIntoClientArea(hWnd, &Margins);
}

break;
}
default:
break;
}
Expand Down
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Add_24x24.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Add_32x32.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Copy_24x24.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Copy_32x32.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Delete_24x24.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Delete_32x32.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Extract_24x24.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Extract_32x32.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Info_24x24.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Info_32x32.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Move_24x24.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Move_32x32.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Test_24x24.bmp
Binary file not shown.
Binary file removed NanaZip.UI.Modern/Assets/Toolbar/Test_32x32.bmp
Binary file not shown.
Loading

0 comments on commit 4e70eb1

Please sign in to comment.