Manage Dialog: Added "UseD2D" option in the Settings Tab

If changed, all skins are refreshed
Option is disabled on systems that do not support D2D
This commit is contained in:
Brian Ferguson 2013-07-25 16:44:06 -06:00
parent 05cbcb9aa8
commit 2418c3692f
7 changed files with 41 additions and 11 deletions

View File

@ -168,4 +168,5 @@ STRINGTABLE
ID_STR_ELLIPSIS, "..." ID_STR_ELLIPSIS, "..."
ID_STR_SHOWNOTIFICATIONAREAICON, "Show notification area icon" ID_STR_SHOWNOTIFICATIONAREAICON, "Show notification area icon"
ID_STR_SOURCE, "Source" ID_STR_SOURCE, "Source"
ID_STR_USED2D, "Use D2D rendering"
} }

View File

@ -1806,7 +1806,7 @@ void DialogManage::TabSettings::Create(HWND owner)
const ControlTemplate::Control s_Controls[] = const ControlTemplate::Control s_Controls[] =
{ {
CT_GROUPBOX(-1, ID_STR_GENERAL, CT_GROUPBOX(-1, ID_STR_GENERAL,
0, 0, 468, 118, 0, 0, 468, 131,
WS_VISIBLE, 0), WS_VISIBLE, 0),
CT_LABEL(-1, ID_STR_LANGUAGESC, CT_LABEL(-1, ID_STR_LANGUAGESC,
6, 16, 87, 14, 6, 16, 87, 14,
@ -1832,24 +1832,27 @@ void DialogManage::TabSettings::Create(HWND owner)
CT_CHECKBOX(Id_ShowTrayIconCheckBox, ID_STR_SHOWNOTIFICATIONAREAICON, CT_CHECKBOX(Id_ShowTrayIconCheckBox, ID_STR_SHOWNOTIFICATIONAREAICON,
6, 81, 150, 9, 6, 81, 150, 9,
WS_VISIBLE | WS_TABSTOP, 0), 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, CT_BUTTON(Id_ResetStatisticsButton, ID_STR_RESETSTATISTICS,
6, 97, buttonWidth + 20, 14, 6, 110, buttonWidth + 20, 14,
WS_VISIBLE | WS_TABSTOP, 0), WS_VISIBLE | WS_TABSTOP, 0),
CT_GROUPBOX(-1, ID_STR_LOGGING, CT_GROUPBOX(-1, ID_STR_LOGGING,
0, 125, 468, 66, 0, 138, 468, 66,
WS_VISIBLE, 0), WS_VISIBLE, 0),
CT_CHECKBOX(Id_VerboseLoggingCheckbox, ID_STR_DEBUGMODE, 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, 6, 154, 200, 9,
WS_VISIBLE | WS_TABSTOP, 0), 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, CT_BUTTON(Id_ShowLogFileButton, ID_STR_SHOWLOGFILE,
6, 170, buttonWidth + 20, 14, 6, 183, buttonWidth + 20, 14,
WS_VISIBLE | WS_TABSTOP, 0), WS_VISIBLE | WS_TABSTOP, 0),
CT_BUTTON(Id_DeleteLogFileButton, ID_STR_DELETELOGFILE, CT_BUTTON(Id_DeleteLogFileButton, ID_STR_DELETELOGFILE,
buttonWidth + 30, 170, buttonWidth + 20, 14, buttonWidth + 30, 183, buttonWidth + 20, 14,
WS_VISIBLE | WS_TABSTOP, 0) WS_VISIBLE | WS_TABSTOP, 0)
}; };
@ -1912,6 +1915,15 @@ void DialogManage::TabSettings::Initialize()
bool iconEnabled = GetRainmeter().GetTrayWindow()->IsTrayIconEnabled(); bool iconEnabled = GetRainmeter().GetTrayWindow()->IsTrayIconEnabled();
Button_SetCheck(GetControl(Id_ShowTrayIconCheckBox), iconEnabled); 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; m_Initialized = true;
} }
@ -2070,6 +2082,10 @@ INT_PTR DialogManage::TabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
GetRainmeter().GetTrayWindow()->SetTrayIcon(!GetRainmeter().GetTrayWindow()->IsTrayIconEnabled()); GetRainmeter().GetTrayWindow()->SetTrayIcon(!GetRainmeter().GetTrayWindow()->IsTrayIconEnabled());
break; break;
case Id_UseD2DCheckBox:
GetRainmeter().SetUseD2D(!GetRainmeter().GetUseD2D());
break;
default: default:
return 1; return 1;
} }

View File

@ -149,7 +149,8 @@ private:
Id_LanguageDropDownList, Id_LanguageDropDownList,
Id_EditorEdit, Id_EditorEdit,
Id_EditorBrowseButton, Id_EditorBrowseButton,
Id_ShowTrayIconCheckBox Id_ShowTrayIconCheckBox,
Id_UseD2DCheckBox
}; };
TabSettings(); TabSettings();

View File

@ -2072,7 +2072,7 @@ bool MeterWindow::ReadSkin()
ReadOptions(); ReadOptions();
// Temporarily read "__UseD2D" from skin for easy testing // Temporarily read "__UseD2D" from skin for easy testing
bool useD2D = GetRainmeter().CanUseD2D(); bool useD2D = GetRainmeter().GetUseD2D();
if (revision_beta) if (revision_beta)
{ {
useD2D = 0!=m_Parser.ReadInt(L"Rainmeter", L"__UseD2D", useD2D ? 1 : 0); useD2D = 0!=m_Parser.ReadInt(L"Rainmeter", L"__UseD2D", useD2D ? 1 : 0);

View File

@ -1757,3 +1757,13 @@ void Rainmeter::TestSettingsFile(bool bDefaultIniLocation)
ShowMessage(nullptr, error.c_str(), MB_OK | MB_ICONERROR); 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();
}

View File

@ -128,7 +128,8 @@ public:
HINSTANCE GetResourceInstance() { return m_ResourceInstance; } HINSTANCE GetResourceInstance() { return m_ResourceInstance; }
LCID GetResourceLCID() { return m_ResourceLCID; } 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; } bool GetDebug() { return m_Debug; }

View File

@ -148,6 +148,7 @@
#define ID_STR_ELLIPSIS 2137 #define ID_STR_ELLIPSIS 2137
#define ID_STR_SHOWNOTIFICATIONAREAICON 2138 #define ID_STR_SHOWNOTIFICATIONAREAICON 2138
#define ID_STR_SOURCE 2139 #define ID_STR_SOURCE 2139
#define ID_STR_USED2D 2140
#define IDM_REFRESH 4001 #define IDM_REFRESH 4001
#define IDM_QUIT 4002 #define IDM_QUIT 4002