mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Tweaks.
This commit is contained in:
parent
d054ce8e5c
commit
a2396a7d0f
@ -581,10 +581,10 @@ void CMeasureNet::ResetStats()
|
|||||||
** Reads statistics.
|
** Reads statistics.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureNet::ReadStats(const std::wstring& iniFile)
|
void CMeasureNet::ReadStats(const WCHAR* iniFile)
|
||||||
{
|
{
|
||||||
WCHAR buffer[64];
|
WCHAR buffer[64];
|
||||||
int count = GetPrivateProfileInt(L"Statistics", L"NetStatsCount", 0, iniFile.c_str());
|
int count = GetPrivateProfileInt(L"Statistics", L"NetStatsCount", 0, iniFile);
|
||||||
|
|
||||||
c_StatValues.clear();
|
c_StatValues.clear();
|
||||||
|
|
||||||
@ -593,18 +593,18 @@ void CMeasureNet::ReadStats(const std::wstring& iniFile)
|
|||||||
ULARGE_INTEGER value;
|
ULARGE_INTEGER value;
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInHigh%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInHigh%i", i);
|
||||||
value.HighPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
value.HighPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile);
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInLow%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsInLow%i", i);
|
||||||
value.LowPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
value.LowPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile);
|
||||||
|
|
||||||
c_StatValues.push_back(value.QuadPart);
|
c_StatValues.push_back(value.QuadPart);
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutHigh%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutHigh%i", i);
|
||||||
value.HighPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
value.HighPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile);
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutLow%i", i);
|
_snwprintf_s(buffer, _TRUNCATE, L"NetStatsOutLow%i", i);
|
||||||
value.LowPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile.c_str());
|
value.LowPart = (DWORD)GetPrivateProfileInt(L"Statistics", buffer, 0, iniFile);
|
||||||
|
|
||||||
c_StatValues.push_back(value.QuadPart);
|
c_StatValues.push_back(value.QuadPart);
|
||||||
}
|
}
|
||||||
@ -616,7 +616,7 @@ void CMeasureNet::ReadStats(const std::wstring& iniFile)
|
|||||||
** Writes statistics.
|
** Writes statistics.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureNet::WriteStats(const std::wstring& iniFile)
|
void CMeasureNet::WriteStats(const WCHAR* iniFile)
|
||||||
{
|
{
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
WCHAR buffer2[64];
|
WCHAR buffer2[64];
|
||||||
@ -624,7 +624,7 @@ void CMeasureNet::WriteStats(const std::wstring& iniFile)
|
|||||||
size_t statsSize = c_StatValues.size() / 2;
|
size_t statsSize = c_StatValues.size() / 2;
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", (int)statsSize);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", (int)statsSize);
|
||||||
WritePrivateProfileString(L"Statistics", L"NetStatsCount", buffer, iniFile.c_str());
|
WritePrivateProfileString(L"Statistics", L"NetStatsCount", buffer, iniFile);
|
||||||
|
|
||||||
for (size_t i = 0; i < statsSize; ++i)
|
for (size_t i = 0; i < statsSize; ++i)
|
||||||
{
|
{
|
||||||
@ -634,21 +634,21 @@ void CMeasureNet::WriteStats(const std::wstring& iniFile)
|
|||||||
|
|
||||||
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsInHigh%i", (int)i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsInHigh%i", (int)i + 1);
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.HighPart);
|
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.HighPart);
|
||||||
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile);
|
||||||
|
|
||||||
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsInLow%i", (int)i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsInLow%i", (int)i + 1);
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.LowPart);
|
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.LowPart);
|
||||||
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile);
|
||||||
|
|
||||||
value.QuadPart = c_StatValues[i * 2 + 1];
|
value.QuadPart = c_StatValues[i * 2 + 1];
|
||||||
|
|
||||||
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsOutHigh%i", (int)i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsOutHigh%i", (int)i + 1);
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.HighPart);
|
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.HighPart);
|
||||||
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile);
|
||||||
|
|
||||||
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsOutLow%i", (int)i + 1);
|
_snwprintf_s(buffer2, _TRUNCATE, L"NetStatsOutLow%i", (int)i + 1);
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.LowPart);
|
_snwprintf_s(buffer, _TRUNCATE, L"%u", value.LowPart);
|
||||||
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile.c_str());
|
WritePrivateProfileString(L"Statistics", buffer2, buffer, iniFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ public:
|
|||||||
|
|
||||||
static void UpdateStats();
|
static void UpdateStats();
|
||||||
static void ResetStats();
|
static void ResetStats();
|
||||||
static void ReadStats(const std::wstring& iniFile);
|
static void ReadStats(const WCHAR* iniFile);
|
||||||
static void WriteStats(const std::wstring& iniFile);
|
static void WriteStats(const WCHAR* iniFile);
|
||||||
|
|
||||||
static void InitializeNewApi();
|
static void InitializeNewApi();
|
||||||
static void FinalizeNewApi();
|
static void FinalizeNewApi();
|
||||||
|
@ -504,17 +504,13 @@ void CMeterWindow::SetMouseLeaveEvent(bool cancel)
|
|||||||
void CMeterWindow::MapCoordsToScreen(int& x, int& y, int w, int h)
|
void CMeterWindow::MapCoordsToScreen(int& x, int& y, int w, int h)
|
||||||
{
|
{
|
||||||
// Check that the window is inside the screen area
|
// Check that the window is inside the screen area
|
||||||
HMONITOR hMonitor;
|
POINT pt = {x + w / 2, y + h / 2};
|
||||||
MONITORINFO mi;
|
|
||||||
|
|
||||||
POINT pt = {x, y};
|
|
||||||
for (int i = 0; i < 5; ++i)
|
for (int i = 0; i < 5; ++i)
|
||||||
{
|
{
|
||||||
switch(i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
pt.x = x + w / 2;
|
// Use initial value
|
||||||
pt.y = y + h / 2;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
@ -538,10 +534,11 @@ void CMeterWindow::MapCoordsToScreen(int& x, int& y, int w, int h)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL);
|
HMONITOR hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL);
|
||||||
|
|
||||||
if (hMonitor != NULL)
|
if (hMonitor != NULL)
|
||||||
{
|
{
|
||||||
|
MONITORINFO mi;
|
||||||
mi.cbSize = sizeof(mi);
|
mi.cbSize = sizeof(mi);
|
||||||
GetMonitorInfo(hMonitor, &mi);
|
GetMonitorInfo(hMonitor, &mi);
|
||||||
|
|
||||||
@ -1878,42 +1875,42 @@ void CMeterWindow::ReadConfig()
|
|||||||
void CMeterWindow::WriteConfig()
|
void CMeterWindow::WriteConfig()
|
||||||
{
|
{
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
const std::wstring& iniFile = m_Rainmeter->GetIniFile();
|
const WCHAR* iniFile = m_Rainmeter->GetIniFile().c_str();
|
||||||
const WCHAR* section = m_SkinName.c_str();
|
const WCHAR* section = m_SkinName.c_str();
|
||||||
|
|
||||||
if (!iniFile.empty())
|
if (*iniFile)
|
||||||
{
|
{
|
||||||
// If position needs to be save, do so.
|
// If position needs to be save, do so.
|
||||||
if (m_SavePosition)
|
if (m_SavePosition)
|
||||||
{
|
{
|
||||||
ScreenToWindow();
|
ScreenToWindow();
|
||||||
WritePrivateProfileString(section, L"WindowX", m_WindowX.c_str(), iniFile.c_str());
|
WritePrivateProfileString(section, L"WindowX", m_WindowX.c_str(), iniFile);
|
||||||
WritePrivateProfileString(section, L"WindowY", m_WindowY.c_str(), iniFile.c_str());
|
WritePrivateProfileString(section, L"WindowY", m_WindowY.c_str(), iniFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_AlphaValue);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_AlphaValue);
|
||||||
WritePrivateProfileString(section, L"AlphaValue", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"AlphaValue", buffer, iniFile);
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_FadeDuration);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_FadeDuration);
|
||||||
WritePrivateProfileString(section, L"FadeDuration", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"FadeDuration", buffer, iniFile);
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_ClickThrough);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_ClickThrough);
|
||||||
WritePrivateProfileString(section, L"ClickThrough", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"ClickThrough", buffer, iniFile);
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_WindowDraggable);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_WindowDraggable);
|
||||||
WritePrivateProfileString(section, L"Draggable", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"Draggable", buffer, iniFile);
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_WindowHide);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_WindowHide);
|
||||||
WritePrivateProfileString(section, L"HideOnMouseOver", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"HideOnMouseOver", buffer, iniFile);
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_SavePosition);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_SavePosition);
|
||||||
WritePrivateProfileString(section, L"SavePosition", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"SavePosition", buffer, iniFile);
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_SnapEdges);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_SnapEdges);
|
||||||
WritePrivateProfileString(section, L"SnapEdges", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"SnapEdges", buffer, iniFile);
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_KeepOnScreen);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_KeepOnScreen);
|
||||||
WritePrivateProfileString(section, L"KeepOnScreen", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"KeepOnScreen", buffer, iniFile);
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_AutoSelectScreen);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_AutoSelectScreen);
|
||||||
WritePrivateProfileString(section, L"AutoSelectScreen", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"AutoSelectScreen", buffer, iniFile);
|
||||||
|
|
||||||
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_WindowZPosition);
|
_snwprintf_s(buffer, _TRUNCATE, L"%i", m_WindowZPosition);
|
||||||
WritePrivateProfileString(section, L"AlwaysOnTop", buffer, iniFile.c_str());
|
WritePrivateProfileString(section, L"AlwaysOnTop", buffer, iniFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3147,7 +3144,6 @@ void CMeterWindow::FadeWindow(int from, int to)
|
|||||||
*/
|
*/
|
||||||
void CMeterWindow::ShowWindowIfAppropriate()
|
void CMeterWindow::ShowWindowIfAppropriate()
|
||||||
{
|
{
|
||||||
bool inside = false;
|
|
||||||
bool keyDown = GetKeyState(VK_CONTROL) & 0x8000 || GetKeyState(VK_SHIFT) & 0x8000 || GetKeyState(VK_MENU) & 0x8000;
|
bool keyDown = GetKeyState(VK_CONTROL) & 0x8000 || GetKeyState(VK_SHIFT) & 0x8000 || GetKeyState(VK_MENU) & 0x8000;
|
||||||
|
|
||||||
POINT pos;
|
POINT pos;
|
||||||
@ -3155,7 +3151,7 @@ void CMeterWindow::ShowWindowIfAppropriate()
|
|||||||
POINT posScr = pos;
|
POINT posScr = pos;
|
||||||
|
|
||||||
MapWindowPoints(NULL, m_Window, &pos, 1);
|
MapWindowPoints(NULL, m_Window, &pos, 1);
|
||||||
inside = HitTest(pos.x, pos.y);
|
bool inside = HitTest(pos.x, pos.y);
|
||||||
|
|
||||||
if (inside)
|
if (inside)
|
||||||
{
|
{
|
||||||
@ -3600,7 +3596,7 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
else if (wParam >= ID_CONTEXT_SKINMENU_TRANSPARENCY_0 && wParam <= ID_CONTEXT_SKINMENU_TRANSPARENCY_90)
|
else if (wParam >= ID_CONTEXT_SKINMENU_TRANSPARENCY_0 && wParam <= ID_CONTEXT_SKINMENU_TRANSPARENCY_90)
|
||||||
{
|
{
|
||||||
m_AlphaValue = (int)(255.0 - 230.0 * (double)(wParam - ID_CONTEXT_SKINMENU_TRANSPARENCY_0) / (double)(ID_CONTEXT_SKINMENU_TRANSPARENCY_90 - ID_CONTEXT_SKINMENU_TRANSPARENCY_0));
|
m_AlphaValue = (int)(255.0 - (wParam - ID_CONTEXT_SKINMENU_TRANSPARENCY_0) * (230.0 / (ID_CONTEXT_SKINMENU_TRANSPARENCY_90 - ID_CONTEXT_SKINMENU_TRANSPARENCY_0)));
|
||||||
WriteConfig();
|
WriteConfig();
|
||||||
UpdateTransparency(m_AlphaValue, false);
|
UpdateTransparency(m_AlphaValue, false);
|
||||||
}
|
}
|
||||||
@ -3904,17 +3900,19 @@ LRESULT CMeterWindow::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
MapWindowPoints(NULL, m_Window, &pos, 1);
|
MapWindowPoints(NULL, m_Window, &pos, 1);
|
||||||
|
|
||||||
int x1 = m_DragMargins.left;
|
int x1 = m_DragMargins.left;
|
||||||
int x2 = m_WindowW - m_DragMargins.right;
|
|
||||||
int y1 = m_DragMargins.top;
|
|
||||||
int y2 = m_WindowH - m_DragMargins.bottom;
|
|
||||||
|
|
||||||
if (x1 < 0) x1 += m_WindowW;
|
if (x1 < 0) x1 += m_WindowW;
|
||||||
if (y1 < 0) y1 += m_WindowH;
|
|
||||||
|
int x2 = m_WindowW - m_DragMargins.right;
|
||||||
if (x2 > m_WindowW) x2 -= m_WindowW;
|
if (x2 > m_WindowW) x2 -= m_WindowW;
|
||||||
if (y2 > m_WindowH) y2 -= m_WindowH;
|
|
||||||
|
|
||||||
if (pos.x >= x1 && pos.x < x2)
|
if (pos.x >= x1 && pos.x < x2)
|
||||||
{
|
{
|
||||||
|
int y1 = m_DragMargins.top;
|
||||||
|
if (y1 < 0) y1 += m_WindowH;
|
||||||
|
|
||||||
|
int y2 = m_WindowH - m_DragMargins.bottom;
|
||||||
|
if (y2 > m_WindowH) y2 -= m_WindowH;
|
||||||
|
|
||||||
if (pos.y >= y1 && pos.y < y2)
|
if (pos.y >= y1 && pos.y < y2)
|
||||||
{
|
{
|
||||||
return HTCAPTION;
|
return HTCAPTION;
|
||||||
@ -4148,10 +4146,7 @@ LRESULT CMeterWindow::OnLeftButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
if (uMsg == WM_NCLBUTTONDOWN)
|
if (uMsg == WM_NCLBUTTONDOWN)
|
||||||
{
|
{
|
||||||
// Transform the point to client rect
|
// Transform the point to client rect
|
||||||
RECT rect;
|
MapWindowPoints(NULL, m_Window, &pos, 1);
|
||||||
GetWindowRect(m_Window, &rect);
|
|
||||||
pos.x = pos.x - rect.left;
|
|
||||||
pos.y = pos.y - rect.top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle buttons
|
// Handle buttons
|
||||||
@ -4184,10 +4179,7 @@ LRESULT CMeterWindow::OnLeftButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
if (uMsg == WM_NCLBUTTONUP)
|
if (uMsg == WM_NCLBUTTONUP)
|
||||||
{
|
{
|
||||||
// Transform the point to client rect
|
// Transform the point to client rect
|
||||||
RECT rect;
|
MapWindowPoints(NULL, m_Window, &pos, 1);
|
||||||
GetWindowRect(m_Window, &rect);
|
|
||||||
pos.x = pos.x - rect.left;
|
|
||||||
pos.y = pos.y - rect.top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle buttons
|
// Handle buttons
|
||||||
@ -4213,10 +4205,7 @@ LRESULT CMeterWindow::OnLeftButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM l
|
|||||||
if (uMsg == WM_NCLBUTTONDBLCLK)
|
if (uMsg == WM_NCLBUTTONDBLCLK)
|
||||||
{
|
{
|
||||||
// Transform the point to client rect
|
// Transform the point to client rect
|
||||||
RECT rect;
|
MapWindowPoints(NULL, m_Window, &pos, 1);
|
||||||
GetWindowRect(m_Window, &rect);
|
|
||||||
pos.x = pos.x - rect.left;
|
|
||||||
pos.y = pos.y - rect.top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle buttons
|
// Handle buttons
|
||||||
@ -4245,10 +4234,7 @@ LRESULT CMeterWindow::OnRightButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
if (uMsg == WM_NCRBUTTONDOWN)
|
if (uMsg == WM_NCRBUTTONDOWN)
|
||||||
{
|
{
|
||||||
// Transform the point to client rect
|
// Transform the point to client rect
|
||||||
RECT rect;
|
MapWindowPoints(NULL, m_Window, &pos, 1);
|
||||||
GetWindowRect(m_Window, &rect);
|
|
||||||
pos.x = pos.x - rect.left;
|
|
||||||
pos.y = pos.y - rect.top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle buttons
|
// Handle buttons
|
||||||
@ -4298,10 +4284,7 @@ LRESULT CMeterWindow::OnRightButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM
|
|||||||
if (uMsg == WM_NCRBUTTONDBLCLK)
|
if (uMsg == WM_NCRBUTTONDBLCLK)
|
||||||
{
|
{
|
||||||
// Transform the point to client rect
|
// Transform the point to client rect
|
||||||
RECT rect;
|
MapWindowPoints(NULL, m_Window, &pos, 1);
|
||||||
GetWindowRect(m_Window, &rect);
|
|
||||||
pos.x = pos.x - rect.left;
|
|
||||||
pos.y = pos.y - rect.top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle buttons
|
// Handle buttons
|
||||||
@ -4330,10 +4313,7 @@ LRESULT CMeterWindow::OnMiddleButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||||||
if (uMsg == WM_NCMBUTTONDOWN)
|
if (uMsg == WM_NCMBUTTONDOWN)
|
||||||
{
|
{
|
||||||
// Transform the point to client rect
|
// Transform the point to client rect
|
||||||
RECT rect;
|
MapWindowPoints(NULL, m_Window, &pos, 1);
|
||||||
GetWindowRect(m_Window, &rect);
|
|
||||||
pos.x = pos.x - rect.left;
|
|
||||||
pos.y = pos.y - rect.top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle buttons
|
// Handle buttons
|
||||||
@ -4359,10 +4339,7 @@ LRESULT CMeterWindow::OnMiddleButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
if (uMsg == WM_NCMBUTTONUP)
|
if (uMsg == WM_NCMBUTTONUP)
|
||||||
{
|
{
|
||||||
// Transform the point to client rect
|
// Transform the point to client rect
|
||||||
RECT rect;
|
MapWindowPoints(NULL, m_Window, &pos, 1);
|
||||||
GetWindowRect(m_Window, &rect);
|
|
||||||
pos.x = pos.x - rect.left;
|
|
||||||
pos.y = pos.y - rect.top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle buttons
|
// Handle buttons
|
||||||
@ -4388,10 +4365,7 @@ LRESULT CMeterWindow::OnMiddleButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM
|
|||||||
if (uMsg == WM_NCMBUTTONDBLCLK)
|
if (uMsg == WM_NCMBUTTONDBLCLK)
|
||||||
{
|
{
|
||||||
// Transform the point to client rect
|
// Transform the point to client rect
|
||||||
RECT rect;
|
MapWindowPoints(NULL, m_Window, &pos, 1);
|
||||||
GetWindowRect(m_Window, &rect);
|
|
||||||
pos.x = pos.x - rect.left;
|
|
||||||
pos.y = pos.y - rect.top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle buttons
|
// Handle buttons
|
||||||
@ -4414,13 +4388,10 @@ LRESULT CMeterWindow::OnMiddleButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM
|
|||||||
LRESULT CMeterWindow::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT CMeterWindow::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
POINT pos;
|
POINT pos;
|
||||||
int x = (SHORT)LOWORD(lParam);
|
|
||||||
int y = (SHORT)HIWORD(lParam);
|
|
||||||
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetWindowRect(m_Window, &rect);
|
GetWindowRect(m_Window, &rect);
|
||||||
|
|
||||||
if (x == -1 && y == -1) // WM_CONTEXTMENU is generated from the keyboard (Shift+F10/VK_APPS)
|
if ((lParam & 0xFFFFFFFF) == 0xFFFFFFFF) // WM_CONTEXTMENU is generated from the keyboard (Shift+F10/VK_APPS)
|
||||||
{
|
{
|
||||||
// Set menu position to (0,0) on the window
|
// Set menu position to (0,0) on the window
|
||||||
pos.x = rect.left;
|
pos.x = rect.left;
|
||||||
@ -4428,22 +4399,20 @@ LRESULT CMeterWindow::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
pos.x = (SHORT)LOWORD(lParam);
|
||||||
|
pos.y = (SHORT)HIWORD(lParam);
|
||||||
|
|
||||||
// Transform the point to client rect
|
// Transform the point to client rect
|
||||||
pos.x = x - rect.left;
|
POINT posc = {pos.x - rect.left, pos.y - rect.top};
|
||||||
pos.y = y - rect.top;
|
|
||||||
|
|
||||||
// Handle buttons
|
// Handle buttons
|
||||||
HandleButtons(pos, BUTTONPROC_MOVE, NULL);
|
HandleButtons(posc, BUTTONPROC_MOVE, NULL);
|
||||||
|
|
||||||
// If RMB up or RMB down or double-click cause actions, do not show the menu!
|
// If RMB up or RMB down or double-click cause actions, do not show the menu!
|
||||||
if (DoAction(pos.x, pos.y, MOUSE_RMB_UP, false) || DoAction(pos.x, pos.y, MOUSE_RMB_DOWN, true) || DoAction(pos.x, pos.y, MOUSE_RMB_DBLCLK, true))
|
if (DoAction(posc.x, posc.y, MOUSE_RMB_UP, false) || DoAction(posc.x, posc.y, MOUSE_RMB_DOWN, true) || DoAction(posc.x, posc.y, MOUSE_RMB_DBLCLK, true))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set menu position to cursor position
|
|
||||||
pos.x = x;
|
|
||||||
pos.y = y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Rainmeter->ShowContextMenu(pos, this);
|
m_Rainmeter->ShowContextMenu(pos, this);
|
||||||
@ -5094,12 +5063,7 @@ std::wstring CMeterWindow::MakePathAbsolute(const std::wstring& path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::wstring root = m_SkinPath + m_SkinName;
|
std::wstring root = m_SkinPath + m_SkinName;
|
||||||
|
|
||||||
WCHAR ch = root[root.length() - 1];
|
|
||||||
if (ch != L'\\' && ch != L'/')
|
|
||||||
{
|
|
||||||
root += L"\\";
|
root += L"\\";
|
||||||
}
|
|
||||||
|
|
||||||
return root + path;
|
return root + path;
|
||||||
}
|
}
|
||||||
@ -5116,7 +5080,7 @@ CMeter* CMeterWindow::GetMeter(const std::wstring& meterName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMeasure* CMeterWindow::GetMeasure(const std::wstring& measureName)
|
CMeasure* CMeterWindow::GetMeasure(const std::wstring& measureName)
|
||||||
@ -5129,7 +5093,7 @@ CMeasure* CMeterWindow::GetMeasure(const std::wstring& measureName)
|
|||||||
return (*i);
|
return (*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3717,7 +3717,7 @@ void CRainmeter::ReadStats()
|
|||||||
delete [] tmpSz;
|
delete [] tmpSz;
|
||||||
|
|
||||||
// Only Net measure has stats at the moment
|
// Only Net measure has stats at the moment
|
||||||
CMeasureNet::ReadStats(m_StatsFile);
|
CMeasureNet::ReadStats(m_StatsFile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3740,7 +3740,7 @@ void CRainmeter::WriteStats(bool bForce)
|
|||||||
WritePrivateProfileString(L"Statistics", L"Since", m_StatsDate.c_str(), m_StatsFile.c_str());
|
WritePrivateProfileString(L"Statistics", L"Since", m_StatsDate.c_str(), m_StatsFile.c_str());
|
||||||
|
|
||||||
// Only Net measure has stats at the moment
|
// Only Net measure has stats at the moment
|
||||||
CMeasureNet::WriteStats(m_StatsFile);
|
CMeasureNet::WriteStats(m_StatsFile.c_str());
|
||||||
|
|
||||||
WritePrivateProfileString(NULL, NULL, NULL, m_StatsFile.c_str());
|
WritePrivateProfileString(NULL, NULL, NULL, m_StatsFile.c_str());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user