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
b33d59e9de
commit
a93c02ef84
@ -1033,7 +1033,8 @@ int CRainmeter::Initialize(LPCWSTR szPath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tray must exist before configs are read
|
// Tray must exist before configs are read
|
||||||
m_TrayWindow = new CTrayWindow(m_Instance);
|
m_TrayWindow = new CTrayWindow();
|
||||||
|
m_TrayWindow->Initialize();
|
||||||
|
|
||||||
ReloadSettings();
|
ReloadSettings();
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ extern CRainmeter* Rainmeter;
|
|||||||
|
|
||||||
using namespace Gdiplus;
|
using namespace Gdiplus;
|
||||||
|
|
||||||
CTrayWindow::CTrayWindow(HINSTANCE instance) : m_Instance(instance),
|
CTrayWindow::CTrayWindow() :
|
||||||
m_Icon(),
|
m_Icon(),
|
||||||
m_Measure(),
|
m_Measure(),
|
||||||
m_MeterType(TRAY_METER_TYPE_HISTOGRAM),
|
m_MeterType(TRAY_METER_TYPE_HISTOGRAM),
|
||||||
@ -61,29 +61,6 @@ CTrayWindow::CTrayWindow(HINSTANCE instance) : m_Instance(instance),
|
|||||||
m_Notification(TRAY_NOTIFICATION_NONE),
|
m_Notification(TRAY_NOTIFICATION_NONE),
|
||||||
m_IconEnabled(true)
|
m_IconEnabled(true)
|
||||||
{
|
{
|
||||||
WNDCLASS wc = {0};
|
|
||||||
wc.lpfnWndProc = (WNDPROC)WndProc;
|
|
||||||
wc.hInstance = instance;
|
|
||||||
wc.lpszClassName = L"RainmeterTrayClass";
|
|
||||||
wc.hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RAINMETER), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_SHARED);
|
|
||||||
|
|
||||||
RegisterClass(&wc);
|
|
||||||
|
|
||||||
m_Window = CreateWindowEx(
|
|
||||||
WS_EX_TOOLWINDOW,
|
|
||||||
L"RainmeterTrayClass",
|
|
||||||
NULL,
|
|
||||||
WS_POPUP | WS_DISABLED,
|
|
||||||
CW_USEDEFAULT,
|
|
||||||
CW_USEDEFAULT,
|
|
||||||
CW_USEDEFAULT,
|
|
||||||
CW_USEDEFAULT,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
instance,
|
|
||||||
this);
|
|
||||||
|
|
||||||
SetWindowPos(m_Window, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CTrayWindow::~CTrayWindow()
|
CTrayWindow::~CTrayWindow()
|
||||||
@ -103,6 +80,33 @@ CTrayWindow::~CTrayWindow()
|
|||||||
if (m_Window) DestroyWindow(m_Window);
|
if (m_Window) DestroyWindow(m_Window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CTrayWindow::Initialize()
|
||||||
|
{
|
||||||
|
WNDCLASS wc = {0};
|
||||||
|
wc.lpfnWndProc = (WNDPROC)WndProc;
|
||||||
|
wc.hInstance = Rainmeter->GetInstance();
|
||||||
|
wc.lpszClassName = L"RainmeterTrayClass";
|
||||||
|
wc.hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_RAINMETER), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_SHARED);
|
||||||
|
|
||||||
|
RegisterClass(&wc);
|
||||||
|
|
||||||
|
m_Window = CreateWindowEx(
|
||||||
|
WS_EX_TOOLWINDOW,
|
||||||
|
L"RainmeterTrayClass",
|
||||||
|
NULL,
|
||||||
|
WS_POPUP | WS_DISABLED,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
CW_USEDEFAULT,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
wc.hInstance,
|
||||||
|
this);
|
||||||
|
|
||||||
|
SetWindowPos(m_Window, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS);
|
||||||
|
}
|
||||||
|
|
||||||
void CTrayWindow::AddTrayIcon()
|
void CTrayWindow::AddTrayIcon()
|
||||||
{
|
{
|
||||||
if (m_Icon)
|
if (m_Icon)
|
||||||
@ -437,8 +441,6 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
if (tray)
|
|
||||||
{
|
|
||||||
if (wParam == IDM_MANAGE)
|
if (wParam == IDM_MANAGE)
|
||||||
{
|
{
|
||||||
CDialogManage::Open();
|
CDialogManage::Open();
|
||||||
@ -534,7 +536,6 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0; // Don't send WM_COMMANDS any further
|
return 0; // Don't send WM_COMMANDS any further
|
||||||
|
|
||||||
case WM_TRAY_NOTIFYICON:
|
case WM_TRAY_NOTIFYICON:
|
||||||
@ -660,7 +661,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
if (tray && tray->m_Measure)
|
if (tray->m_Measure)
|
||||||
{
|
{
|
||||||
tray->m_Measure->Update();
|
tray->m_Measure->Update();
|
||||||
tray->ModifyTrayIcon(tray->m_Measure->GetRelativeValue());
|
tray->ModifyTrayIcon(tray->m_Measure->GetRelativeValue());
|
||||||
@ -674,7 +675,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
default:
|
default:
|
||||||
if (uMsg == WM_TASKBARCREATED)
|
if (uMsg == WM_TASKBARCREATED)
|
||||||
{
|
{
|
||||||
if (tray && tray->IsTrayIconEnabled())
|
if (tray->IsTrayIconEnabled())
|
||||||
{
|
{
|
||||||
tray->RemoveTrayIcon();
|
tray->RemoveTrayIcon();
|
||||||
tray->AddTrayIcon();
|
tray->AddTrayIcon();
|
||||||
|
@ -41,9 +41,11 @@ class CMeasure;
|
|||||||
class CTrayWindow
|
class CTrayWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CTrayWindow(HINSTANCE instance);
|
CTrayWindow();
|
||||||
~CTrayWindow();
|
~CTrayWindow();
|
||||||
|
|
||||||
|
void Initialize();
|
||||||
|
|
||||||
void ReadConfig(CConfigParser& parser);
|
void ReadConfig(CConfigParser& parser);
|
||||||
HWND GetWindow() { return m_Window; }
|
HWND GetWindow() { return m_Window; }
|
||||||
bool IsTrayIconEnabled() { return m_IconEnabled; }
|
bool IsTrayIconEnabled() { return m_IconEnabled; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user