Skip to content

Commit

Permalink
Merge pull request #10 from stuerp/vNext
Browse files Browse the repository at this point in the history
v0.1.8.0
  • Loading branch information
stuerp authored Aug 10, 2024
2 parents b30d78e + 2b8440c commit ba4ff0a
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 12 deletions.
15 changes: 14 additions & 1 deletion Configuration.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/** $VER: configuration_t.cpp (2024.07.09) P. Stuer **/
/** $VER: configuration_t.cpp (2024.08.04) P. Stuer **/

#include "pch.h"

Expand Down Expand Up @@ -76,6 +76,8 @@ void configuration_t::Reset() noexcept

_ClearOnStartup = ClearOnStartup::None;
_InPrivateMode = false;

_ScrollbarStyle = ScrollbarStyle::Fluent;
}

/// <summary>
Expand All @@ -95,6 +97,8 @@ configuration_t & configuration_t::operator=(const configuration_t & other)

_ClearOnStartup = other._ClearOnStartup;
_InPrivateMode = other._InPrivateMode;

_ScrollbarStyle = other._ScrollbarStyle;

return *this;
}
Expand Down Expand Up @@ -149,6 +153,12 @@ void configuration_t::Read(stream_reader * reader, size_t size, abort_callback &
{
reader->read_object_t(_InPrivateMode, abortHandler);
}

// Version 7, v0.1.8.0
if (Version >= 7)
{
uint32_t Value; reader->read_object_t(Value, abortHandler); _ScrollbarStyle = (ScrollbarStyle) Value;
}
}
catch (exception & ex)
{
Expand Down Expand Up @@ -187,6 +197,9 @@ void configuration_t::Write(stream_writer * writer, abort_callback & abortHandle

// Version 6, v0.1.6.3-alpha3
writer->write_object_t(_InPrivateMode, abortHandler);

// Version 7, v0.1.8.0
Value = (uint32_t) _ScrollbarStyle; writer->write_object_t(Value, abortHandler);
}
catch (exception & ex)
{
Expand Down
11 changes: 9 additions & 2 deletions Configuration.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/** $VER: Configuration.h (2024.07.10) P. Stuer **/
/** $VER: Configuration.h (2024.08.04) P. Stuer **/

#pragma once

Expand Down Expand Up @@ -28,6 +28,12 @@ enum ClearOnStartup : uint32_t
All = (uint32_t) ~0,
};

enum ScrollbarStyle : uint32_t
{
Default = 0,
Fluent,
};

/// <summary>
/// Represents the configuration of the component.
/// </summary>
Expand Down Expand Up @@ -60,7 +66,8 @@ class configuration_t
std::wstring _ProfileName;
ClearOnStartup _ClearOnStartup;
bool _InPrivateMode;
ScrollbarStyle _ScrollbarStyle;

private:
const int32_t _CurrentVersion = 6;
const int32_t _CurrentVersion = 7;
};
8 changes: 7 additions & 1 deletion Preferences.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/** $VER: Preferences.cpp (2024.07.11) P. Stuer **/
/** $VER: Preferences.cpp (2024.08.04) P. Stuer **/

#include "pch.h"

Expand Down Expand Up @@ -107,6 +107,7 @@ class Preferences : public CDialogImpl<Preferences>, public preferences_page_ins
_Configuration._ClearOnStartup = (SendDlgItemMessageW(IDC_CLEAR_BROWSING_DATA, BM_GETCHECK) == BST_CHECKED) ? ClearOnStartup::All : ClearOnStartup::None;

_Configuration._InPrivateMode = (SendDlgItemMessageW(IDC_IN_PRIVATE_MODE, BM_GETCHECK) == BST_CHECKED);
_Configuration._ScrollbarStyle = (SendDlgItemMessageW(IDC_SCROLLBAR_STYLE, BM_GETCHECK) == BST_CHECKED) ? ScrollbarStyle::Fluent : ScrollbarStyle::Default;

UIElement * CurrentElement = _UIElementTracker.GetCurrentElement();

Expand Down Expand Up @@ -145,6 +146,7 @@ class Preferences : public CDialogImpl<Preferences>, public preferences_page_ins
COMMAND_HANDLER_EX(IDC_USER_DATA_FOLDER_PATH_SELECT, BN_CLICKED, OnButtonClicked)
COMMAND_HANDLER_EX(IDC_CLEAR_BROWSING_DATA, BN_CLICKED, OnButtonClicked)
COMMAND_HANDLER_EX(IDC_IN_PRIVATE_MODE, BN_CLICKED, OnButtonClicked)
COMMAND_HANDLER_EX(IDC_SCROLLBAR_STYLE, BN_CLICKED, OnButtonClicked)

COMMAND_HANDLER_EX(IDC_FILE_PATH_SELECT, BN_CLICKED, OnButtonClicked)
COMMAND_HANDLER_EX(IDC_FILE_PATH_EDIT, BN_CLICKED, OnButtonClicked)
Expand Down Expand Up @@ -196,6 +198,7 @@ class Preferences : public CDialogImpl<Preferences>, public preferences_page_ins

SendDlgItemMessageW(IDC_CLEAR_BROWSING_DATA, BM_SETCHECK, (WPARAM) (_Configuration._ClearOnStartup == ClearOnStartup::All ? BST_CHECKED : BST_UNCHECKED));
SendDlgItemMessageW(IDC_IN_PRIVATE_MODE, BM_SETCHECK, (WPARAM) (_Configuration._InPrivateMode ? BST_CHECKED : BST_UNCHECKED));
SendDlgItemMessageW(IDC_SCROLLBAR_STYLE, BM_SETCHECK, (WPARAM) ((_Configuration._ScrollbarStyle == ScrollbarStyle::Fluent) ? BST_CHECKED : BST_UNCHECKED));
}

/// <summary>
Expand Down Expand Up @@ -372,6 +375,9 @@ class Preferences : public CDialogImpl<Preferences>, public preferences_page_ins
if (SendDlgItemMessageW(IDC_IN_PRIVATE_MODE, BM_GETCHECK) != (_Configuration._InPrivateMode ? BST_CHECKED : BST_UNCHECKED))
return true;

if (SendDlgItemMessageW(IDC_SCROLLBAR_STYLE, BM_GETCHECK) != ((_Configuration._ScrollbarStyle == ScrollbarStyle::Fluent) ? BST_CHECKED : BST_UNCHECKED))
return true;

return false;
}

Expand Down
8 changes: 7 additions & 1 deletion PreferencesLayout.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/** $VER: PreferencesLayout.h (2024.07.10) **/
/** $VER: PreferencesLayout.h (2024.08.04) **/

#pragma once

Expand Down Expand Up @@ -145,6 +145,12 @@
#define W_D27 160
#define H_D27 H_LBL

// Checkbox: Fluent scrollbar style
#define X_D28 0
#define Y_D28 Y_D27 + H_D27 + IY
#define W_D28 160
#define H_D28 H_LBL

// Warning
#define X_D99 0
#define Y_D99 H_A00 - H_LBL
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ To create the component first build the x86 configuration and next the x64 confi

## Change Log

v0.1.8.0, 2024-08-10

* New: The Fluent scrollbar style can be disabled.
* The component needs to be restarted for the change to become active.
* Be sure to use separate user data folders when you have multiple instances that use different styles.

v0.1.7.0, 2024-07-14

* New: In Private mode can be enabled in the Preferences dialog and is no longer enabled by default (alpha3).
Expand All @@ -104,7 +110,7 @@ v0.1.7.0, 2024-07-14
* GetArtwork(): Gets the embedded artwork (front / back / disc / icon / artist) from the current playing item (alpha1).
* Fixed support for other artwork types (alpha2, regression).
* Added support for WebP images (alpha2).
* Always returns an empty data URI in case of an error or if the specified artwork type is not availabe (alpha2).
* Always returns an empty data URI in case of an error or if the specified artwork type is not available (alpha2).
* The album art search patterns are used first. If no matching file can be found, the embedded artwork gets queried (alpha3).
* Changed: Updated the WebView2 SDK to the latest version (alpha3).

Expand Down
7 changes: 4 additions & 3 deletions Resources.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/** $VER: Resources.h (2024.07.14) P. Stuer **/
/** $VER: Resources.h (2024.08.04) P. Stuer **/

#pragma once

Expand All @@ -8,12 +8,12 @@

#define NUM_FILE_MAJOR 0
#define NUM_FILE_MINOR 1
#define NUM_FILE_PATCH 7
#define NUM_FILE_PATCH 8
#define NUM_FILE_PRERELEASE 0

#define NUM_PRODUCT_MAJOR 0
#define NUM_PRODUCT_MINOR 1
#define NUM_PRODUCT_PATCH 7
#define NUM_PRODUCT_PATCH 8
#define NUM_PRODUCT_PRERELEASE 0

/** Component specific **/
Expand Down Expand Up @@ -79,6 +79,7 @@

#define IDC_CLEAR_BROWSING_DATA 1040
#define IDC_IN_PRIVATE_MODE 1042
#define IDC_SCROLLBAR_STYLE 1044

#define IDC_WARNING 9999

Expand Down
3 changes: 2 additions & 1 deletion Resources.rc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/** $VER: Resources.rc (2024.07.11) P. Stuer **/
/** $VER: Resources.rc (2024.08.04) P. Stuer **/

#include "Resources.h"

Expand Down Expand Up @@ -72,6 +72,7 @@ font 8, "Segoe UI", 400, 0, 1

control "Clear browsing data on startup", IDC_CLEAR_BROWSING_DATA, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, X_D26, Y_D26, W_D26, H_D26
control "In Private mode", IDC_IN_PRIVATE_MODE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, X_D27, Y_D27, W_D27, H_D27
control "Fluent scrollbar style", IDC_SCROLLBAR_STYLE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, X_D28, Y_D28, W_D28, H_D28

ltext "Restart the component to activate changed settings", IDC_WARNING, X_D99, Y_D99, W_D99, H_D99, NOT WS_VISIBLE
}
Expand Down
4 changes: 2 additions & 2 deletions WebView.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/** $VER: WebView.cpp (2024.07.11) P. Stuer - Creates the WebView. **/
/** $VER: WebView.cpp (2024.08.04) P. Stuer - Creates the WebView. **/

#include "pch.h"

Expand Down Expand Up @@ -75,7 +75,7 @@ HRESULT UIElement::CreateWebView()

if (SUCCEEDED(hr))
{
const COREWEBVIEW2_SCROLLBAR_STYLE Style = COREWEBVIEW2_SCROLLBAR_STYLE_FLUENT_OVERLAY;
const COREWEBVIEW2_SCROLLBAR_STYLE Style = (_Configuration._ScrollbarStyle == 0) ? COREWEBVIEW2_SCROLLBAR_STYLE_DEFAULT : COREWEBVIEW2_SCROLLBAR_STYLE_FLUENT_OVERLAY;

hr = EnvironmentOptions8->put_ScrollBarStyle(Style); // See https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2environmentoptions8?view=webview2-1.0.2592.51

Expand Down

0 comments on commit ba4ff0a

Please sign in to comment.