diff --git a/Language/Resource.rc b/Language/Resource.rc index 260881b3..6c8a651a 100644 --- a/Language/Resource.rc +++ b/Language/Resource.rc @@ -168,4 +168,5 @@ STRINGTABLE ID_STR_ELLIPSIS, "..." ID_STR_SHOWNOTIFICATIONAREAICON, "Show notification area icon" ID_STR_SOURCE, "Source" + ID_STR_USED2D, "Use D2D rendering" } diff --git a/Library/DialogManage.cpp b/Library/DialogManage.cpp index 442c218d..9c714f62 100644 --- a/Library/DialogManage.cpp +++ b/Library/DialogManage.cpp @@ -1806,7 +1806,7 @@ void DialogManage::TabSettings::Create(HWND owner) const ControlTemplate::Control s_Controls[] = { CT_GROUPBOX(-1, ID_STR_GENERAL, - 0, 0, 468, 118, + 0, 0, 468, 131, WS_VISIBLE, 0), CT_LABEL(-1, ID_STR_LANGUAGESC, 6, 16, 87, 14, @@ -1832,24 +1832,27 @@ void DialogManage::TabSettings::Create(HWND owner) CT_CHECKBOX(Id_ShowTrayIconCheckBox, ID_STR_SHOWNOTIFICATIONAREAICON, 6, 81, 150, 9, WS_VISIBLE | WS_TABSTOP, 0), + CT_CHECKBOX(Id_UseD2DCheckBox, ID_STR_USED2D, + 6, 94, 150, 9, + WS_VISIBLE | WS_TABSTOP, 0), CT_BUTTON(Id_ResetStatisticsButton, ID_STR_RESETSTATISTICS, - 6, 97, buttonWidth + 20, 14, + 6, 110, buttonWidth + 20, 14, WS_VISIBLE | WS_TABSTOP, 0), CT_GROUPBOX(-1, ID_STR_LOGGING, - 0, 125, 468, 66, + 0, 138, 468, 66, WS_VISIBLE, 0), CT_CHECKBOX(Id_VerboseLoggingCheckbox, ID_STR_DEBUGMODE, - 6, 141, 200, 9, - WS_VISIBLE | WS_TABSTOP, 0), - CT_CHECKBOX(Id_LogToFileCheckBox, ID_STR_LOGTOFILE, 6, 154, 200, 9, WS_VISIBLE | WS_TABSTOP, 0), + CT_CHECKBOX(Id_LogToFileCheckBox, ID_STR_LOGTOFILE, + 6, 167, 200, 9, + WS_VISIBLE | WS_TABSTOP, 0), CT_BUTTON(Id_ShowLogFileButton, ID_STR_SHOWLOGFILE, - 6, 170, buttonWidth + 20, 14, + 6, 183, buttonWidth + 20, 14, WS_VISIBLE | WS_TABSTOP, 0), CT_BUTTON(Id_DeleteLogFileButton, ID_STR_DELETELOGFILE, - buttonWidth + 30, 170, buttonWidth + 20, 14, + buttonWidth + 30, 183, buttonWidth + 20, 14, WS_VISIBLE | WS_TABSTOP, 0) }; @@ -1912,6 +1915,15 @@ void DialogManage::TabSettings::Initialize() bool iconEnabled = GetRainmeter().GetTrayWindow()->IsTrayIconEnabled(); Button_SetCheck(GetControl(Id_ShowTrayIconCheckBox), iconEnabled); + if (Platform::IsAtLeastWinVista()) + { + Button_SetCheck(GetControl(Id_UseD2DCheckBox), GetRainmeter().GetUseD2D()); + } + else + { + Button_Enable(GetControl(Id_UseD2DCheckBox), FALSE); + } + m_Initialized = true; } @@ -2070,6 +2082,10 @@ INT_PTR DialogManage::TabSettings::OnCommand(WPARAM wParam, LPARAM lParam) GetRainmeter().GetTrayWindow()->SetTrayIcon(!GetRainmeter().GetTrayWindow()->IsTrayIconEnabled()); break; + case Id_UseD2DCheckBox: + GetRainmeter().SetUseD2D(!GetRainmeter().GetUseD2D()); + break; + default: return 1; } diff --git a/Library/DialogManage.h b/Library/DialogManage.h index ef252c98..11fc1980 100644 --- a/Library/DialogManage.h +++ b/Library/DialogManage.h @@ -149,7 +149,8 @@ private: Id_LanguageDropDownList, Id_EditorEdit, Id_EditorBrowseButton, - Id_ShowTrayIconCheckBox + Id_ShowTrayIconCheckBox, + Id_UseD2DCheckBox }; TabSettings(); diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index e40bfb37..83580899 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2072,7 +2072,7 @@ bool MeterWindow::ReadSkin() ReadOptions(); // Temporarily read "__UseD2D" from skin for easy testing - bool useD2D = GetRainmeter().CanUseD2D(); + bool useD2D = GetRainmeter().GetUseD2D(); if (revision_beta) { useD2D = 0!=m_Parser.ReadInt(L"Rainmeter", L"__UseD2D", useD2D ? 1 : 0); diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 8df9d7c5..90656adc 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -1757,3 +1757,13 @@ void Rainmeter::TestSettingsFile(bool bDefaultIniLocation) ShowMessage(nullptr, error.c_str(), MB_OK | MB_ICONERROR); } } + +void Rainmeter::SetUseD2D(bool enabled) +{ + m_UseD2D = enabled; + + // Save to Rainmeter.ini + WritePrivateProfileString(L"Rainmeter", L"UseD2D", enabled ? L"1" : L"0", m_IniFile.c_str()); + + RefreshAll(); +} diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index c1eb66c6..ed2a0f8c 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -128,7 +128,8 @@ public: HINSTANCE GetResourceInstance() { return m_ResourceInstance; } LCID GetResourceLCID() { return m_ResourceLCID; } - bool CanUseD2D() const { return m_UseD2D; } + bool GetUseD2D() const { return m_UseD2D; } + void SetUseD2D(bool enabled); bool GetDebug() { return m_Debug; } diff --git a/Library/resource.h b/Library/resource.h index 1705e991..10eb989d 100644 --- a/Library/resource.h +++ b/Library/resource.h @@ -148,6 +148,7 @@ #define ID_STR_ELLIPSIS 2137 #define ID_STR_SHOWNOTIFICATIONAREAICON 2138 #define ID_STR_SOURCE 2139 +#define ID_STR_USED2D 2140 #define IDM_REFRESH 4001 #define IDM_QUIT 4002