mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Cosmetic changes.
This commit is contained in:
parent
3c98527338
commit
b0046d2968
@ -355,17 +355,6 @@ void LogInternal(int nLevel, ULONGLONG elapsed, LPCTSTR pszMessage)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LSLog(int nLevel, LPCTSTR pszModule, LPCTSTR pszMessage)
|
|
||||||
{
|
|
||||||
// Ignore LOG_DEBUG messages from plugins unless in debug mode
|
|
||||||
if (nLevel != LOG_DEBUG || Rainmeter->GetDebug())
|
|
||||||
{
|
|
||||||
Log(nLevel, pszMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Log(int nLevel, const WCHAR* message)
|
void Log(int nLevel, const WCHAR* message)
|
||||||
{
|
{
|
||||||
struct DELAYED_LOG_INFO
|
struct DELAYED_LOG_INFO
|
||||||
|
@ -120,7 +120,6 @@ bool CMeasureDiskSpace::Update()
|
|||||||
{
|
{
|
||||||
UINT oldMode = SetErrorMode(0);
|
UINT oldMode = SetErrorMode(0);
|
||||||
SetErrorMode(oldMode | SEM_FAILCRITICALERRORS); // Prevent the system from displaying message box
|
SetErrorMode(oldMode | SEM_FAILCRITICALERRORS); // Prevent the system from displaying message box
|
||||||
SetLastError(ERROR_SUCCESS);
|
|
||||||
sizeResult = GetDiskFreeSpaceEx(drive, NULL, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes);
|
sizeResult = GetDiskFreeSpaceEx(drive, NULL, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes);
|
||||||
SetErrorMode(oldMode); // Reset
|
SetErrorMode(oldMode); // Reset
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ bool CMeterButton::MouseMove(POINT pos)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If the left button is not down anymore the clicked state needs to be set false
|
// If the left button is not down anymore the clicked state needs to be set false
|
||||||
if (!(GetKeyState(VK_LBUTTON) < 0))
|
if (!IsLButtonDown())
|
||||||
{
|
{
|
||||||
m_Clicked = false;
|
m_Clicked = false;
|
||||||
}
|
}
|
||||||
|
@ -3037,7 +3037,7 @@ LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool keyDown = GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_SHIFT) < 0 || GetKeyState(VK_MENU) < 0;
|
bool keyDown = IsCtrlKeyDown() || IsShiftKeyDown() || IsAltKeyDown();
|
||||||
|
|
||||||
if (!keyDown || GetWindowFromPoint(pos) != m_Window)
|
if (!keyDown || GetWindowFromPoint(pos) != m_Window)
|
||||||
{
|
{
|
||||||
@ -3111,7 +3111,7 @@ LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
if (m_FadeStartTime == 0)
|
if (m_FadeStartTime == 0)
|
||||||
{
|
{
|
||||||
KillTimer(m_Window, TIMER_DEACTIVATE);
|
KillTimer(m_Window, TIMER_DEACTIVATE);
|
||||||
Rainmeter->DeleteMeterWindow(this, true);
|
Rainmeter->DeleteMeterWindow(this, true); // "delete this;"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3184,7 +3184,7 @@ void CMeterWindow::ShowFade()
|
|||||||
*/
|
*/
|
||||||
void CMeterWindow::ShowWindowIfAppropriate()
|
void CMeterWindow::ShowWindowIfAppropriate()
|
||||||
{
|
{
|
||||||
bool keyDown = GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_SHIFT) < 0 || GetKeyState(VK_MENU) < 0;
|
bool keyDown = IsCtrlKeyDown() || IsShiftKeyDown() || IsAltKeyDown();
|
||||||
|
|
||||||
POINT pos;
|
POINT pos;
|
||||||
GetCursorPos(&pos);
|
GetCursorPos(&pos);
|
||||||
@ -3407,7 +3407,7 @@ LRESULT CMeterWindow::OnEnterMenuLoop(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
*/
|
*/
|
||||||
LRESULT CMeterWindow::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT CMeterWindow::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
bool keyDown = GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_SHIFT) < 0 || GetKeyState(VK_MENU) < 0;
|
bool keyDown = IsCtrlKeyDown() || IsShiftKeyDown() || IsAltKeyDown();
|
||||||
|
|
||||||
if (!keyDown)
|
if (!keyDown)
|
||||||
{
|
{
|
||||||
@ -3956,7 +3956,7 @@ LRESULT CMeterWindow::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||||||
|
|
||||||
if ((wp->flags & SWP_NOMOVE) == 0)
|
if ((wp->flags & SWP_NOMOVE) == 0)
|
||||||
{
|
{
|
||||||
if (m_SnapEdges && !(GetKeyState(VK_CONTROL) < 0 || GetKeyState(VK_SHIFT) < 0))
|
if (m_SnapEdges && !(IsCtrlKeyDown() || IsShiftKeyDown()))
|
||||||
{
|
{
|
||||||
// only process movement (ignore anything without winpos values)
|
// only process movement (ignore anything without winpos values)
|
||||||
if (wp->cx != 0 && wp->cy != 0)
|
if (wp->cx != 0 && wp->cy != 0)
|
||||||
@ -4153,7 +4153,7 @@ LRESULT CMeterWindow::OnLeftButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
// Handle buttons
|
// Handle buttons
|
||||||
HandleButtons(pos, BUTTONPROC_DOWN);
|
HandleButtons(pos, BUTTONPROC_DOWN);
|
||||||
|
|
||||||
if (GetKeyState(VK_CONTROL) < 0 || // Ctrl is pressed, so only run default action
|
if (IsCtrlKeyDown() || // Ctrl is pressed, so only run default action
|
||||||
(!DoAction(pos.x, pos.y, MOUSE_LMB_DOWN, false) && m_WindowDraggable))
|
(!DoAction(pos.x, pos.y, MOUSE_LMB_DOWN, false) && m_WindowDraggable))
|
||||||
{
|
{
|
||||||
// Cancel the mouse event beforehand
|
// Cancel the mouse event beforehand
|
||||||
@ -4262,7 +4262,7 @@ LRESULT CMeterWindow::OnRightButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
// Handle buttons
|
// Handle buttons
|
||||||
HandleButtons(pos, BUTTONPROC_MOVE);
|
HandleButtons(pos, BUTTONPROC_MOVE);
|
||||||
|
|
||||||
if (GetKeyState(VK_CONTROL) < 0 || // Ctrl is pressed, so only run default action
|
if (IsCtrlKeyDown() || // Ctrl is pressed, so only run default action
|
||||||
!DoAction(pos.x, pos.y, MOUSE_RMB_UP, false))
|
!DoAction(pos.x, pos.y, MOUSE_RMB_UP, false))
|
||||||
{
|
{
|
||||||
// Run the DefWindowProc so the context menu works
|
// Run the DefWindowProc so the context menu works
|
||||||
@ -4412,7 +4412,7 @@ LRESULT CMeterWindow::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
HandleButtons(posc, BUTTONPROC_MOVE);
|
HandleButtons(posc, BUTTONPROC_MOVE);
|
||||||
|
|
||||||
// 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 (!(GetKeyState(VK_CONTROL) < 0) && // Ctrl is pressed, so ignore any actions
|
if (!IsCtrlKeyDown() && // Ctrl is pressed, so ignore any actions
|
||||||
(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)))
|
(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;
|
||||||
|
@ -59,4 +59,9 @@
|
|||||||
// RUNTIME
|
// RUNTIME
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
|
||||||
|
// ADDITIONAL MACRO
|
||||||
|
#define IsCtrlKeyDown() (GetKeyState(VK_CONTROL) < 0)
|
||||||
|
#define IsShiftKeyDown() (GetKeyState(VK_SHIFT) < 0)
|
||||||
|
#define IsAltKeyDown() (GetKeyState(VK_MENU) < 0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -557,7 +557,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(GetKeyState(VK_CONTROL) < 0) && // Ctrl is pressed, so only run default action
|
if (!IsCtrlKeyDown() && // Ctrl is pressed, so only run default action
|
||||||
!bang.empty())
|
!bang.empty())
|
||||||
{
|
{
|
||||||
Rainmeter->ExecuteCommand(bang.c_str(), NULL);
|
Rainmeter->ExecuteCommand(bang.c_str(), NULL);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <Wininet.h>
|
#include <Wininet.h>
|
||||||
@ -69,7 +69,7 @@ static std::vector<MeasureData*> g_Measures;
|
|||||||
static bool g_Debug = false;
|
static bool g_Debug = false;
|
||||||
static HINTERNET g_InternetHandle = NULL;
|
static HINTERNET g_InternetHandle = NULL;
|
||||||
|
|
||||||
static std::map<std::wstring, WCHAR> g_CERs;
|
static std::unordered_map<std::wstring, WCHAR> g_CERs;
|
||||||
|
|
||||||
#define OVECCOUNT 300 // should be a multiple of 3
|
#define OVECCOUNT 300 // should be a multiple of 3
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ std::wstring& DecodeReferences(std::wstring& str, int opt)
|
|||||||
|
|
||||||
std::wstring name(str, pos, end - pos);
|
std::wstring name(str, pos, end - pos);
|
||||||
|
|
||||||
std::map<std::wstring, WCHAR>::const_iterator iter = g_CERs.find(name);
|
std::unordered_map<std::wstring, WCHAR>::const_iterator iter = g_CERs.find(name);
|
||||||
if (iter != g_CERs.end())
|
if (iter != g_CERs.end())
|
||||||
{
|
{
|
||||||
str.replace(start, end - start + 1, 1, (*iter).second);
|
str.replace(start, end - start + 1, 1, (*iter).second);
|
||||||
@ -504,6 +504,7 @@ void FillCharacterEntityReferences()
|
|||||||
};
|
};
|
||||||
|
|
||||||
const int entityCount = _countof(entities);
|
const int entityCount = _countof(entities);
|
||||||
|
g_CERs.rehash(entityCount);
|
||||||
for (int i = 0; i < entityCount; ++i)
|
for (int i = 0; i < entityCount; ++i)
|
||||||
{
|
{
|
||||||
g_CERs.insert(std::pair<std::wstring, WCHAR>(entities[i].name, entities[i].ch));
|
g_CERs.insert(std::pair<std::wstring, WCHAR>(entities[i].name, entities[i].ch));
|
||||||
|
Loading…
Reference in New Issue
Block a user