mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Remove "C" prefix in class names
This commit is contained in:
@@ -20,13 +20,13 @@
|
|||||||
#include <Commctrl.h>
|
#include <Commctrl.h>
|
||||||
#include <Uxtheme.h>
|
#include <Uxtheme.h>
|
||||||
|
|
||||||
HWND CDialog::c_ActiveDialogWindow = NULL;
|
HWND Dialog::c_ActiveDialogWindow = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// CBaseDialog
|
// BaseDialog
|
||||||
//
|
//
|
||||||
|
|
||||||
CBaseDialog::CBaseDialog() :
|
BaseDialog::BaseDialog() :
|
||||||
m_Window()
|
m_Window()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ CBaseDialog::CBaseDialog() :
|
|||||||
** Create (if not already) and show the dialog.
|
** Create (if not already) and show the dialog.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CBaseDialog::Show(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent, bool modeless)
|
void BaseDialog::Show(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent, bool modeless)
|
||||||
{
|
{
|
||||||
if (m_Window)
|
if (m_Window)
|
||||||
{
|
{
|
||||||
@@ -98,16 +98,16 @@ void CBaseDialog::Show(const WCHAR* title, short x, short y, short w, short h, D
|
|||||||
delete [] dt;
|
delete [] dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBaseDialog::CreateControls(const ControlTemplate::Control* cts, UINT ctCount, HFONT font, ControlTemplate::GetStringFunc getString)
|
void BaseDialog::CreateControls(const ControlTemplate::Control* cts, UINT ctCount, HFONT font, ControlTemplate::GetStringFunc getString)
|
||||||
{
|
{
|
||||||
ControlTemplate::CreateControls(cts, ctCount, m_Window, font, getString);
|
ControlTemplate::CreateControls(cts, ctCount, m_Window, font, getString);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CALLBACK CBaseDialog::InitialDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK BaseDialog::InitialDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (uMsg == WM_INITDIALOG)
|
if (uMsg == WM_INITDIALOG)
|
||||||
{
|
{
|
||||||
CBaseDialog* dialog = (CBaseDialog*)lParam;
|
BaseDialog* dialog = (BaseDialog*)lParam;
|
||||||
dialog->m_Window = hWnd;
|
dialog->m_Window = hWnd;
|
||||||
SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)dialog);
|
SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)dialog);
|
||||||
SetWindowLongPtr(hWnd, DWLP_DLGPROC, (LONG_PTR)MainDlgProc);
|
SetWindowLongPtr(hWnd, DWLP_DLGPROC, (LONG_PTR)MainDlgProc);
|
||||||
@@ -117,17 +117,17 @@ INT_PTR CALLBACK CBaseDialog::InitialDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CALLBACK CBaseDialog::MainDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK BaseDialog::MainDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
CBaseDialog* dialog = (CBaseDialog*)GetWindowLongPtr(hWnd, DWLP_USER);
|
BaseDialog* dialog = (BaseDialog*)GetWindowLongPtr(hWnd, DWLP_USER);
|
||||||
return dialog->HandleMessage(uMsg, wParam, lParam);
|
return dialog->HandleMessage(uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// CDialog
|
// Dialog
|
||||||
//
|
//
|
||||||
|
|
||||||
CDialog::CDialog() : CBaseDialog(),
|
Dialog::Dialog() : BaseDialog(),
|
||||||
m_Font(),
|
m_Font(),
|
||||||
m_FontBold()
|
m_FontBold()
|
||||||
{
|
{
|
||||||
@@ -140,25 +140,25 @@ CDialog::CDialog() : CBaseDialog(),
|
|||||||
m_FontBold = CreateFontIndirect(&ncm.lfMenuFont);
|
m_FontBold = CreateFontIndirect(&ncm.lfMenuFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
CDialog::~CDialog()
|
Dialog::~Dialog()
|
||||||
{
|
{
|
||||||
DestroyWindow(m_Window);
|
DestroyWindow(m_Window);
|
||||||
DeleteObject(m_Font);
|
DeleteObject(m_Font);
|
||||||
DeleteObject(m_FontBold);
|
DeleteObject(m_FontBold);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialog::ShowDialogWindow(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent, bool modeless)
|
void Dialog::ShowDialogWindow(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent, bool modeless)
|
||||||
{
|
{
|
||||||
Show(title, x, y, w, h, style, exStyle, parent, modeless);
|
Show(title, x, y, w, h, style, exStyle, parent, modeless);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialog::OnActivate(WPARAM wParam, LPARAM lParam)
|
INT_PTR Dialog::OnActivate(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
c_ActiveDialogWindow = wParam ? m_Window : NULL;
|
c_ActiveDialogWindow = wParam ? m_Window : NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDialog::HandleMessage(MSG& msg)
|
bool Dialog::HandleMessage(MSG& msg)
|
||||||
{
|
{
|
||||||
if (c_ActiveDialogWindow)
|
if (c_ActiveDialogWindow)
|
||||||
{
|
{
|
||||||
@@ -175,12 +175,12 @@ bool CDialog::HandleMessage(MSG& msg)
|
|||||||
** Subclass button control to draw arrow on the right.
|
** Subclass button control to draw arrow on the right.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialog::SetMenuButton(HWND button)
|
void Dialog::SetMenuButton(HWND button)
|
||||||
{
|
{
|
||||||
SetWindowSubclass(button, MenuButtonProc, NULL, NULL);
|
SetWindowSubclass(button, MenuButtonProc, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK CDialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
|
LRESULT CALLBACK Dialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
|
||||||
{
|
{
|
||||||
LRESULT result = DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
LRESULT result = DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||||
|
|
||||||
@@ -227,15 +227,15 @@ LRESULT CALLBACK CDialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// CTab
|
// Tab
|
||||||
//
|
//
|
||||||
|
|
||||||
CDialog::CTab::CTab() : CBaseDialog(),
|
Dialog::Tab::Tab() : BaseDialog(),
|
||||||
m_Initialized(false)
|
m_Initialized(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialog::CTab::CreateTabWindow(short x, short y, short w, short h, HWND owner)
|
void Dialog::Tab::CreateTabWindow(short x, short y, short w, short h, HWND owner)
|
||||||
{
|
{
|
||||||
const DWORD style = DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
|
const DWORD style = DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
|
||||||
const DWORD exStyle = WS_EX_CONTROLPARENT;
|
const DWORD exStyle = WS_EX_CONTROLPARENT;
|
||||||
@@ -244,12 +244,12 @@ void CDialog::CTab::CreateTabWindow(short x, short y, short w, short h, HWND own
|
|||||||
EnableThemeDialogTexture(m_Window, ETDT_ENABLETAB);
|
EnableThemeDialogTexture(m_Window, ETDT_ENABLETAB);
|
||||||
}
|
}
|
||||||
|
|
||||||
CDialog::CTab::~CTab()
|
Dialog::Tab::~Tab()
|
||||||
{
|
{
|
||||||
DestroyWindow(m_Window);
|
DestroyWindow(m_Window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialog::CTab::Activate()
|
void Dialog::Tab::Activate()
|
||||||
{
|
{
|
||||||
if (!m_Initialized)
|
if (!m_Initialized)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,15 +22,15 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include "ControlTemplate.h"
|
#include "ControlTemplate.h"
|
||||||
|
|
||||||
// Shared base class for CDialog and CTab.
|
// Shared base class for Dialog and Tab.
|
||||||
class CBaseDialog
|
class BaseDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HWND GetControl(WORD id) { return GetDlgItem(m_Window, id); }
|
HWND GetControl(WORD id) { return GetDlgItem(m_Window, id); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CBaseDialog();
|
BaseDialog();
|
||||||
virtual ~CBaseDialog() {}
|
virtual ~BaseDialog() {}
|
||||||
|
|
||||||
void Show(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent, bool modeless);
|
void Show(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent, bool modeless);
|
||||||
|
|
||||||
@@ -41,13 +41,13 @@ protected:
|
|||||||
HWND m_Window;
|
HWND m_Window;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CBaseDialog(const CBaseDialog& r);
|
BaseDialog(const BaseDialog& r);
|
||||||
|
|
||||||
static INT_PTR CALLBACK InitialDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static INT_PTR CALLBACK InitialDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
static INT_PTR CALLBACK MainDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static INT_PTR CALLBACK MainDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CDialog : public CBaseDialog
|
class Dialog : public BaseDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HWND GetWindow() { return m_Window; }
|
HWND GetWindow() { return m_Window; }
|
||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
static bool HandleMessage(MSG& msg);
|
static bool HandleMessage(MSG& msg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
class CTab : public CBaseDialog
|
class Tab : public BaseDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HWND GetWindow() { return m_Window; }
|
HWND GetWindow() { return m_Window; }
|
||||||
@@ -66,16 +66,16 @@ protected:
|
|||||||
virtual void Resize(int w, int h) {}
|
virtual void Resize(int w, int h) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CTab();
|
Tab();
|
||||||
virtual ~CTab();
|
virtual ~Tab();
|
||||||
|
|
||||||
void CreateTabWindow(short x, short y, short w, short h, HWND owner);
|
void CreateTabWindow(short x, short y, short w, short h, HWND owner);
|
||||||
|
|
||||||
bool m_Initialized;
|
bool m_Initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
CDialog();
|
Dialog();
|
||||||
virtual ~CDialog();
|
virtual ~Dialog();
|
||||||
|
|
||||||
void ShowDialogWindow(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent, bool modeless = true);
|
void ShowDialogWindow(const WCHAR* title, short x, short y, short w, short h, DWORD style, DWORD exStyle, HWND parent, bool modeless = true);
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ protected:
|
|||||||
HFONT m_FontBold;
|
HFONT m_FontBold;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CDialog(const CDialog& r);
|
Dialog(const Dialog& r);
|
||||||
|
|
||||||
static LRESULT CALLBACK MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData);
|
static LRESULT CALLBACK MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData);
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,11 @@
|
|||||||
#include "TrayWindow.h"
|
#include "TrayWindow.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
typedef void (* BangHandlerFunc)(std::vector<std::wstring>& args, CMeterWindow* skin);
|
typedef void (* BangHandlerFunc)(std::vector<std::wstring>& args, MeterWindow* skin);
|
||||||
|
|
||||||
struct BangInfo
|
struct BangInfo
|
||||||
{
|
{
|
||||||
@@ -123,25 +123,25 @@ const BangInfo s_GroupBangs[] =
|
|||||||
// Bangs that are to be handled using a custom handler function.
|
// Bangs that are to be handled using a custom handler function.
|
||||||
const CustomBangInfo s_CustomBangs[] =
|
const CustomBangInfo s_CustomBangs[] =
|
||||||
{
|
{
|
||||||
{ Bang::ActivateConfig, L"ActivateConfig", CCommandHandler::DoActivateSkinBang },
|
{ Bang::ActivateConfig, L"ActivateConfig", CommandHandler::DoActivateSkinBang },
|
||||||
{ Bang::DeactivateConfig, L"DeactivateConfig", CCommandHandler::DoDeactivateSkinBang },
|
{ Bang::DeactivateConfig, L"DeactivateConfig", CommandHandler::DoDeactivateSkinBang },
|
||||||
{ Bang::ToggleConfig, L"ToggleConfig", CCommandHandler::DoToggleSkinBang },
|
{ Bang::ToggleConfig, L"ToggleConfig", CommandHandler::DoToggleSkinBang },
|
||||||
{ Bang::WriteKeyValue, L"WriteKeyValue", CCommandHandler::DoWriteKeyValueBang },
|
{ Bang::WriteKeyValue, L"WriteKeyValue", CommandHandler::DoWriteKeyValueBang },
|
||||||
{ Bang::LoadLayout, L"LoadLayout", CCommandHandler::DoLoadLayoutBang },
|
{ Bang::LoadLayout, L"LoadLayout", CommandHandler::DoLoadLayoutBang },
|
||||||
{ Bang::SetClip, L"SetClip", CCommandHandler::DoSetClipBang },
|
{ Bang::SetClip, L"SetClip", CommandHandler::DoSetClipBang },
|
||||||
{ Bang::SetWallpaper, L"SetWallpaper", CCommandHandler::DoSetWallpaperBang },
|
{ Bang::SetWallpaper, L"SetWallpaper", CommandHandler::DoSetWallpaperBang },
|
||||||
{ Bang::About, L"About", CCommandHandler::DoAboutBang },
|
{ Bang::About, L"About", CommandHandler::DoAboutBang },
|
||||||
{ Bang::Manage, L"Manage", CCommandHandler::DoManageBang },
|
{ Bang::Manage, L"Manage", CommandHandler::DoManageBang },
|
||||||
{ Bang::SkinMenu, L"SkinMenu", CCommandHandler::DoSkinMenuBang },
|
{ Bang::SkinMenu, L"SkinMenu", CommandHandler::DoSkinMenuBang },
|
||||||
{ Bang::TrayMenu, L"TrayMenu", CCommandHandler::DoTrayMenuBang },
|
{ Bang::TrayMenu, L"TrayMenu", CommandHandler::DoTrayMenuBang },
|
||||||
{ Bang::ResetStats, L"ResetStats", CCommandHandler::DoResetStatsBang },
|
{ Bang::ResetStats, L"ResetStats", CommandHandler::DoResetStatsBang },
|
||||||
{ Bang::Log, L"Log", CCommandHandler::DoLogBang },
|
{ Bang::Log, L"Log", CommandHandler::DoLogBang },
|
||||||
{ Bang::RefreshApp, L"RefreshApp", CCommandHandler::DoRefreshApp },
|
{ Bang::RefreshApp, L"RefreshApp", CommandHandler::DoRefreshApp },
|
||||||
{ Bang::Quit, L"Quit", CCommandHandler::DoQuitBang },
|
{ Bang::Quit, L"Quit", CommandHandler::DoQuitBang },
|
||||||
{ Bang::LsBoxHook, L"LsBoxHook", CCommandHandler::DoLsBoxHookBang }
|
{ Bang::LsBoxHook, L"LsBoxHook", CommandHandler::DoLsBoxHookBang }
|
||||||
};
|
};
|
||||||
|
|
||||||
void DoBang(const BangInfo& bangInfo, std::vector<std::wstring>& args, CMeterWindow* skin)
|
void DoBang(const BangInfo& bangInfo, std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
const size_t argsCount = args.size();
|
const size_t argsCount = args.size();
|
||||||
if (argsCount >= bangInfo.argCount)
|
if (argsCount >= bangInfo.argCount)
|
||||||
@@ -158,7 +158,7 @@ void DoBang(const BangInfo& bangInfo, std::vector<std::wstring>& args, CMeterWin
|
|||||||
const std::wstring& folderPath = args[bangInfo.argCount];
|
const std::wstring& folderPath = args[bangInfo.argCount];
|
||||||
if (!folderPath.empty() && (folderPath.length() != 1 || folderPath[0] != L'*'))
|
if (!folderPath.empty() && (folderPath.length() != 1 || folderPath[0] != L'*'))
|
||||||
{
|
{
|
||||||
CMeterWindow* skin = Rainmeter->GetMeterWindow(folderPath);
|
MeterWindow* skin = g_Rainmeter->GetMeterWindow(folderPath);
|
||||||
if (skin)
|
if (skin)
|
||||||
{
|
{
|
||||||
skin->DoBang(bangInfo.bang, args);
|
skin->DoBang(bangInfo.bang, args);
|
||||||
@@ -172,7 +172,7 @@ void DoBang(const BangInfo& bangInfo, std::vector<std::wstring>& args, CMeterWin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No skin defined -> apply to all.
|
// No skin defined -> apply to all.
|
||||||
for (const auto& ip : Rainmeter->GetAllMeterWindows())
|
for (const auto& ip : g_Rainmeter->GetAllMeterWindows())
|
||||||
{
|
{
|
||||||
ip.second->DoBang(bangInfo.bang, args);
|
ip.second->DoBang(bangInfo.bang, args);
|
||||||
}
|
}
|
||||||
@@ -201,17 +201,17 @@ void DoBang(const BangInfo& bangInfo, std::vector<std::wstring>& args, CMeterWin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoGroupBang(const BangInfo& bangInfo, std::vector<std::wstring>& args, CMeterWindow* skin)
|
void DoGroupBang(const BangInfo& bangInfo, std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
if (args.size() > bangInfo.argCount)
|
if (args.size() > bangInfo.argCount)
|
||||||
{
|
{
|
||||||
std::multimap<int, CMeterWindow*> windows;
|
std::multimap<int, MeterWindow*> windows;
|
||||||
Rainmeter->GetMeterWindowsByLoadOrder(windows, args[bangInfo.argCount]);
|
g_Rainmeter->GetMeterWindowsByLoadOrder(windows, args[bangInfo.argCount]);
|
||||||
|
|
||||||
// Remove extra parameters (including group).
|
// Remove extra parameters (including group).
|
||||||
args.resize(bangInfo.argCount);
|
args.resize(bangInfo.argCount);
|
||||||
|
|
||||||
std::multimap<int, CMeterWindow*>::const_iterator iter = windows.begin();
|
std::multimap<int, MeterWindow*>::const_iterator iter = windows.begin();
|
||||||
for (const auto& ip : windows)
|
for (const auto& ip : windows)
|
||||||
{
|
{
|
||||||
DoBang(bangInfo, args, ip.second);
|
DoBang(bangInfo, args, ip.second);
|
||||||
@@ -229,7 +229,7 @@ void DoGroupBang(const BangInfo& bangInfo, std::vector<std::wstring>& args, CMet
|
|||||||
** Parses and executes the given command.
|
** Parses and executes the given command.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CCommandHandler::ExecuteCommand(const WCHAR* command, CMeterWindow* skin, bool multi)
|
void CommandHandler::ExecuteCommand(const WCHAR* command, MeterWindow* skin, bool multi)
|
||||||
{
|
{
|
||||||
if (command[0] == L'!') // Bang
|
if (command[0] == L'!') // Bang
|
||||||
{
|
{
|
||||||
@@ -373,7 +373,7 @@ void CCommandHandler::ExecuteCommand(const WCHAR* command, CMeterWindow* skin, b
|
|||||||
** Runs the given bang.
|
** Runs the given bang.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CCommandHandler::ExecuteBang(const WCHAR* name, std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::ExecuteBang(const WCHAR* name, std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
for (const auto& bangInfo : s_Bangs)
|
for (const auto& bangInfo : s_Bangs)
|
||||||
{
|
{
|
||||||
@@ -409,7 +409,7 @@ void CCommandHandler::ExecuteBang(const WCHAR* name, std::vector<std::wstring>&
|
|||||||
** Parses and runs the given command.
|
** Parses and runs the given command.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CCommandHandler::RunCommand(std::wstring command)
|
void CommandHandler::RunCommand(std::wstring command)
|
||||||
{
|
{
|
||||||
std::wstring args;
|
std::wstring args;
|
||||||
|
|
||||||
@@ -450,7 +450,7 @@ void CCommandHandler::RunCommand(std::wstring command)
|
|||||||
** Runs a file with the given arguments.
|
** Runs a file with the given arguments.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CCommandHandler::RunFile(const WCHAR* file, const WCHAR* args)
|
void CommandHandler::RunFile(const WCHAR* file, const WCHAR* args)
|
||||||
{
|
{
|
||||||
SHELLEXECUTEINFO si = {sizeof(SHELLEXECUTEINFO)};
|
SHELLEXECUTEINFO si = {sizeof(SHELLEXECUTEINFO)};
|
||||||
si.lpVerb = L"open";
|
si.lpVerb = L"open";
|
||||||
@@ -464,7 +464,7 @@ void CCommandHandler::RunFile(const WCHAR* file, const WCHAR* args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring dir = CRainmeter::ExtractPath(file);
|
std::wstring dir = Rainmeter::ExtractPath(file);
|
||||||
si.lpDirectory = dir.c_str();
|
si.lpDirectory = dir.c_str();
|
||||||
si.lpParameters = args;
|
si.lpParameters = args;
|
||||||
si.fMask = SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI;
|
si.fMask = SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI;
|
||||||
@@ -476,7 +476,7 @@ void CCommandHandler::RunFile(const WCHAR* file, const WCHAR* args)
|
|||||||
** Splits strings into parts.
|
** Splits strings into parts.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
std::vector<std::wstring> CCommandHandler::ParseString(LPCTSTR str, CConfigParser* parser)
|
std::vector<std::wstring> CommandHandler::ParseString(LPCTSTR str, ConfigParser* parser)
|
||||||
{
|
{
|
||||||
std::vector<std::wstring> result;
|
std::vector<std::wstring> result;
|
||||||
|
|
||||||
@@ -574,28 +574,28 @@ std::vector<std::wstring> CCommandHandler::ParseString(LPCTSTR str, CConfigParse
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoActivateSkinBang(std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::DoActivateSkinBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
if (args.size() == 1)
|
if (args.size() == 1)
|
||||||
{
|
{
|
||||||
int index = Rainmeter->FindSkinFolderIndex(args[0]);
|
int index = g_Rainmeter->FindSkinFolderIndex(args[0]);
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
const CRainmeter::SkinFolder& skinFolder = Rainmeter->m_SkinFolders[index];
|
const Rainmeter::SkinFolder& skinFolder = g_Rainmeter->m_SkinFolders[index];
|
||||||
if (!(skinFolder.active == 1 && skinFolder.files.size() == 1))
|
if (!(skinFolder.active == 1 && skinFolder.files.size() == 1))
|
||||||
{
|
{
|
||||||
// Activate the next index.
|
// Activate the next index.
|
||||||
Rainmeter->ActivateSkin(index, (skinFolder.active < skinFolder.files.size()) ? skinFolder.active : 0);
|
g_Rainmeter->ActivateSkin(index, (skinFolder.active < skinFolder.files.size()) ? skinFolder.active : 0);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args.size() > 1)
|
else if (args.size() > 1)
|
||||||
{
|
{
|
||||||
std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(args[0], args[1]);
|
std::pair<int, int> indexes = g_Rainmeter->GetMeterWindowIndex(args[0], args[1]);
|
||||||
if (indexes.first != -1 && indexes.second != -1)
|
if (indexes.first != -1 && indexes.second != -1)
|
||||||
{
|
{
|
||||||
Rainmeter->ActivateSkin(indexes.first, indexes.second);
|
g_Rainmeter->ActivateSkin(indexes.first, indexes.second);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -603,11 +603,11 @@ void CCommandHandler::DoActivateSkinBang(std::vector<std::wstring>& args, CMeter
|
|||||||
LogError(L"!ActivateConfig: Invalid parameters");
|
LogError(L"!ActivateConfig: Invalid parameters");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoDeactivateSkinBang(std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::DoDeactivateSkinBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
if (!args.empty())
|
if (!args.empty())
|
||||||
{
|
{
|
||||||
skin = Rainmeter->GetMeterWindow(args[0]);
|
skin = g_Rainmeter->GetMeterWindow(args[0]);
|
||||||
if (!skin)
|
if (!skin)
|
||||||
{
|
{
|
||||||
LogWarningF(L"!DeactivateConfig: \"%s\" not active", args[0].c_str());
|
LogWarningF(L"!DeactivateConfig: \"%s\" not active", args[0].c_str());
|
||||||
@@ -617,7 +617,7 @@ void CCommandHandler::DoDeactivateSkinBang(std::vector<std::wstring>& args, CMet
|
|||||||
|
|
||||||
if (skin)
|
if (skin)
|
||||||
{
|
{
|
||||||
Rainmeter->DeactivateSkin(skin, -1);
|
g_Rainmeter->DeactivateSkin(skin, -1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -625,14 +625,14 @@ void CCommandHandler::DoDeactivateSkinBang(std::vector<std::wstring>& args, CMet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoToggleSkinBang(std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::DoToggleSkinBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
if (args.size() >= 2)
|
if (args.size() >= 2)
|
||||||
{
|
{
|
||||||
CMeterWindow* skin = Rainmeter->GetMeterWindow(args[0]);
|
MeterWindow* skin = g_Rainmeter->GetMeterWindow(args[0]);
|
||||||
if (skin)
|
if (skin)
|
||||||
{
|
{
|
||||||
Rainmeter->DeactivateSkin(skin, -1);
|
g_Rainmeter->DeactivateSkin(skin, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -645,15 +645,15 @@ void CCommandHandler::DoToggleSkinBang(std::vector<std::wstring>& args, CMeterWi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoDeactivateSkinGroupBang(std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::DoDeactivateSkinGroupBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
if (!args.empty())
|
if (!args.empty())
|
||||||
{
|
{
|
||||||
std::multimap<int, CMeterWindow*> windows;
|
std::multimap<int, MeterWindow*> windows;
|
||||||
Rainmeter->GetMeterWindowsByLoadOrder(windows, args[0]);
|
g_Rainmeter->GetMeterWindowsByLoadOrder(windows, args[0]);
|
||||||
for (const auto& ip : windows)
|
for (const auto& ip : windows)
|
||||||
{
|
{
|
||||||
Rainmeter->DeactivateSkin(ip.second, -1);
|
g_Rainmeter->DeactivateSkin(ip.second, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -662,7 +662,7 @@ void CCommandHandler::DoDeactivateSkinGroupBang(std::vector<std::wstring>& args,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoLoadLayoutBang(std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::DoLoadLayoutBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
if (args.size() == 1)
|
if (args.size() == 1)
|
||||||
{
|
{
|
||||||
@@ -672,21 +672,21 @@ void CCommandHandler::DoLoadLayoutBang(std::vector<std::wstring>& args, CMeterWi
|
|||||||
std::wstring command = L"!LoadLayout \"";
|
std::wstring command = L"!LoadLayout \"";
|
||||||
command += args[0];
|
command += args[0];
|
||||||
command += L'"';
|
command += L'"';
|
||||||
Rainmeter->DelayedExecuteCommand(command.c_str());
|
g_Rainmeter->DelayedExecuteCommand(command.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Not called from a skin (or called with delay).
|
// Not called from a skin (or called with delay).
|
||||||
Rainmeter->LoadLayout(args[0]);
|
g_Rainmeter->LoadLayout(args[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoSetClipBang(std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::DoSetClipBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
if (!args.empty())
|
if (!args.empty())
|
||||||
{
|
{
|
||||||
CSystem::SetClipboardText(args[0]);
|
System::SetClipboardText(args[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -694,7 +694,7 @@ void CCommandHandler::DoSetClipBang(std::vector<std::wstring>& args, CMeterWindo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoSetWallpaperBang(std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::DoSetWallpaperBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
const size_t argsSize = args.size();
|
const size_t argsSize = args.size();
|
||||||
if (argsSize >= 1 && argsSize <= 2)
|
if (argsSize >= 1 && argsSize <= 2)
|
||||||
@@ -707,7 +707,7 @@ void CCommandHandler::DoSetWallpaperBang(std::vector<std::wstring>& args, CMeter
|
|||||||
skin->MakePathAbsolute(file);
|
skin->MakePathAbsolute(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSystem::SetWallpaper(file, style);
|
System::SetWallpaper(file, style);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -715,21 +715,21 @@ void CCommandHandler::DoSetWallpaperBang(std::vector<std::wstring>& args, CMeter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoAboutBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow)
|
void CommandHandler::DoAboutBang(std::vector<std::wstring>& args, MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
CDialogAbout::Open(args.empty() ? L"" : args[0].c_str());
|
DialogAbout::Open(args.empty() ? L"" : args[0].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoManageBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow)
|
void CommandHandler::DoManageBang(std::vector<std::wstring>& args, MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
CDialogManage::Open(args.empty() ? L"" : args[0].c_str());
|
DialogManage::Open(args.empty() ? L"" : args[0].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoSkinMenuBang(std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::DoSkinMenuBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
if (!args.empty())
|
if (!args.empty())
|
||||||
{
|
{
|
||||||
skin = Rainmeter->GetMeterWindow(args[0]);
|
skin = g_Rainmeter->GetMeterWindow(args[0]);
|
||||||
if (!skin)
|
if (!skin)
|
||||||
{
|
{
|
||||||
LogWarningF(L"!SkinMenu: \"%s\" not active", args[0].c_str());
|
LogWarningF(L"!SkinMenu: \"%s\" not active", args[0].c_str());
|
||||||
@@ -739,8 +739,8 @@ void CCommandHandler::DoSkinMenuBang(std::vector<std::wstring>& args, CMeterWind
|
|||||||
|
|
||||||
if (skin)
|
if (skin)
|
||||||
{
|
{
|
||||||
POINT pos = CSystem::GetCursorPosition();
|
POINT pos = System::GetCursorPosition();
|
||||||
Rainmeter->ShowContextMenu(pos, skin);
|
g_Rainmeter->ShowContextMenu(pos, skin);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -748,18 +748,18 @@ void CCommandHandler::DoSkinMenuBang(std::vector<std::wstring>& args, CMeterWind
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoTrayMenuBang(std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::DoTrayMenuBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
POINT pos = CSystem::GetCursorPosition();
|
POINT pos = System::GetCursorPosition();
|
||||||
Rainmeter->ShowContextMenu(pos, NULL);
|
g_Rainmeter->ShowContextMenu(pos, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoResetStatsBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow)
|
void CommandHandler::DoResetStatsBang(std::vector<std::wstring>& args, MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
Rainmeter->ResetStats();
|
g_Rainmeter->ResetStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoWriteKeyValueBang(std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::DoWriteKeyValueBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
if (args.size() == 3 && skin)
|
if (args.size() == 3 && skin)
|
||||||
{
|
{
|
||||||
@@ -786,8 +786,8 @@ void CCommandHandler::DoWriteKeyValueBang(std::vector<std::wstring>& args, CMete
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_wcsnicmp(iniFile, Rainmeter->m_SkinPath.c_str(), Rainmeter->m_SkinPath.size()) != 0 &&
|
if (_wcsnicmp(iniFile, g_Rainmeter->m_SkinPath.c_str(), g_Rainmeter->m_SkinPath.size()) != 0 &&
|
||||||
_wcsnicmp(iniFile, Rainmeter->m_SettingsPath.c_str(), Rainmeter->m_SettingsPath.size()) != 0)
|
_wcsnicmp(iniFile, g_Rainmeter->m_SettingsPath.c_str(), g_Rainmeter->m_SettingsPath.size()) != 0)
|
||||||
{
|
{
|
||||||
LogErrorF(L"!WriteKeyValue: Illegal path: %s", iniFile);
|
LogErrorF(L"!WriteKeyValue: Illegal path: %s", iniFile);
|
||||||
return;
|
return;
|
||||||
@@ -809,8 +809,8 @@ void CCommandHandler::DoWriteKeyValueBang(std::vector<std::wstring>& args, CMete
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Avoid "IniFileMapping"
|
// Avoid "IniFileMapping"
|
||||||
CSystem::UpdateIniFileMappingList();
|
System::UpdateIniFileMappingList();
|
||||||
std::wstring strIniWrite = CSystem::GetTemporaryFile(strIniFile);
|
std::wstring strIniWrite = System::GetTemporaryFile(strIniFile);
|
||||||
if (strIniWrite.size() == 1 && strIniWrite[0] == L'?') // error occurred
|
if (strIniWrite.size() == 1 && strIniWrite[0] == L'?') // error occurred
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -820,14 +820,14 @@ void CCommandHandler::DoWriteKeyValueBang(std::vector<std::wstring>& args, CMete
|
|||||||
|
|
||||||
if (temporary)
|
if (temporary)
|
||||||
{
|
{
|
||||||
if (Rainmeter->GetDebug())
|
if (g_Rainmeter->GetDebug())
|
||||||
{
|
{
|
||||||
LogDebugF(L"!WriteKeyValue: Writing to: %s (Temp: %s)", iniFile, strIniWrite.c_str());
|
LogDebugF(L"!WriteKeyValue: Writing to: %s (Temp: %s)", iniFile, strIniWrite.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Rainmeter->GetDebug())
|
if (g_Rainmeter->GetDebug())
|
||||||
{
|
{
|
||||||
LogDebugF(L"!WriteKeyValue: Writing to: %s", iniFile);
|
LogDebugF(L"!WriteKeyValue: Writing to: %s", iniFile);
|
||||||
}
|
}
|
||||||
@@ -850,7 +850,7 @@ void CCommandHandler::DoWriteKeyValueBang(std::vector<std::wstring>& args, CMete
|
|||||||
{
|
{
|
||||||
WCHAR buffer[256];
|
WCHAR buffer[256];
|
||||||
int len = _snwprintf_s(buffer, _TRUNCATE, L"%.5f", value);
|
int len = _snwprintf_s(buffer, _TRUNCATE, L"%.5f", value);
|
||||||
CMeasure::RemoveTrailingZero(buffer, len);
|
Measure::RemoveTrailingZero(buffer, len);
|
||||||
|
|
||||||
write = WritePrivateProfileString(section, key, buffer, iniWrite);
|
write = WritePrivateProfileString(section, key, buffer, iniWrite);
|
||||||
}
|
}
|
||||||
@@ -868,7 +868,7 @@ void CCommandHandler::DoWriteKeyValueBang(std::vector<std::wstring>& args, CMete
|
|||||||
WritePrivateProfileString(NULL, NULL, NULL, iniWrite); // FLUSH
|
WritePrivateProfileString(NULL, NULL, NULL, iniWrite); // FLUSH
|
||||||
|
|
||||||
// Copy the file back.
|
// Copy the file back.
|
||||||
if (!CSystem::CopyFiles(strIniWrite, strIniFile))
|
if (!System::CopyFiles(strIniWrite, strIniFile))
|
||||||
{
|
{
|
||||||
LogErrorF(L"!WriteKeyValue: Failed to copy temporary file to original filepath: %s (Temp: %s)", iniFile, iniWrite);
|
LogErrorF(L"!WriteKeyValue: Failed to copy temporary file to original filepath: %s (Temp: %s)", iniFile, iniWrite);
|
||||||
}
|
}
|
||||||
@@ -879,7 +879,7 @@ void CCommandHandler::DoWriteKeyValueBang(std::vector<std::wstring>& args, CMete
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove the temporary file.
|
// Remove the temporary file.
|
||||||
CSystem::RemoveFile(strIniWrite);
|
System::RemoveFile(strIniWrite);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -890,25 +890,25 @@ void CCommandHandler::DoWriteKeyValueBang(std::vector<std::wstring>& args, CMete
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoLogBang(std::vector<std::wstring>& args, CMeterWindow* skin)
|
void CommandHandler::DoLogBang(std::vector<std::wstring>& args, MeterWindow* skin)
|
||||||
{
|
{
|
||||||
if (!args.empty())
|
if (!args.empty())
|
||||||
{
|
{
|
||||||
CLogger::Level level = CLogger::Level::Notice;
|
Logger::Level level = Logger::Level::Notice;
|
||||||
if (args.size() > 1)
|
if (args.size() > 1)
|
||||||
{
|
{
|
||||||
const WCHAR* type = args[1].c_str();
|
const WCHAR* type = args[1].c_str();
|
||||||
if (_wcsicmp(type, L"ERROR") == 0)
|
if (_wcsicmp(type, L"ERROR") == 0)
|
||||||
{
|
{
|
||||||
level = CLogger::Level::Error;
|
level = Logger::Level::Error;
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(type, L"WARNING") == 0)
|
else if (_wcsicmp(type, L"WARNING") == 0)
|
||||||
{
|
{
|
||||||
level = CLogger::Level::Warning;
|
level = Logger::Level::Warning;
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(type, L"DEBUG") == 0)
|
else if (_wcsicmp(type, L"DEBUG") == 0)
|
||||||
{
|
{
|
||||||
level = CLogger::Level::Debug;
|
level = Logger::Level::Debug;
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(type, L"NOTICE") != 0)
|
else if (_wcsicmp(type, L"NOTICE") != 0)
|
||||||
{
|
{
|
||||||
@@ -917,23 +917,23 @@ void CCommandHandler::DoLogBang(std::vector<std::wstring>& args, CMeterWindow* s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CLogger::GetInstance().Log(level, args[0].c_str());
|
Logger::GetInstance().Log(level, args[0].c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoRefreshApp(std::vector<std::wstring>& args, CMeterWindow* meterWindow)
|
void CommandHandler::DoRefreshApp(std::vector<std::wstring>& args, MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
// Refresh needs to be delayed since it crashes if done during Update().
|
// Refresh needs to be delayed since it crashes if done during Update().
|
||||||
PostMessage(Rainmeter->m_Window, WM_RAINMETER_DELAYED_REFRESH_ALL, NULL, NULL);
|
PostMessage(g_Rainmeter->m_Window, WM_RAINMETER_DELAYED_REFRESH_ALL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoQuitBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow)
|
void CommandHandler::DoQuitBang(std::vector<std::wstring>& args, MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
// Quit needs to be delayed since it crashes if done during Update().
|
// Quit needs to be delayed since it crashes if done during Update().
|
||||||
PostMessage(Rainmeter->GetTrayWindow()->GetWindow(), WM_COMMAND, MAKEWPARAM(IDM_QUIT, 0), NULL);
|
PostMessage(g_Rainmeter->GetTrayWindow()->GetWindow(), WM_COMMAND, MAKEWPARAM(IDM_QUIT, 0), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCommandHandler::DoLsBoxHookBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow)
|
void CommandHandler::DoLsBoxHookBang(std::vector<std::wstring>& args, MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
// Deprecated.
|
// Deprecated.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class CConfigParser;
|
class ConfigParser;
|
||||||
class CMeterWindow;
|
class MeterWindow;
|
||||||
|
|
||||||
enum class Bang
|
enum class Bang
|
||||||
{
|
{
|
||||||
@@ -108,34 +108,34 @@ enum class Bang
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Parses and executes commands and bangs.
|
// Parses and executes commands and bangs.
|
||||||
class CCommandHandler
|
class CommandHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void ExecuteCommand(const WCHAR* command, CMeterWindow* skin, bool multi = true);
|
void ExecuteCommand(const WCHAR* command, MeterWindow* skin, bool multi = true);
|
||||||
void ExecuteBang(const WCHAR* name, std::vector<std::wstring>& args, CMeterWindow* skin);
|
void ExecuteBang(const WCHAR* name, std::vector<std::wstring>& args, MeterWindow* skin);
|
||||||
|
|
||||||
static void RunCommand(std::wstring command);
|
static void RunCommand(std::wstring command);
|
||||||
static void RunFile(const WCHAR* file, const WCHAR* args = NULL);
|
static void RunFile(const WCHAR* file, const WCHAR* args = NULL);
|
||||||
|
|
||||||
static std::vector<std::wstring> ParseString(const WCHAR* str, CConfigParser* parser = NULL);
|
static std::vector<std::wstring> ParseString(const WCHAR* str, ConfigParser* parser = NULL);
|
||||||
|
|
||||||
static void DoActivateSkinBang(std::vector<std::wstring>& args, CMeterWindow* skin);
|
static void DoActivateSkinBang(std::vector<std::wstring>& args, MeterWindow* skin);
|
||||||
static void DoDeactivateSkinBang(std::vector<std::wstring>& args, CMeterWindow* skin);
|
static void DoDeactivateSkinBang(std::vector<std::wstring>& args, MeterWindow* skin);
|
||||||
static void DoToggleSkinBang(std::vector<std::wstring>& args, CMeterWindow* skin);
|
static void DoToggleSkinBang(std::vector<std::wstring>& args, MeterWindow* skin);
|
||||||
static void DoDeactivateSkinGroupBang(std::vector<std::wstring>& args, CMeterWindow* skin);
|
static void DoDeactivateSkinGroupBang(std::vector<std::wstring>& args, MeterWindow* skin);
|
||||||
static void DoLoadLayoutBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
static void DoLoadLayoutBang(std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
static void DoSetClipBang(std::vector<std::wstring>& args, CMeterWindow* skin);
|
static void DoSetClipBang(std::vector<std::wstring>& args, MeterWindow* skin);
|
||||||
static void DoSetWallpaperBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
static void DoSetWallpaperBang(std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
static void DoAboutBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
static void DoAboutBang(std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
static void DoManageBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
static void DoManageBang(std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
static void DoSkinMenuBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
static void DoSkinMenuBang(std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
static void DoTrayMenuBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
static void DoTrayMenuBang(std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
static void DoResetStatsBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
static void DoResetStatsBang(std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
static void DoWriteKeyValueBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
static void DoWriteKeyValueBang(std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
static void DoLogBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
static void DoLogBang(std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
static void DoRefreshApp(std::vector<std::wstring>& args, CMeterWindow* skin);
|
static void DoRefreshApp(std::vector<std::wstring>& args, MeterWindow* skin);
|
||||||
static void DoQuitBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
static void DoQuitBang(std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
static void DoLsBoxHookBang(std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
static void DoLsBoxHookBang(std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -26,17 +26,17 @@
|
|||||||
#include "Meter.h"
|
#include "Meter.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
using namespace Gdiplus;
|
using namespace Gdiplus;
|
||||||
|
|
||||||
std::unordered_map<std::wstring, std::wstring> CConfigParser::c_MonitorVariables;
|
std::unordered_map<std::wstring, std::wstring> ConfigParser::c_MonitorVariables;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CConfigParser::CConfigParser() :
|
ConfigParser::ConfigParser() :
|
||||||
m_LastReplaced(false),
|
m_LastReplaced(false),
|
||||||
m_LastDefaultUsed(false),
|
m_LastDefaultUsed(false),
|
||||||
m_LastValueDefined(false),
|
m_LastValueDefined(false),
|
||||||
@@ -49,11 +49,11 @@ CConfigParser::CConfigParser() :
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CConfigParser::~CConfigParser()
|
ConfigParser::~ConfigParser()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meterWindow, LPCTSTR skinSection, const std::wstring* resourcePath)
|
void ConfigParser::Initialize(const std::wstring& filename, MeterWindow* meterWindow, LPCTSTR skinSection, const std::wstring* resourcePath)
|
||||||
{
|
{
|
||||||
m_MeterWindow = meterWindow;
|
m_MeterWindow = meterWindow;
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meter
|
|||||||
SetBuiltInVariables(filename, resourcePath, meterWindow);
|
SetBuiltInVariables(filename, resourcePath, meterWindow);
|
||||||
ResetMonitorVariables(meterWindow);
|
ResetMonitorVariables(meterWindow);
|
||||||
|
|
||||||
CSystem::UpdateIniFileMappingList();
|
System::UpdateIniFileMappingList();
|
||||||
|
|
||||||
ReadIniFile(filename, skinSection);
|
ReadIniFile(filename, skinSection);
|
||||||
ReadVariables();
|
ReadVariables();
|
||||||
@@ -86,20 +86,20 @@ void CConfigParser::Initialize(const std::wstring& filename, CMeterWindow* meter
|
|||||||
m_SectionInsertPos = m_Sections.end();
|
m_SectionInsertPos = m_Sections.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigParser::SetBuiltInVariables(const std::wstring& filename, const std::wstring* resourcePath, CMeterWindow* meterWindow)
|
void ConfigParser::SetBuiltInVariables(const std::wstring& filename, const std::wstring* resourcePath, MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
auto insertVariable = [&](const WCHAR* name, std::wstring value)
|
auto insertVariable = [&](const WCHAR* name, std::wstring value)
|
||||||
{
|
{
|
||||||
return m_BuiltInVariables.insert(std::make_pair(name, value));
|
return m_BuiltInVariables.insert(std::make_pair(name, value));
|
||||||
};
|
};
|
||||||
|
|
||||||
insertVariable(L"PROGRAMPATH", Rainmeter->GetPath());
|
insertVariable(L"PROGRAMPATH", g_Rainmeter->GetPath());
|
||||||
insertVariable(L"PROGRAMDRIVE", Rainmeter->GetDrive());
|
insertVariable(L"PROGRAMDRIVE", g_Rainmeter->GetDrive());
|
||||||
insertVariable(L"SETTINGSPATH", Rainmeter->GetSettingsPath());
|
insertVariable(L"SETTINGSPATH", g_Rainmeter->GetSettingsPath());
|
||||||
insertVariable(L"SKINSPATH", Rainmeter->GetSkinPath());
|
insertVariable(L"SKINSPATH", g_Rainmeter->GetSkinPath());
|
||||||
insertVariable(L"PLUGINSPATH", Rainmeter->GetPluginPath());
|
insertVariable(L"PLUGINSPATH", g_Rainmeter->GetPluginPath());
|
||||||
insertVariable(L"CURRENTPATH", CRainmeter::ExtractPath(filename));
|
insertVariable(L"CURRENTPATH", Rainmeter::ExtractPath(filename));
|
||||||
insertVariable(L"ADDONSPATH", Rainmeter->GetAddonPath());
|
insertVariable(L"ADDONSPATH", g_Rainmeter->GetAddonPath());
|
||||||
|
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
{
|
{
|
||||||
@@ -122,7 +122,7 @@ void CConfigParser::SetBuiltInVariables(const std::wstring& filename, const std:
|
|||||||
** Sets all user-defined variables.
|
** Sets all user-defined variables.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CConfigParser::ReadVariables()
|
void ConfigParser::ReadVariables()
|
||||||
{
|
{
|
||||||
std::list<std::wstring>::const_iterator iter = m_ListVariables.begin();
|
std::list<std::wstring>::const_iterator iter = m_ListVariables.begin();
|
||||||
for ( ; iter != m_ListVariables.end(); ++iter)
|
for ( ; iter != m_ListVariables.end(); ++iter)
|
||||||
@@ -131,13 +131,13 @@ void CConfigParser::ReadVariables()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigParser::SetVariable(std::wstring strVariable, const std::wstring& strValue)
|
void ConfigParser::SetVariable(std::wstring strVariable, const std::wstring& strValue)
|
||||||
{
|
{
|
||||||
StrToUpperC(strVariable);
|
StrToUpperC(strVariable);
|
||||||
m_Variables[strVariable] = strValue;
|
m_Variables[strVariable] = strValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigParser::SetBuiltInVariable(const std::wstring& strVariable, const std::wstring& strValue)
|
void ConfigParser::SetBuiltInVariable(const std::wstring& strVariable, const std::wstring& strValue)
|
||||||
{
|
{
|
||||||
m_BuiltInVariables[strVariable] = strValue;
|
m_BuiltInVariables[strVariable] = strValue;
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ void CConfigParser::SetBuiltInVariable(const std::wstring& strVariable, const st
|
|||||||
** Gets a value for the variable. Returns NULL if not found.
|
** Gets a value for the variable. Returns NULL if not found.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
const std::wstring* CConfigParser::GetVariable(const std::wstring& strVariable)
|
const std::wstring* ConfigParser::GetVariable(const std::wstring& strVariable)
|
||||||
{
|
{
|
||||||
const std::wstring strTmp = StrToUpper(strVariable);
|
const std::wstring strTmp = StrToUpper(strVariable);
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ const std::wstring* CConfigParser::GetVariable(const std::wstring& strVariable)
|
|||||||
** The selector is stripped from strVariable.
|
** The selector is stripped from strVariable.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& strValue)
|
bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& strValue)
|
||||||
{
|
{
|
||||||
size_t colonPos = strVariable.find_last_of(L':');
|
size_t colonPos = strVariable.find_last_of(L':');
|
||||||
if (colonPos == std::wstring::npos)
|
if (colonPos == std::wstring::npos)
|
||||||
@@ -196,7 +196,7 @@ bool CConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring&
|
|||||||
if (isKeySelector)
|
if (isKeySelector)
|
||||||
{
|
{
|
||||||
// [Meter:X], [Meter:Y], [Meter:W], [Meter:H]
|
// [Meter:X], [Meter:Y], [Meter:W], [Meter:H]
|
||||||
CMeter* meter = m_MeterWindow->GetMeter(strVariable);
|
Meter* meter = m_MeterWindow->GetMeter(strVariable);
|
||||||
if (meter)
|
if (meter)
|
||||||
{
|
{
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
@@ -284,7 +284,7 @@ bool CConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CMeasure* measure = m_MeterWindow->GetMeasure(strVariable);
|
Measure* measure = m_MeterWindow->GetMeasure(strVariable);
|
||||||
if (measure)
|
if (measure)
|
||||||
{
|
{
|
||||||
int scale = 1;
|
int scale = 1;
|
||||||
@@ -364,7 +364,7 @@ bool CConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring&
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigParser::ResetMonitorVariables(CMeterWindow* meterWindow)
|
void ConfigParser::ResetMonitorVariables(MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
// Set the SCREENAREA/WORKAREA variables
|
// Set the SCREENAREA/WORKAREA variables
|
||||||
if (c_MonitorVariables.empty())
|
if (c_MonitorVariables.empty())
|
||||||
@@ -380,7 +380,7 @@ void CConfigParser::ResetMonitorVariables(CMeterWindow* meterWindow)
|
|||||||
** Sets new values for the SCREENAREA/WORKAREA variables.
|
** Sets new values for the SCREENAREA/WORKAREA variables.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CConfigParser::SetMultiMonitorVariables(bool reset)
|
void ConfigParser::SetMultiMonitorVariables(bool reset)
|
||||||
{
|
{
|
||||||
auto setMonitorVariable = [&](const WCHAR* variable, const WCHAR* value)
|
auto setMonitorVariable = [&](const WCHAR* variable, const WCHAR* value)
|
||||||
{
|
{
|
||||||
@@ -392,8 +392,8 @@ void CConfigParser::SetMultiMonitorVariables(bool reset)
|
|||||||
reset = true; // Set all variables
|
reset = true; // Set all variables
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t numOfMonitors = CSystem::GetMonitorCount(); // intentional
|
const size_t numOfMonitors = System::GetMonitorCount(); // intentional
|
||||||
const MultiMonitorInfo& monitorsInfo = CSystem::GetMultiMonitorInfo();
|
const MultiMonitorInfo& monitorsInfo = System::GetMultiMonitorInfo();
|
||||||
const std::vector<MonitorInfo>& monitors = monitorsInfo.monitors;
|
const std::vector<MonitorInfo>& monitors = monitorsInfo.monitors;
|
||||||
|
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
@@ -482,12 +482,12 @@ void CConfigParser::SetMultiMonitorVariables(bool reset)
|
|||||||
** Sets new SCREENAREA/WORKAREA variables for present monitor.
|
** Sets new SCREENAREA/WORKAREA variables for present monitor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CConfigParser::SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow)
|
void ConfigParser::SetAutoSelectedMonitorVariables(MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
{
|
{
|
||||||
const int numOfMonitors = (int)CSystem::GetMonitorCount();
|
const int numOfMonitors = (int)System::GetMonitorCount();
|
||||||
const MultiMonitorInfo& monitorsInfo = CSystem::GetMultiMonitorInfo();
|
const MultiMonitorInfo& monitorsInfo = System::GetMultiMonitorInfo();
|
||||||
const std::vector<MonitorInfo>& monitors = monitorsInfo.monitors;
|
const std::vector<MonitorInfo>& monitors = monitorsInfo.monitors;
|
||||||
|
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
@@ -566,11 +566,11 @@ void CConfigParser::SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow)
|
|||||||
** Replaces environment and internal variables in the given string.
|
** Replaces environment and internal variables in the given string.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CConfigParser::ReplaceVariables(std::wstring& result)
|
bool ConfigParser::ReplaceVariables(std::wstring& result)
|
||||||
{
|
{
|
||||||
bool replaced = false;
|
bool replaced = false;
|
||||||
|
|
||||||
CRainmeter::ExpandEnvironmentVariables(result);
|
Rainmeter::ExpandEnvironmentVariables(result);
|
||||||
|
|
||||||
if (c_MonitorVariables.empty())
|
if (c_MonitorVariables.empty())
|
||||||
{
|
{
|
||||||
@@ -633,7 +633,7 @@ bool CConfigParser::ReplaceVariables(std::wstring& result)
|
|||||||
** Replaces measures in the given string.
|
** Replaces measures in the given string.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CConfigParser::ReplaceMeasures(std::wstring& result)
|
bool ConfigParser::ReplaceMeasures(std::wstring& result)
|
||||||
{
|
{
|
||||||
bool replaced = false;
|
bool replaced = false;
|
||||||
|
|
||||||
@@ -661,7 +661,7 @@ bool CConfigParser::ReplaceMeasures(std::wstring& result)
|
|||||||
{
|
{
|
||||||
std::wstring var = result.substr(si, end - si);
|
std::wstring var = result.substr(si, end - si);
|
||||||
|
|
||||||
CMeasure* measure = GetMeasure(var);
|
Measure* measure = GetMeasure(var);
|
||||||
if (measure)
|
if (measure)
|
||||||
{
|
{
|
||||||
const WCHAR* value = measure->GetStringOrFormattedValue(AUTOSCALE_OFF, 1, -1, false);
|
const WCHAR* value = measure->GetStringOrFormattedValue(AUTOSCALE_OFF, 1, -1, false);
|
||||||
@@ -698,7 +698,7 @@ bool CConfigParser::ReplaceMeasures(std::wstring& result)
|
|||||||
return replaced;
|
return replaced;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures)
|
const std::wstring& ConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures)
|
||||||
{
|
{
|
||||||
static std::wstring result;
|
static std::wstring result;
|
||||||
|
|
||||||
@@ -764,7 +764,7 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CRainmeter::ExpandEnvironmentVariables(result);
|
Rainmeter::ExpandEnvironmentVariables(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bReplaceMeasures && ReplaceMeasures(result))
|
if (bReplaceMeasures && ReplaceMeasures(result))
|
||||||
@@ -777,19 +777,19 @@ const std::wstring& CConfigParser::ReadString(LPCTSTR section, LPCTSTR key, LPCT
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConfigParser::IsKeyDefined(LPCTSTR section, LPCTSTR key)
|
bool ConfigParser::IsKeyDefined(LPCTSTR section, LPCTSTR key)
|
||||||
{
|
{
|
||||||
ReadString(section, key, L"", false);
|
ReadString(section, key, L"", false);
|
||||||
return !m_LastDefaultUsed;
|
return !m_LastDefaultUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CConfigParser::IsValueDefined(LPCTSTR section, LPCTSTR key)
|
bool ConfigParser::IsValueDefined(LPCTSTR section, LPCTSTR key)
|
||||||
{
|
{
|
||||||
ReadString(section, key, L"", false);
|
ReadString(section, key, L"", false);
|
||||||
return m_LastValueDefined;
|
return m_LastValueDefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigParser::AddMeasure(CMeasure* pMeasure)
|
void ConfigParser::AddMeasure(Measure* pMeasure)
|
||||||
{
|
{
|
||||||
if (pMeasure)
|
if (pMeasure)
|
||||||
{
|
{
|
||||||
@@ -797,9 +797,9 @@ void CConfigParser::AddMeasure(CMeasure* pMeasure)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CMeasure* CConfigParser::GetMeasure(const std::wstring& name)
|
Measure* ConfigParser::GetMeasure(const std::wstring& name)
|
||||||
{
|
{
|
||||||
std::unordered_map<std::wstring, CMeasure*>::const_iterator iter = m_Measures.find(StrToUpper(name));
|
std::unordered_map<std::wstring, Measure*>::const_iterator iter = m_Measures.find(StrToUpper(name));
|
||||||
if (iter != m_Measures.end())
|
if (iter != m_Measures.end())
|
||||||
{
|
{
|
||||||
return (*iter).second;
|
return (*iter).second;
|
||||||
@@ -808,7 +808,7 @@ CMeasure* CConfigParser::GetMeasure(const std::wstring& name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Gdiplus::REAL> CConfigParser::ReadFloats(LPCTSTR section, LPCTSTR key)
|
std::vector<Gdiplus::REAL> ConfigParser::ReadFloats(LPCTSTR section, LPCTSTR key)
|
||||||
{
|
{
|
||||||
std::vector<Gdiplus::REAL> result;
|
std::vector<Gdiplus::REAL> result;
|
||||||
const std::wstring& str = ReadString(section, key, L"");
|
const std::wstring& str = ReadString(section, key, L"");
|
||||||
@@ -834,7 +834,7 @@ std::vector<Gdiplus::REAL> CConfigParser::ReadFloats(LPCTSTR section, LPCTSTR ke
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CConfigParser::ReadInt(LPCTSTR section, LPCTSTR key, int defValue)
|
int ConfigParser::ReadInt(LPCTSTR section, LPCTSTR key, int defValue)
|
||||||
{
|
{
|
||||||
const std::wstring& result = ReadString(section, key, L"");
|
const std::wstring& result = ReadString(section, key, L"");
|
||||||
|
|
||||||
@@ -866,7 +866,7 @@ int CConfigParser::ReadInt(LPCTSTR section, LPCTSTR key, int defValue)
|
|||||||
return defValue;
|
return defValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CConfigParser::ReadUInt(LPCTSTR section, LPCTSTR key, uint32_t defValue)
|
uint32_t ConfigParser::ReadUInt(LPCTSTR section, LPCTSTR key, uint32_t defValue)
|
||||||
{
|
{
|
||||||
const std::wstring& result = ReadString(section, key, L"");
|
const std::wstring& result = ReadString(section, key, L"");
|
||||||
|
|
||||||
@@ -898,7 +898,7 @@ uint32_t CConfigParser::ReadUInt(LPCTSTR section, LPCTSTR key, uint32_t defValue
|
|||||||
return defValue;
|
return defValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t CConfigParser::ReadUInt64(LPCTSTR section, LPCTSTR key, uint64_t defValue)
|
uint64_t ConfigParser::ReadUInt64(LPCTSTR section, LPCTSTR key, uint64_t defValue)
|
||||||
{
|
{
|
||||||
const std::wstring& result = ReadString(section, key, L"");
|
const std::wstring& result = ReadString(section, key, L"");
|
||||||
|
|
||||||
@@ -930,7 +930,7 @@ uint64_t CConfigParser::ReadUInt64(LPCTSTR section, LPCTSTR key, uint64_t defVal
|
|||||||
return defValue;
|
return defValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
double CConfigParser::ReadFloat(LPCTSTR section, LPCTSTR key, double defValue)
|
double ConfigParser::ReadFloat(LPCTSTR section, LPCTSTR key, double defValue)
|
||||||
{
|
{
|
||||||
const std::wstring& result = ReadString(section, key, L"");
|
const std::wstring& result = ReadString(section, key, L"");
|
||||||
|
|
||||||
@@ -963,7 +963,7 @@ double CConfigParser::ReadFloat(LPCTSTR section, LPCTSTR key, double defValue)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the formula was read successfully, false for failure.
|
// Returns true if the formula was read successfully, false for failure.
|
||||||
bool CConfigParser::ParseFormula(const std::wstring& formula, double* resultValue)
|
bool ConfigParser::ParseFormula(const std::wstring& formula, double* resultValue)
|
||||||
{
|
{
|
||||||
// Formulas must be surrounded by parenthesis
|
// Formulas must be surrounded by parenthesis
|
||||||
if (!formula.empty() && formula[0] == L'(' && formula[formula.size() - 1] == L')')
|
if (!formula.empty() && formula[0] == L'(' && formula[formula.size() - 1] == L')')
|
||||||
@@ -982,21 +982,21 @@ bool CConfigParser::ParseFormula(const std::wstring& formula, double* resultValu
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ARGB CConfigParser::ReadColor(LPCTSTR section, LPCTSTR key, ARGB defValue)
|
ARGB ConfigParser::ReadColor(LPCTSTR section, LPCTSTR key, ARGB defValue)
|
||||||
{
|
{
|
||||||
const std::wstring& result = ReadString(section, key, L"");
|
const std::wstring& result = ReadString(section, key, L"");
|
||||||
|
|
||||||
return (m_LastDefaultUsed) ? defValue : ParseColor(result.c_str());
|
return (m_LastDefaultUsed) ? defValue : ParseColor(result.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect CConfigParser::ReadRect(LPCTSTR section, LPCTSTR key, const Rect& defValue)
|
Rect ConfigParser::ReadRect(LPCTSTR section, LPCTSTR key, const Rect& defValue)
|
||||||
{
|
{
|
||||||
const std::wstring& result = ReadString(section, key, L"");
|
const std::wstring& result = ReadString(section, key, L"");
|
||||||
|
|
||||||
return (m_LastDefaultUsed) ? defValue : ParseRect(result.c_str());
|
return (m_LastDefaultUsed) ? defValue : ParseRect(result.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
RECT CConfigParser::ReadRECT(LPCTSTR section, LPCTSTR key, const RECT& defValue)
|
RECT ConfigParser::ReadRECT(LPCTSTR section, LPCTSTR key, const RECT& defValue)
|
||||||
{
|
{
|
||||||
const std::wstring& result = ReadString(section, key, L"");
|
const std::wstring& result = ReadString(section, key, L"");
|
||||||
|
|
||||||
@@ -1018,7 +1018,7 @@ RECT CConfigParser::ReadRECT(LPCTSTR section, LPCTSTR key, const RECT& defValue)
|
|||||||
**
|
**
|
||||||
** Modified from http://www.digitalpeer.com/id/simple
|
** Modified from http://www.digitalpeer.com/id/simple
|
||||||
*/
|
*/
|
||||||
std::vector<std::wstring> CConfigParser::Tokenize(const std::wstring& str, const std::wstring& delimiters)
|
std::vector<std::wstring> ConfigParser::Tokenize(const std::wstring& str, const std::wstring& delimiters)
|
||||||
{
|
{
|
||||||
std::vector<std::wstring> tokens;
|
std::vector<std::wstring> tokens;
|
||||||
|
|
||||||
@@ -1056,7 +1056,7 @@ std::vector<std::wstring> CConfigParser::Tokenize(const std::wstring& str, const
|
|||||||
** If the given string is invalid format or causes overflow/underflow, returns given default value.
|
** If the given string is invalid format or causes overflow/underflow, returns given default value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
double CConfigParser::ParseDouble(LPCTSTR string, double defValue)
|
double ConfigParser::ParseDouble(LPCTSTR string, double defValue)
|
||||||
{
|
{
|
||||||
assert(string);
|
assert(string);
|
||||||
|
|
||||||
@@ -1089,7 +1089,7 @@ double CConfigParser::ParseDouble(LPCTSTR string, double defValue)
|
|||||||
** If the given string is invalid format or causes overflow/underflow, returns given default value.
|
** If the given string is invalid format or causes overflow/underflow, returns given default value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
int CConfigParser::ParseInt(LPCTSTR string, int defValue)
|
int ConfigParser::ParseInt(LPCTSTR string, int defValue)
|
||||||
{
|
{
|
||||||
assert(string);
|
assert(string);
|
||||||
|
|
||||||
@@ -1122,7 +1122,7 @@ int CConfigParser::ParseInt(LPCTSTR string, int defValue)
|
|||||||
** If the given string is invalid format or causes overflow/underflow, returns given default value.
|
** If the given string is invalid format or causes overflow/underflow, returns given default value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
uint32_t CConfigParser::ParseUInt(LPCTSTR string, uint32_t defValue)
|
uint32_t ConfigParser::ParseUInt(LPCTSTR string, uint32_t defValue)
|
||||||
{
|
{
|
||||||
assert(string);
|
assert(string);
|
||||||
|
|
||||||
@@ -1155,7 +1155,7 @@ uint32_t CConfigParser::ParseUInt(LPCTSTR string, uint32_t defValue)
|
|||||||
** If the given string is invalid format or causes overflow/underflow, returns given default value.
|
** If the given string is invalid format or causes overflow/underflow, returns given default value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
uint64_t CConfigParser::ParseUInt64(LPCTSTR string, uint64_t defValue)
|
uint64_t ConfigParser::ParseUInt64(LPCTSTR string, uint64_t defValue)
|
||||||
{
|
{
|
||||||
assert(string);
|
assert(string);
|
||||||
|
|
||||||
@@ -1198,22 +1198,22 @@ bool ParseInt4(LPCTSTR string, T& v1, T& v2, T& v3, T& v4)
|
|||||||
token = wcstok(parseSz, L",");
|
token = wcstok(parseSz, L",");
|
||||||
if (token)
|
if (token)
|
||||||
{
|
{
|
||||||
v1 = CConfigParser::ParseInt(token, 0);
|
v1 = ConfigParser::ParseInt(token, 0);
|
||||||
|
|
||||||
token = wcstok(NULL, L",");
|
token = wcstok(NULL, L",");
|
||||||
if (token)
|
if (token)
|
||||||
{
|
{
|
||||||
v2 = CConfigParser::ParseInt(token, 0);
|
v2 = ConfigParser::ParseInt(token, 0);
|
||||||
|
|
||||||
token = wcstok(NULL, L",");
|
token = wcstok(NULL, L",");
|
||||||
if (token)
|
if (token)
|
||||||
{
|
{
|
||||||
v3 = CConfigParser::ParseInt(token, 0);
|
v3 = ConfigParser::ParseInt(token, 0);
|
||||||
|
|
||||||
token = wcstok(NULL, L",");
|
token = wcstok(NULL, L",");
|
||||||
if (token)
|
if (token)
|
||||||
{
|
{
|
||||||
v4 = CConfigParser::ParseInt(token, 0);
|
v4 = ConfigParser::ParseInt(token, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1231,7 +1231,7 @@ bool ParseInt4(LPCTSTR string, T& v1, T& v2, T& v3, T& v4)
|
|||||||
** hex-value.
|
** hex-value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
ARGB CConfigParser::ParseColor(LPCTSTR string)
|
ARGB ConfigParser::ParseColor(LPCTSTR string)
|
||||||
{
|
{
|
||||||
int R = 255, G = 255, B = 255, A = 255;
|
int R = 255, G = 255, B = 255, A = 255;
|
||||||
|
|
||||||
@@ -1261,7 +1261,7 @@ ARGB CConfigParser::ParseColor(LPCTSTR string)
|
|||||||
** The rect can be supplied as four comma separated values (X/Y/Width/Height).
|
** The rect can be supplied as four comma separated values (X/Y/Width/Height).
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
Rect CConfigParser::ParseRect(LPCTSTR string)
|
Rect ConfigParser::ParseRect(LPCTSTR string)
|
||||||
{
|
{
|
||||||
Rect r;
|
Rect r;
|
||||||
ParseInt4(string, r.X, r.Y, r.Width, r.Height);
|
ParseInt4(string, r.X, r.Y, r.Width, r.Height);
|
||||||
@@ -1273,7 +1273,7 @@ Rect CConfigParser::ParseRect(LPCTSTR string)
|
|||||||
** The rect can be supplied as four comma separated values (left/top/right/bottom).
|
** The rect can be supplied as four comma separated values (left/top/right/bottom).
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
RECT CConfigParser::ParseRECT(LPCTSTR string)
|
RECT ConfigParser::ParseRECT(LPCTSTR string)
|
||||||
{
|
{
|
||||||
RECT r = {0};
|
RECT r = {0};
|
||||||
ParseInt4(string, r.left, r.top, r.right, r.bottom);
|
ParseInt4(string, r.left, r.top, r.right, r.bottom);
|
||||||
@@ -1284,11 +1284,11 @@ RECT CConfigParser::ParseRECT(LPCTSTR string)
|
|||||||
** Reads the given ini file and fills the m_Values and m_Keys maps.
|
** Reads the given ini file and fills the m_Values and m_Keys maps.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection, int depth)
|
void ConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection, int depth)
|
||||||
{
|
{
|
||||||
if (depth > 100) // Is 100 enough to assume the include loop never ends?
|
if (depth > 100) // Is 100 enough to assume the include loop never ends?
|
||||||
{
|
{
|
||||||
Rainmeter->ShowMessage(NULL, GetString(ID_STR_INCLUDEINFINITELOOP), MB_OK | MB_ICONERROR);
|
g_Rainmeter->ShowMessage(NULL, GetString(ID_STR_INCLUDEINFINITELOOP), MB_OK | MB_ICONERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1300,16 +1300,16 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Avoid "IniFileMapping"
|
// Avoid "IniFileMapping"
|
||||||
std::wstring iniRead = CSystem::GetTemporaryFile(iniFile);
|
std::wstring iniRead = System::GetTemporaryFile(iniFile);
|
||||||
bool temporary = (!iniRead.empty() && (iniRead.size() != 1 || iniRead[0] != L'?'));
|
bool temporary = (!iniRead.empty() && (iniRead.size() != 1 || iniRead[0] != L'?'));
|
||||||
|
|
||||||
if (temporary)
|
if (temporary)
|
||||||
{
|
{
|
||||||
if (Rainmeter->GetDebug()) LogDebugF(L"Reading file: %s (Temp: %s)", iniFile.c_str(), iniRead.c_str());
|
if (g_Rainmeter->GetDebug()) LogDebugF(L"Reading file: %s (Temp: %s)", iniFile.c_str(), iniRead.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Rainmeter->GetDebug()) LogDebugF(L"Reading file: %s", iniFile.c_str());
|
if (g_Rainmeter->GetDebug()) LogDebugF(L"Reading file: %s", iniFile.c_str());
|
||||||
iniRead = iniFile;
|
iniRead = iniFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1333,7 +1333,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection
|
|||||||
if (res == 0) // File not found
|
if (res == 0) // File not found
|
||||||
{
|
{
|
||||||
delete [] items;
|
delete [] items;
|
||||||
if (temporary) CSystem::RemoveFile(iniRead);
|
if (temporary) System::RemoveFile(iniRead);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (res < itemsSize - 2) // Fits in the buffer
|
if (res < itemsSize - 2) // Fits in the buffer
|
||||||
@@ -1446,10 +1446,10 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection
|
|||||||
value.assign(sep, clen);
|
value.assign(sep, clen);
|
||||||
ReadVariables();
|
ReadVariables();
|
||||||
ReplaceVariables(value);
|
ReplaceVariables(value);
|
||||||
if (!CSystem::IsAbsolutePath(value))
|
if (!System::IsAbsolutePath(value))
|
||||||
{
|
{
|
||||||
// Relative to the ini folder
|
// Relative to the ini folder
|
||||||
value.insert(0, CRainmeter::ExtractPath(iniFile));
|
value.insert(0, Rainmeter::ExtractPath(iniFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resetInsertPos)
|
if (resetInsertPos)
|
||||||
@@ -1504,14 +1504,14 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete [] items;
|
delete [] items;
|
||||||
if (temporary) CSystem::RemoveFile(iniRead);
|
if (temporary) System::RemoveFile(iniRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Sets the value for the key under the given section.
|
** Sets the value for the key under the given section.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CConfigParser::SetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strValue)
|
void ConfigParser::SetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strValue)
|
||||||
{
|
{
|
||||||
// LogDebugF(L"[%s] %s=%s (size: %i)", strSection.c_str(), strKey.c_str(), strValue.c_str(), (int)m_Values.size());
|
// LogDebugF(L"[%s] %s=%s (size: %i)", strSection.c_str(), strKey.c_str(), strValue.c_str(), (int)m_Values.size());
|
||||||
|
|
||||||
@@ -1528,7 +1528,7 @@ void CConfigParser::SetValue(const std::wstring& strSection, const std::wstring&
|
|||||||
** Deletes the value for the key under the given section.
|
** Deletes the value for the key under the given section.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CConfigParser::DeleteValue(const std::wstring& strSection, const std::wstring& strKey)
|
void ConfigParser::DeleteValue(const std::wstring& strSection, const std::wstring& strKey)
|
||||||
{
|
{
|
||||||
std::wstring strTmp;
|
std::wstring strTmp;
|
||||||
strTmp.reserve(strSection.size() + 1 + strKey.size());
|
strTmp.reserve(strSection.size() + 1 + strKey.size());
|
||||||
@@ -1547,7 +1547,7 @@ void CConfigParser::DeleteValue(const std::wstring& strSection, const std::wstri
|
|||||||
** Returns the value for the key under the given section.
|
** Returns the value for the key under the given section.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
const std::wstring& CConfigParser::GetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strDefault)
|
const std::wstring& ConfigParser::GetValue(const std::wstring& strSection, const std::wstring& strKey, const std::wstring& strDefault)
|
||||||
{
|
{
|
||||||
std::wstring strTmp;
|
std::wstring strTmp;
|
||||||
strTmp.reserve(strSection.size() + 1 + strKey.size());
|
strTmp.reserve(strSection.size() + 1 + strKey.size());
|
||||||
|
|||||||
@@ -30,21 +30,21 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <gdiplus.h>
|
#include <gdiplus.h>
|
||||||
|
|
||||||
class CRainmeter;
|
class Rainmeter;
|
||||||
class CMeterWindow;
|
class MeterWindow;
|
||||||
class CMeasure;
|
class Measure;
|
||||||
class CMeter;
|
class Meter;
|
||||||
|
|
||||||
class CConfigParser
|
class ConfigParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CConfigParser();
|
ConfigParser();
|
||||||
~CConfigParser();
|
~ConfigParser();
|
||||||
|
|
||||||
void Initialize(const std::wstring& filename, CMeterWindow* meterWindow = NULL, LPCTSTR skinSection = NULL, const std::wstring* resourcePath = NULL);
|
void Initialize(const std::wstring& filename, MeterWindow* meterWindow = NULL, LPCTSTR skinSection = NULL, const std::wstring* resourcePath = NULL);
|
||||||
|
|
||||||
void AddMeasure(CMeasure* pMeasure);
|
void AddMeasure(Measure* pMeasure);
|
||||||
CMeasure* GetMeasure(const std::wstring& name);
|
Measure* GetMeasure(const std::wstring& name);
|
||||||
|
|
||||||
const std::wstring* GetVariable(const std::wstring& strVariable);
|
const std::wstring* GetVariable(const std::wstring& strVariable);
|
||||||
void SetVariable(std::wstring strVariable, const std::wstring& strValue);
|
void SetVariable(std::wstring strVariable, const std::wstring& strValue);
|
||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
bool GetLastKeyDefined() { return !m_LastDefaultUsed; }
|
bool GetLastKeyDefined() { return !m_LastDefaultUsed; }
|
||||||
bool GetLastValueDefined() { return m_LastValueDefined; }
|
bool GetLastValueDefined() { return m_LastValueDefined; }
|
||||||
|
|
||||||
void ResetMonitorVariables(CMeterWindow* meterWindow = NULL);
|
void ResetMonitorVariables(MeterWindow* meterWindow = NULL);
|
||||||
|
|
||||||
const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures = true);
|
const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures = true);
|
||||||
bool IsKeyDefined(LPCTSTR section, LPCTSTR key);
|
bool IsKeyDefined(LPCTSTR section, LPCTSTR key);
|
||||||
@@ -98,13 +98,13 @@ public:
|
|||||||
static void UpdateWorkareaVariables() { SetMultiMonitorVariables(false); }
|
static void UpdateWorkareaVariables() { SetMultiMonitorVariables(false); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetBuiltInVariables(const std::wstring& filename, const std::wstring* resourcePath, CMeterWindow* meterWindow);
|
void SetBuiltInVariables(const std::wstring& filename, const std::wstring* resourcePath, MeterWindow* meterWindow);
|
||||||
|
|
||||||
void ReadVariables();
|
void ReadVariables();
|
||||||
|
|
||||||
void ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection = NULL, int depth = 0);
|
void ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection = NULL, int depth = 0);
|
||||||
|
|
||||||
void SetAutoSelectedMonitorVariables(CMeterWindow* meterWindow);
|
void SetAutoSelectedMonitorVariables(MeterWindow* meterWindow);
|
||||||
|
|
||||||
bool GetSectionVariable(std::wstring& strVariable, std::wstring& strValue);
|
bool GetSectionVariable(std::wstring& strVariable, std::wstring& strValue);
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ private:
|
|||||||
static std::wstring StrToUpper(const WCHAR* str) { std::wstring strTmp(str); StrToUpperC(strTmp); return strTmp; }
|
static std::wstring StrToUpper(const WCHAR* str) { std::wstring strTmp(str); StrToUpperC(strTmp); return strTmp; }
|
||||||
static std::wstring& StrToUpperC(std::wstring& str) { _wcsupr(&str[0]); return str; }
|
static std::wstring& StrToUpperC(std::wstring& str) { _wcsupr(&str[0]); return str; }
|
||||||
|
|
||||||
std::unordered_map<std::wstring, CMeasure*> m_Measures;
|
std::unordered_map<std::wstring, Measure*> m_Measures;
|
||||||
|
|
||||||
std::vector<std::wstring> m_StyleTemplate;
|
std::vector<std::wstring> m_StyleTemplate;
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ private:
|
|||||||
std::unordered_map<std::wstring, std::wstring> m_BuiltInVariables;
|
std::unordered_map<std::wstring, std::wstring> m_BuiltInVariables;
|
||||||
std::unordered_map<std::wstring, std::wstring> m_Variables;
|
std::unordered_map<std::wstring, std::wstring> m_Variables;
|
||||||
|
|
||||||
CMeterWindow* m_MeterWindow;
|
MeterWindow* m_MeterWindow;
|
||||||
|
|
||||||
static std::unordered_map<std::wstring, std::wstring> c_MonitorVariables;
|
static std::unordered_map<std::wstring, std::wstring> c_MonitorVariables;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,14 +19,14 @@
|
|||||||
#include "StdAfx.h"
|
#include "StdAfx.h"
|
||||||
#include "Dialog.h"
|
#include "Dialog.h"
|
||||||
|
|
||||||
HWND CDialog::c_ActiveDialogWindow = NULL;
|
HWND Dialog::c_ActiveDialogWindow = NULL;
|
||||||
HWND CDialog::c_ActiveTabWindow = NULL;
|
HWND Dialog::c_ActiveTabWindow = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Constructor.
|
** Constructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialog::CDialog(HWND wnd) :
|
Dialog::Dialog(HWND wnd) :
|
||||||
m_Window(wnd),
|
m_Window(wnd),
|
||||||
m_Font(),
|
m_Font(),
|
||||||
m_FontBold()
|
m_FontBold()
|
||||||
@@ -44,13 +44,13 @@ CDialog::CDialog(HWND wnd) :
|
|||||||
** Destructor.
|
** Destructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialog::~CDialog()
|
Dialog::~Dialog()
|
||||||
{
|
{
|
||||||
DeleteObject(m_Font);
|
DeleteObject(m_Font);
|
||||||
DeleteObject(m_FontBold);
|
DeleteObject(m_FontBold);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialog::OnActivate(WPARAM wParam, LPARAM lParam)
|
INT_PTR Dialog::OnActivate(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (wParam)
|
if (wParam)
|
||||||
{
|
{
|
||||||
@@ -69,12 +69,12 @@ INT_PTR CDialog::OnActivate(WPARAM wParam, LPARAM lParam)
|
|||||||
** Sets dialog font to UI font.
|
** Sets dialog font to UI font.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialog::SetDialogFont(HWND window)
|
void Dialog::SetDialogFont(HWND window)
|
||||||
{
|
{
|
||||||
EnumChildWindows(window, SetFontProc, (WPARAM)m_Font);
|
EnumChildWindows(window, SetFontProc, (WPARAM)m_Font);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CALLBACK CDialog::SetFontProc(HWND hWnd, LPARAM lParam)
|
BOOL CALLBACK Dialog::SetFontProc(HWND hWnd, LPARAM lParam)
|
||||||
{
|
{
|
||||||
SendMessage(hWnd, WM_SETFONT, (WPARAM)lParam, 0);
|
SendMessage(hWnd, WM_SETFONT, (WPARAM)lParam, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -84,12 +84,12 @@ BOOL CALLBACK CDialog::SetFontProc(HWND hWnd, LPARAM lParam)
|
|||||||
** Subclass button control to draw arrow on the right.
|
** Subclass button control to draw arrow on the right.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialog::SetMenuButton(HWND button)
|
void Dialog::SetMenuButton(HWND button)
|
||||||
{
|
{
|
||||||
SetWindowSubclass(button, MenuButtonProc, NULL, NULL);
|
SetWindowSubclass(button, MenuButtonProc, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK CDialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
|
LRESULT CALLBACK Dialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
|
||||||
{
|
{
|
||||||
LRESULT result = DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
LRESULT result = DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ LRESULT CALLBACK CDialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
|
|||||||
** Constructor.
|
** Constructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialog::CTab::CTab(HINSTANCE instance, HWND owner, WORD tabId, DLGPROC tabProc) :
|
Dialog::Tab::Tab(HINSTANCE instance, HWND owner, WORD tabId, DLGPROC tabProc) :
|
||||||
m_Window(CreateDialog(instance, MAKEINTRESOURCE(tabId), owner, tabProc)),
|
m_Window(CreateDialog(instance, MAKEINTRESOURCE(tabId), owner, tabProc)),
|
||||||
m_Initialized(false)
|
m_Initialized(false)
|
||||||
{
|
{
|
||||||
@@ -150,7 +150,7 @@ CDialog::CTab::CTab(HINSTANCE instance, HWND owner, WORD tabId, DLGPROC tabProc)
|
|||||||
** Destructor.
|
** Destructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialog::CTab::~CTab()
|
Dialog::Tab::~Tab()
|
||||||
{
|
{
|
||||||
DestroyWindow(m_Window);
|
DestroyWindow(m_Window);
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ CDialog::CTab::~CTab()
|
|||||||
** Activates the tab.
|
** Activates the tab.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialog::CTab::Activate()
|
void Dialog::Tab::Activate()
|
||||||
{
|
{
|
||||||
c_ActiveTabWindow = m_Window;
|
c_ActiveTabWindow = m_Window;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef __DIALOG_H__
|
#ifndef __DIALOG_H__
|
||||||
#define __DIALOG_H__
|
#define __DIALOG_H__
|
||||||
|
|
||||||
class CDialog
|
class Dialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HWND GetWindow() { return m_Window; }
|
HWND GetWindow() { return m_Window; }
|
||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
static HWND GetActiveTabWindow() { return c_ActiveTabWindow; }
|
static HWND GetActiveTabWindow() { return c_ActiveTabWindow; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
class CTab
|
class Tab
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HWND GetWindow() { return m_Window; }
|
HWND GetWindow() { return m_Window; }
|
||||||
@@ -39,15 +39,15 @@ protected:
|
|||||||
virtual void Resize(int w, int h) {}
|
virtual void Resize(int w, int h) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CTab(HINSTANCE instance, HWND owner, WORD tabId, DLGPROC tabProc);
|
Tab(HINSTANCE instance, HWND owner, WORD tabId, DLGPROC tabProc);
|
||||||
virtual ~CTab();
|
virtual ~Tab();
|
||||||
|
|
||||||
HWND m_Window;
|
HWND m_Window;
|
||||||
bool m_Initialized;
|
bool m_Initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
CDialog(HWND wnd);
|
Dialog(HWND wnd);
|
||||||
virtual ~CDialog();
|
virtual ~Dialog();
|
||||||
|
|
||||||
virtual HWND GetActiveWindow() { return m_Window; }
|
virtual HWND GetActiveWindow() { return m_Window; }
|
||||||
|
|
||||||
|
|||||||
@@ -26,16 +26,16 @@
|
|||||||
#include "DialogAbout.h"
|
#include "DialogAbout.h"
|
||||||
#include "../Version.h"
|
#include "../Version.h"
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
WINDOWPLACEMENT CDialogAbout::c_WindowPlacement = {0};
|
WINDOWPLACEMENT DialogAbout::c_WindowPlacement = {0};
|
||||||
CDialogAbout* CDialogAbout::c_Dialog = NULL;
|
DialogAbout* DialogAbout::c_Dialog = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Constructor.
|
** Constructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialogAbout::CDialogAbout() : CDialog()
|
DialogAbout::DialogAbout() : Dialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ CDialogAbout::CDialogAbout() : CDialog()
|
|||||||
** Destructor.
|
** Destructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialogAbout::~CDialogAbout()
|
DialogAbout::~DialogAbout()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,11 +51,11 @@ CDialogAbout::~CDialogAbout()
|
|||||||
** Opens the About dialog.
|
** Opens the About dialog.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogAbout::Open(int tab)
|
void DialogAbout::Open(int tab)
|
||||||
{
|
{
|
||||||
if (!c_Dialog)
|
if (!c_Dialog)
|
||||||
{
|
{
|
||||||
c_Dialog = new CDialogAbout();
|
c_Dialog = new DialogAbout();
|
||||||
}
|
}
|
||||||
|
|
||||||
c_Dialog->ShowDialogWindow(
|
c_Dialog->ShowDialogWindow(
|
||||||
@@ -63,7 +63,7 @@ void CDialogAbout::Open(int tab)
|
|||||||
0, 0, 400, 210,
|
0, 0, 400, 210,
|
||||||
DS_CENTER | WS_POPUP | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
|
DS_CENTER | WS_POPUP | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
|
||||||
WS_EX_APPWINDOW | WS_EX_CONTROLPARENT | ((*GetString(ID_STR_ISRTL) == L'1') ? WS_EX_LAYOUTRTL : 0),
|
WS_EX_APPWINDOW | WS_EX_CONTROLPARENT | ((*GetString(ID_STR_ISRTL) == L'1') ? WS_EX_LAYOUTRTL : 0),
|
||||||
Rainmeter->GetWindow());
|
g_Rainmeter->GetWindow());
|
||||||
|
|
||||||
// Fake WM_NOTIFY to change tab
|
// Fake WM_NOTIFY to change tab
|
||||||
NMHDR nm;
|
NMHDR nm;
|
||||||
@@ -78,7 +78,7 @@ void CDialogAbout::Open(int tab)
|
|||||||
** Opens the About dialog by tab name.
|
** Opens the About dialog by tab name.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogAbout::Open(const WCHAR* name)
|
void DialogAbout::Open(const WCHAR* name)
|
||||||
{
|
{
|
||||||
int tab = 0;
|
int tab = 0;
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ void CDialogAbout::Open(const WCHAR* name)
|
|||||||
** Shows log if dialog isn't already open.
|
** Shows log if dialog isn't already open.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogAbout::ShowAboutLog()
|
void DialogAbout::ShowAboutLog()
|
||||||
{
|
{
|
||||||
if (!c_Dialog)
|
if (!c_Dialog)
|
||||||
{
|
{
|
||||||
@@ -114,7 +114,7 @@ void CDialogAbout::ShowAboutLog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogAbout::AddLogItem(CLogger::Level level, LPCWSTR time, LPCWSTR message)
|
void DialogAbout::AddLogItem(Logger::Level level, LPCWSTR time, LPCWSTR message)
|
||||||
{
|
{
|
||||||
if (c_Dialog && c_Dialog->m_TabLog.IsInitialized())
|
if (c_Dialog && c_Dialog->m_TabLog.IsInitialized())
|
||||||
{
|
{
|
||||||
@@ -122,7 +122,7 @@ void CDialogAbout::AddLogItem(CLogger::Level level, LPCWSTR time, LPCWSTR messag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogAbout::UpdateSkins()
|
void DialogAbout::UpdateSkins()
|
||||||
{
|
{
|
||||||
if (c_Dialog && c_Dialog->m_TabSkins.IsInitialized())
|
if (c_Dialog && c_Dialog->m_TabSkins.IsInitialized())
|
||||||
{
|
{
|
||||||
@@ -130,7 +130,7 @@ void CDialogAbout::UpdateSkins()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogAbout::UpdateMeasures(CMeterWindow* meterWindow)
|
void DialogAbout::UpdateMeasures(MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
if (c_Dialog && c_Dialog->m_TabSkins.IsInitialized())
|
if (c_Dialog && c_Dialog->m_TabSkins.IsInitialized())
|
||||||
{
|
{
|
||||||
@@ -138,7 +138,7 @@ void CDialogAbout::UpdateMeasures(CMeterWindow* meterWindow)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CDialog::CTab& CDialogAbout::GetActiveTab()
|
Dialog::Tab& DialogAbout::GetActiveTab()
|
||||||
{
|
{
|
||||||
int sel = TabCtrl_GetCurSel(GetControl(Id_Tab));
|
int sel = TabCtrl_GetCurSel(GetControl(Id_Tab));
|
||||||
if (sel == 0)
|
if (sel == 0)
|
||||||
@@ -159,7 +159,7 @@ CDialog::CTab& CDialogAbout::GetActiveTab()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
@@ -225,7 +225,7 @@ INT_PTR CDialogAbout::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static const ControlTemplate::Control s_Controls[] =
|
static const ControlTemplate::Control s_Controls[] =
|
||||||
{
|
{
|
||||||
@@ -264,9 +264,9 @@ INT_PTR CDialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
if (Platform::IsAtLeastWinVista())
|
if (Platform::IsAtLeastWinVista())
|
||||||
{
|
{
|
||||||
item = m_TabLog.GetControl(CTabLog::Id_ItemsListView);
|
item = m_TabLog.GetControl(TabLog::Id_ItemsListView);
|
||||||
SetWindowTheme(item, L"explorer", NULL);
|
SetWindowTheme(item, L"explorer", NULL);
|
||||||
item = m_TabSkins.GetControl(CTabSkins::Id_ItemsListView);
|
item = m_TabSkins.GetControl(TabSkins::Id_ItemsListView);
|
||||||
SetWindowTheme(item, L"explorer", NULL);
|
SetWindowTheme(item, L"explorer", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ INT_PTR CDialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::OnCommand(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
@@ -295,7 +295,7 @@ INT_PTR CDialogAbout::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::OnNotify(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::OnNotify(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LPNMHDR nm = (LPNMHDR)lParam;
|
LPNMHDR nm = (LPNMHDR)lParam;
|
||||||
switch (nm->idFrom)
|
switch (nm->idFrom)
|
||||||
@@ -330,7 +330,7 @@ INT_PTR CDialogAbout::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
** Constructor.
|
** Constructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialogAbout::CTabLog::CTabLog() : CTab(),
|
DialogAbout::TabLog::TabLog() : Tab(),
|
||||||
m_Error(true),
|
m_Error(true),
|
||||||
m_Warning(true),
|
m_Warning(true),
|
||||||
m_Notice(true),
|
m_Notice(true),
|
||||||
@@ -338,9 +338,9 @@ CDialogAbout::CTabLog::CTabLog() : CTab(),
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogAbout::CTabLog::Create(HWND owner)
|
void DialogAbout::TabLog::Create(HWND owner)
|
||||||
{
|
{
|
||||||
CTab::CreateTabWindow(15, 30, 370, 148, owner);
|
Tab::CreateTabWindow(15, 30, 370, 148, owner);
|
||||||
|
|
||||||
static const ControlTemplate::Control s_Controls[] =
|
static const ControlTemplate::Control s_Controls[] =
|
||||||
{
|
{
|
||||||
@@ -368,7 +368,7 @@ void CDialogAbout::CTabLog::Create(HWND owner)
|
|||||||
** Called when tab is displayed.
|
** Called when tab is displayed.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogAbout::CTabLog::Initialize()
|
void DialogAbout::TabLog::Initialize()
|
||||||
{
|
{
|
||||||
// Add columns to the list view
|
// Add columns to the list view
|
||||||
HWND item = GetControl(Id_ItemsListView);
|
HWND item = GetControl(Id_ItemsListView);
|
||||||
@@ -409,7 +409,7 @@ void CDialogAbout::CTabLog::Initialize()
|
|||||||
ListView_InsertColumn(item, 2, &lvc);
|
ListView_InsertColumn(item, 2, &lvc);
|
||||||
|
|
||||||
// Add stored entires
|
// Add stored entires
|
||||||
for (const auto& entry : CLogger::GetInstance().GetEntries())
|
for (const auto& entry : Logger::GetInstance().GetEntries())
|
||||||
{
|
{
|
||||||
AddItem(entry.level, entry.timestamp.c_str(), entry.message.c_str());
|
AddItem(entry.level, entry.timestamp.c_str(), entry.message.c_str());
|
||||||
}
|
}
|
||||||
@@ -433,7 +433,7 @@ void CDialogAbout::CTabLog::Initialize()
|
|||||||
** Resizes window and repositions controls.
|
** Resizes window and repositions controls.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogAbout::CTabLog::Resize(int w, int h)
|
void DialogAbout::TabLog::Resize(int w, int h)
|
||||||
{
|
{
|
||||||
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
|
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
|
||||||
|
|
||||||
@@ -466,7 +466,7 @@ void CDialogAbout::CTabLog::Resize(int w, int h)
|
|||||||
** Adds item to log.
|
** Adds item to log.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogAbout::CTabLog::AddItem(CLogger::Level level, LPCWSTR time, LPCWSTR message)
|
void DialogAbout::TabLog::AddItem(Logger::Level level, LPCWSTR time, LPCWSTR message)
|
||||||
{
|
{
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
LVITEM vitem;
|
LVITEM vitem;
|
||||||
@@ -478,25 +478,25 @@ void CDialogAbout::CTabLog::AddItem(CLogger::Level level, LPCWSTR time, LPCWSTR
|
|||||||
|
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case CLogger::Level::Error:
|
case Logger::Level::Error:
|
||||||
if (!m_Error) return;
|
if (!m_Error) return;
|
||||||
item = GetControl(Id_ErrorCheckBox);
|
item = GetControl(Id_ErrorCheckBox);
|
||||||
vitem.iImage = 0;
|
vitem.iImage = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLogger::Level::Warning:
|
case Logger::Level::Warning:
|
||||||
if (!m_Warning) return;
|
if (!m_Warning) return;
|
||||||
item = GetControl(Id_WarningCheckBox);
|
item = GetControl(Id_WarningCheckBox);
|
||||||
vitem.iImage = 1;
|
vitem.iImage = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLogger::Level::Notice:
|
case Logger::Level::Notice:
|
||||||
if (!m_Notice) return;
|
if (!m_Notice) return;
|
||||||
item = GetControl(Id_NoticeCheckBox);
|
item = GetControl(Id_NoticeCheckBox);
|
||||||
vitem.iImage = 2;
|
vitem.iImage = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLogger::Level::Debug:
|
case Logger::Level::Debug:
|
||||||
if (!m_Debug) return;
|
if (!m_Debug) return;
|
||||||
item = GetControl(Id_DebugCheckBox);
|
item = GetControl(Id_DebugCheckBox);
|
||||||
vitem.iImage = I_IMAGENONE;
|
vitem.iImage = I_IMAGENONE;
|
||||||
@@ -514,7 +514,7 @@ void CDialogAbout::CTabLog::AddItem(CLogger::Level level, LPCWSTR time, LPCWSTR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::CTabLog::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::TabLog::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
@@ -528,7 +528,7 @@ INT_PTR CDialogAbout::CTabLog::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::CTabLog::OnCommand(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::TabLog::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
@@ -567,7 +567,7 @@ INT_PTR CDialogAbout::CTabLog::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::CTabLog::OnNotify(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::TabLog::OnNotify(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LPNMHDR nm = (LPNMHDR)lParam;
|
LPNMHDR nm = (LPNMHDR)lParam;
|
||||||
switch (nm->code)
|
switch (nm->code)
|
||||||
@@ -583,7 +583,7 @@ INT_PTR CDialogAbout::CTabLog::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
std::wstring tmpSz(512, L'0');
|
std::wstring tmpSz(512, L'0');
|
||||||
ListView_GetItemText(nm->hwndFrom, sel, 2, &tmpSz[0], 512);
|
ListView_GetItemText(nm->hwndFrom, sel, 2, &tmpSz[0], 512);
|
||||||
CSystem::SetClipboardText(tmpSz);
|
System::SetClipboardText(tmpSz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -606,14 +606,14 @@ INT_PTR CDialogAbout::CTabLog::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
** Constructor.
|
** Constructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialogAbout::CTabSkins::CTabSkins() : CTab(),
|
DialogAbout::TabSkins::TabSkins() : Tab(),
|
||||||
m_SkinWindow()
|
m_SkinWindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogAbout::CTabSkins::Create(HWND owner)
|
void DialogAbout::TabSkins::Create(HWND owner)
|
||||||
{
|
{
|
||||||
CTab::CreateTabWindow(15, 30, 370, 148, owner);
|
Tab::CreateTabWindow(15, 30, 370, 148, owner);
|
||||||
|
|
||||||
static const ControlTemplate::Control s_Controls[] =
|
static const ControlTemplate::Control s_Controls[] =
|
||||||
{
|
{
|
||||||
@@ -628,7 +628,7 @@ void CDialogAbout::CTabSkins::Create(HWND owner)
|
|||||||
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogAbout::CTabSkins::Initialize()
|
void DialogAbout::TabSkins::Initialize()
|
||||||
{
|
{
|
||||||
// Add columns to the list view
|
// Add columns to the list view
|
||||||
HWND item = GetControl(Id_ItemsListView);
|
HWND item = GetControl(Id_ItemsListView);
|
||||||
@@ -672,7 +672,7 @@ void CDialogAbout::CTabSkins::Initialize()
|
|||||||
** Resizes window and repositions controls.
|
** Resizes window and repositions controls.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogAbout::CTabSkins::Resize(int w, int h)
|
void DialogAbout::TabSkins::Resize(int w, int h)
|
||||||
{
|
{
|
||||||
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
|
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
|
||||||
|
|
||||||
@@ -694,7 +694,7 @@ void CDialogAbout::CTabSkins::Resize(int w, int h)
|
|||||||
** Updates the list of skins.
|
** Updates the list of skins.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogAbout::CTabSkins::UpdateSkinList()
|
void DialogAbout::TabSkins::UpdateSkinList()
|
||||||
{
|
{
|
||||||
// Delete all entries
|
// Delete all entries
|
||||||
HWND item = GetControl(Id_SkinsListBox);
|
HWND item = GetControl(Id_SkinsListBox);
|
||||||
@@ -702,8 +702,8 @@ void CDialogAbout::CTabSkins::UpdateSkinList()
|
|||||||
|
|
||||||
// Add entries for each skin
|
// Add entries for each skin
|
||||||
std::wstring::size_type maxLength = 0;
|
std::wstring::size_type maxLength = 0;
|
||||||
const std::map<std::wstring, CMeterWindow*>& windows = Rainmeter->GetAllMeterWindows();
|
const std::map<std::wstring, MeterWindow*>& windows = g_Rainmeter->GetAllMeterWindows();
|
||||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = windows.begin();
|
std::map<std::wstring, MeterWindow*>::const_iterator iter = windows.begin();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for ( ; iter != windows.end(); ++iter)
|
for ( ; iter != windows.end(); ++iter)
|
||||||
{
|
{
|
||||||
@@ -748,7 +748,7 @@ void CDialogAbout::CTabSkins::UpdateSkinList()
|
|||||||
** Updates the list of measures and values.
|
** Updates the list of measures and values.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogAbout::CTabSkins::UpdateMeasureList(CMeterWindow* meterWindow)
|
void DialogAbout::TabSkins::UpdateMeasureList(MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
if (!meterWindow)
|
if (!meterWindow)
|
||||||
{
|
{
|
||||||
@@ -756,8 +756,8 @@ void CDialogAbout::CTabSkins::UpdateMeasureList(CMeterWindow* meterWindow)
|
|||||||
HWND item = GetControl(Id_SkinsListBox);
|
HWND item = GetControl(Id_SkinsListBox);
|
||||||
int selected = (int)SendMessage(item, LB_GETCURSEL, NULL, NULL);
|
int selected = (int)SendMessage(item, LB_GETCURSEL, NULL, NULL);
|
||||||
|
|
||||||
const std::map<std::wstring, CMeterWindow*>& windows = Rainmeter->GetAllMeterWindows();
|
const std::map<std::wstring, MeterWindow*>& windows = g_Rainmeter->GetAllMeterWindows();
|
||||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = windows.begin();
|
std::map<std::wstring, MeterWindow*>::const_iterator iter = windows.begin();
|
||||||
while (selected && iter != windows.end())
|
while (selected && iter != windows.end())
|
||||||
{
|
{
|
||||||
++iter;
|
++iter;
|
||||||
@@ -783,8 +783,8 @@ void CDialogAbout::CTabSkins::UpdateMeasureList(CMeterWindow* meterWindow)
|
|||||||
lvi.lParam = 0;
|
lvi.lParam = 0;
|
||||||
|
|
||||||
lvi.iGroupId = 0;
|
lvi.iGroupId = 0;
|
||||||
const std::vector<CMeasure*>& measures = m_SkinWindow->GetMeasures();
|
const std::vector<Measure*>& measures = m_SkinWindow->GetMeasures();
|
||||||
std::vector<CMeasure*>::const_iterator j = measures.begin();
|
std::vector<Measure*>::const_iterator j = measures.begin();
|
||||||
for ( ; j != measures.end(); ++j)
|
for ( ; j != measures.end(); ++j)
|
||||||
{
|
{
|
||||||
lvi.pszText = (WCHAR*)(*j)->GetName();
|
lvi.pszText = (WCHAR*)(*j)->GetName();
|
||||||
@@ -799,10 +799,10 @@ void CDialogAbout::CTabSkins::UpdateMeasureList(CMeterWindow* meterWindow)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WCHAR buffer[256];
|
WCHAR buffer[256];
|
||||||
CMeasure::GetScaledValue(AUTOSCALE_ON, 1, (*j)->GetMinValue(), buffer, _countof(buffer));
|
Measure::GetScaledValue(AUTOSCALE_ON, 1, (*j)->GetMinValue(), buffer, _countof(buffer));
|
||||||
std::wstring range = buffer;
|
std::wstring range = buffer;
|
||||||
range += L" - ";
|
range += L" - ";
|
||||||
CMeasure::GetScaledValue(AUTOSCALE_ON, 1, (*j)->GetMaxValue(), buffer, _countof(buffer));
|
Measure::GetScaledValue(AUTOSCALE_ON, 1, (*j)->GetMaxValue(), buffer, _countof(buffer));
|
||||||
range += buffer;
|
range += buffer;
|
||||||
|
|
||||||
ListView_SetItemText(item, lvi.iItem, 1, (WCHAR*)range.c_str());
|
ListView_SetItemText(item, lvi.iItem, 1, (WCHAR*)range.c_str());
|
||||||
@@ -862,7 +862,7 @@ void CDialogAbout::CTabSkins::UpdateMeasureList(CMeterWindow* meterWindow)
|
|||||||
SendMessage(item, WM_SETREDRAW, TRUE, 0);
|
SendMessage(item, WM_SETREDRAW, TRUE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CALLBACK CDialogAbout::CTabSkins::ListSortProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
int CALLBACK DialogAbout::TabSkins::ListSortProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
||||||
{
|
{
|
||||||
// Measures
|
// Measures
|
||||||
if (!lParam1 && !lParam2) return 0;
|
if (!lParam1 && !lParam2) return 0;
|
||||||
@@ -873,7 +873,7 @@ int CALLBACK CDialogAbout::CTabSkins::ListSortProc(LPARAM lParam1, LPARAM lParam
|
|||||||
return wcscmp((const WCHAR*)lParam1, (const WCHAR*)lParam2);
|
return wcscmp((const WCHAR*)lParam1, (const WCHAR*)lParam2);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::CTabSkins::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::TabSkins::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
@@ -887,7 +887,7 @@ INT_PTR CDialogAbout::CTabSkins::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::TabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
@@ -905,7 +905,7 @@ INT_PTR CDialogAbout::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::TabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LPNMHDR nm = (LPNMHDR)lParam;
|
LPNMHDR nm = (LPNMHDR)lParam;
|
||||||
switch (nm->code)
|
switch (nm->code)
|
||||||
@@ -920,7 +920,7 @@ INT_PTR CDialogAbout::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
std::wstring tmpSz(512, L'0');
|
std::wstring tmpSz(512, L'0');
|
||||||
ListView_GetItemText(nm->hwndFrom, sel, 2, &tmpSz[0], 512);
|
ListView_GetItemText(nm->hwndFrom, sel, 2, &tmpSz[0], 512);
|
||||||
CSystem::SetClipboardText(tmpSz);
|
System::SetClipboardText(tmpSz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -939,13 +939,13 @@ INT_PTR CDialogAbout::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
//
|
//
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
CDialogAbout::CTabPlugins::CTabPlugins() : CTab()
|
DialogAbout::TabPlugins::TabPlugins() : Tab()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogAbout::CTabPlugins::Create(HWND owner)
|
void DialogAbout::TabPlugins::Create(HWND owner)
|
||||||
{
|
{
|
||||||
CTab::CreateTabWindow(15, 30, 370, 148, owner);
|
Tab::CreateTabWindow(15, 30, 370, 148, owner);
|
||||||
|
|
||||||
static const ControlTemplate::Control s_Controls[] =
|
static const ControlTemplate::Control s_Controls[] =
|
||||||
{
|
{
|
||||||
@@ -957,7 +957,7 @@ void CDialogAbout::CTabPlugins::Create(HWND owner)
|
|||||||
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogAbout::CTabPlugins::Initialize()
|
void DialogAbout::TabPlugins::Initialize()
|
||||||
{
|
{
|
||||||
// Add columns to the list view
|
// Add columns to the list view
|
||||||
HWND item = GetControl(Id_ItemsListView);
|
HWND item = GetControl(Id_ItemsListView);
|
||||||
@@ -1054,7 +1054,7 @@ void CDialogAbout::CTabPlugins::Initialize()
|
|||||||
|
|
||||||
// Try old calling GetPluginVersion/GetPluginAuthor for backwards compatibility
|
// Try old calling GetPluginVersion/GetPluginAuthor for backwards compatibility
|
||||||
DWORD err = 0;
|
DWORD err = 0;
|
||||||
HMODULE dll = CSystem::RmLoadLibrary(path, &err);
|
HMODULE dll = System::RmLoadLibrary(path, &err);
|
||||||
if (dll)
|
if (dll)
|
||||||
{
|
{
|
||||||
ListView_InsertItem(item, &vitem);
|
ListView_InsertItem(item, &vitem);
|
||||||
@@ -1090,10 +1090,10 @@ void CDialogAbout::CTabPlugins::Initialize()
|
|||||||
FindClose(hSearch);
|
FindClose(hSearch);
|
||||||
};
|
};
|
||||||
|
|
||||||
findPlugins(Rainmeter->GetPluginPath());
|
findPlugins(g_Rainmeter->GetPluginPath());
|
||||||
if (Rainmeter->HasUserPluginPath())
|
if (g_Rainmeter->HasUserPluginPath())
|
||||||
{
|
{
|
||||||
findPlugins(Rainmeter->GetUserPluginPath());
|
findPlugins(g_Rainmeter->GetUserPluginPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
@@ -1103,7 +1103,7 @@ void CDialogAbout::CTabPlugins::Initialize()
|
|||||||
** Resizes window and repositions controls.
|
** Resizes window and repositions controls.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogAbout::CTabPlugins::Resize(int w, int h)
|
void DialogAbout::TabPlugins::Resize(int w, int h)
|
||||||
{
|
{
|
||||||
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
|
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
|
||||||
|
|
||||||
@@ -1127,13 +1127,13 @@ void CDialogAbout::CTabPlugins::Resize(int w, int h)
|
|||||||
** Constructor.
|
** Constructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialogAbout::CTabVersion::CTabVersion() : CTab()
|
DialogAbout::TabVersion::TabVersion() : Tab()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogAbout::CTabVersion::Create(HWND owner)
|
void DialogAbout::TabVersion::Create(HWND owner)
|
||||||
{
|
{
|
||||||
CTab::CreateTabWindow(15, 30, 370, 148, owner);
|
Tab::CreateTabWindow(15, 30, 370, 148, owner);
|
||||||
|
|
||||||
// FIXME: Temporary hack.
|
// FIXME: Temporary hack.
|
||||||
short buttonWidth = (short)_wtoi(GetString(ID_STR_NUM_BUTTONWIDTH));
|
short buttonWidth = (short)_wtoi(GetString(ID_STR_NUM_BUTTONWIDTH));
|
||||||
@@ -1169,7 +1169,7 @@ void CDialogAbout::CTabVersion::Create(HWND owner)
|
|||||||
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogAbout::CTabVersion::Initialize()
|
void DialogAbout::TabVersion::Initialize()
|
||||||
{
|
{
|
||||||
HWND item = GetControl(Id_AppIcon);
|
HWND item = GetControl(Id_AppIcon);
|
||||||
HICON icon = GetIcon(IDI_RAINMETER, true);
|
HICON icon = GetIcon(IDI_RAINMETER, true);
|
||||||
@@ -1181,15 +1181,15 @@ void CDialogAbout::CTabVersion::Initialize()
|
|||||||
SetWindowText(item, tmpSz);
|
SetWindowText(item, tmpSz);
|
||||||
|
|
||||||
item = GetControl(Id_PathLabel);
|
item = GetControl(Id_PathLabel);
|
||||||
std::wstring text = L"Path: " + Rainmeter->GetPath();
|
std::wstring text = L"Path: " + g_Rainmeter->GetPath();
|
||||||
SetWindowText(item, text.c_str());
|
SetWindowText(item, text.c_str());
|
||||||
|
|
||||||
item = GetControl(Id_IniFileLabel);
|
item = GetControl(Id_IniFileLabel);
|
||||||
text = L"IniFile: " + Rainmeter->GetIniFile();
|
text = L"IniFile: " + g_Rainmeter->GetIniFile();
|
||||||
SetWindowText(item, text.c_str());
|
SetWindowText(item, text.c_str());
|
||||||
|
|
||||||
item = GetControl(Id_SkinPathLabel);
|
item = GetControl(Id_SkinPathLabel);
|
||||||
text = L"SkinPath: " + Rainmeter->GetSkinPath();
|
text = L"SkinPath: " + g_Rainmeter->GetSkinPath();
|
||||||
SetWindowText(item, text.c_str());
|
SetWindowText(item, text.c_str());
|
||||||
|
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
@@ -1199,12 +1199,12 @@ void CDialogAbout::CTabVersion::Initialize()
|
|||||||
** Resizes window and repositions controls.
|
** Resizes window and repositions controls.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogAbout::CTabVersion::Resize(int w, int h)
|
void DialogAbout::TabVersion::Resize(int w, int h)
|
||||||
{
|
{
|
||||||
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
|
SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::CTabVersion::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::TabVersion::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
@@ -1218,7 +1218,7 @@ INT_PTR CDialogAbout::CTabVersion::HandleMessage(UINT uMsg, WPARAM wParam, LPARA
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::CTabVersion::OnCommand(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::TabVersion::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
@@ -1228,12 +1228,12 @@ INT_PTR CDialogAbout::CTabVersion::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
int len = _snwprintf_s(tmpSz, _TRUNCATE, L"%s%s r%i %s (%s)", APPVERSION, revision_beta ? L" beta" : L"", revision_number, APPBITS, APPDATE);
|
int len = _snwprintf_s(tmpSz, _TRUNCATE, L"%s%s r%i %s (%s)", APPVERSION, revision_beta ? L" beta" : L"", revision_number, APPBITS, APPDATE);
|
||||||
std::wstring text(tmpSz, len);
|
std::wstring text(tmpSz, len);
|
||||||
text += L"\nPath: ";
|
text += L"\nPath: ";
|
||||||
text += Rainmeter->GetPath();
|
text += g_Rainmeter->GetPath();
|
||||||
text += L"\nIniFile: ";
|
text += L"\nIniFile: ";
|
||||||
text += Rainmeter->GetIniFile();
|
text += g_Rainmeter->GetIniFile();
|
||||||
text += L"\nSkinPath: ";
|
text += L"\nSkinPath: ";
|
||||||
text += Rainmeter->GetSkinPath();
|
text += g_Rainmeter->GetSkinPath();
|
||||||
CSystem::SetClipboardText(text);
|
System::SetClipboardText(text);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1244,7 +1244,7 @@ INT_PTR CDialogAbout::CTabVersion::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogAbout::CTabVersion::OnNotify(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogAbout::TabVersion::OnNotify(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LPNMHDR nm = (LPNMHDR)lParam;
|
LPNMHDR nm = (LPNMHDR)lParam;
|
||||||
switch (nm->code)
|
switch (nm->code)
|
||||||
@@ -1252,11 +1252,11 @@ INT_PTR CDialogAbout::CTabVersion::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
case NM_CLICK:
|
case NM_CLICK:
|
||||||
if (nm->idFrom == Id_HomeLink)
|
if (nm->idFrom == Id_HomeLink)
|
||||||
{
|
{
|
||||||
CCommandHandler::RunFile(L"http://rainmeter.net");
|
CommandHandler::RunFile(L"http://rainmeter.net");
|
||||||
}
|
}
|
||||||
else if (nm->idFrom == Id_HomeLink)
|
else if (nm->idFrom == Id_HomeLink)
|
||||||
{
|
{
|
||||||
CCommandHandler::RunFile(L"http://gnu.org/licenses");
|
CommandHandler::RunFile(L"http://gnu.org/licenses");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -23,21 +23,21 @@
|
|||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "MeterWindow.h"
|
#include "MeterWindow.h"
|
||||||
|
|
||||||
class CDialogAbout : public CDialog
|
class DialogAbout : public Dialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CDialogAbout();
|
DialogAbout();
|
||||||
virtual ~CDialogAbout();
|
virtual ~DialogAbout();
|
||||||
|
|
||||||
static CDialog* GetDialog() { return c_Dialog; }
|
static Dialog* GetDialog() { return c_Dialog; }
|
||||||
|
|
||||||
static void Open(int tab = 0);
|
static void Open(int tab = 0);
|
||||||
static void Open(const WCHAR* name);
|
static void Open(const WCHAR* name);
|
||||||
static void ShowAboutLog();
|
static void ShowAboutLog();
|
||||||
|
|
||||||
static void AddLogItem(CLogger::Level level, LPCWSTR time, LPCWSTR message);
|
static void AddLogItem(Logger::Level level, LPCWSTR time, LPCWSTR message);
|
||||||
static void UpdateSkins();
|
static void UpdateSkins();
|
||||||
static void UpdateMeasures(CMeterWindow* meterWindow);
|
static void UpdateMeasures(MeterWindow* meterWindow);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
@@ -47,7 +47,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Log tab
|
// Log tab
|
||||||
class CTabLog : public CTab
|
class TabLog : public Tab
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Id
|
enum Id
|
||||||
@@ -59,13 +59,13 @@ private:
|
|||||||
Id_DebugCheckBox
|
Id_DebugCheckBox
|
||||||
};
|
};
|
||||||
|
|
||||||
CTabLog();
|
TabLog();
|
||||||
|
|
||||||
void Create(HWND owner);
|
void Create(HWND owner);
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual void Resize(int w, int h);
|
virtual void Resize(int w, int h);
|
||||||
|
|
||||||
void AddItem(CLogger::Level level, LPCWSTR time, LPCWSTR message);
|
void AddItem(Logger::Level level, LPCWSTR time, LPCWSTR message);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
@@ -80,7 +80,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Measures tab
|
// Measures tab
|
||||||
class CTabSkins : public CTab
|
class TabSkins : public Tab
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Id
|
enum Id
|
||||||
@@ -89,14 +89,14 @@ private:
|
|||||||
Id_ItemsListView
|
Id_ItemsListView
|
||||||
};
|
};
|
||||||
|
|
||||||
CTabSkins();
|
TabSkins();
|
||||||
|
|
||||||
void Create(HWND owner);
|
void Create(HWND owner);
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual void Resize(int w, int h);
|
virtual void Resize(int w, int h);
|
||||||
|
|
||||||
void UpdateSkinList();
|
void UpdateSkinList();
|
||||||
void UpdateMeasureList(CMeterWindow* meterWindow);
|
void UpdateMeasureList(MeterWindow* meterWindow);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
@@ -106,11 +106,11 @@ private:
|
|||||||
private:
|
private:
|
||||||
static int CALLBACK ListSortProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
|
static int CALLBACK ListSortProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
|
||||||
|
|
||||||
CMeterWindow* m_SkinWindow;
|
MeterWindow* m_SkinWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Plugins tab
|
// Plugins tab
|
||||||
class CTabPlugins : public CTab
|
class TabPlugins : public Tab
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Id
|
enum Id
|
||||||
@@ -118,7 +118,7 @@ private:
|
|||||||
Id_ItemsListView = 100
|
Id_ItemsListView = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
CTabPlugins();
|
TabPlugins();
|
||||||
|
|
||||||
void Create(HWND owner);
|
void Create(HWND owner);
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
@@ -130,7 +130,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Version tab
|
// Version tab
|
||||||
class CTabVersion : public CTab
|
class TabVersion : public Tab
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Id
|
enum Id
|
||||||
@@ -145,7 +145,7 @@ private:
|
|||||||
Id_CopyButton
|
Id_CopyButton
|
||||||
};
|
};
|
||||||
|
|
||||||
CTabVersion();
|
TabVersion();
|
||||||
|
|
||||||
void Create(HWND owner);
|
void Create(HWND owner);
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
@@ -163,15 +163,15 @@ private:
|
|||||||
Id_Tab = 100
|
Id_Tab = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
CTab& GetActiveTab();
|
Tab& GetActiveTab();
|
||||||
|
|
||||||
CTabLog m_TabLog;
|
TabLog m_TabLog;
|
||||||
CTabSkins m_TabSkins;
|
TabSkins m_TabSkins;
|
||||||
CTabPlugins m_TabPlugins;
|
TabPlugins m_TabPlugins;
|
||||||
CTabVersion m_TabVersion;
|
TabVersion m_TabVersion;
|
||||||
|
|
||||||
static WINDOWPLACEMENT c_WindowPlacement;
|
static WINDOWPLACEMENT c_WindowPlacement;
|
||||||
static CDialogAbout* c_Dialog;
|
static DialogAbout* c_Dialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -29,16 +29,16 @@
|
|||||||
#include "../Version.h"
|
#include "../Version.h"
|
||||||
#include <Commdlg.h>
|
#include <Commdlg.h>
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
WINDOWPLACEMENT CDialogManage::c_WindowPlacement = {0};
|
WINDOWPLACEMENT DialogManage::c_WindowPlacement = {0};
|
||||||
CDialogManage* CDialogManage::c_Dialog = NULL;
|
DialogManage* DialogManage::c_Dialog = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Constructor.
|
** Constructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialogManage::CDialogManage() : CDialog()
|
DialogManage::DialogManage() : Dialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ CDialogManage::CDialogManage() : CDialog()
|
|||||||
** Destructor.
|
** Destructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialogManage::~CDialogManage()
|
DialogManage::~DialogManage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ CDialogManage::~CDialogManage()
|
|||||||
** Opens the Manage dialog by tab name.
|
** Opens the Manage dialog by tab name.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogManage::Open(const WCHAR* name)
|
void DialogManage::Open(const WCHAR* name)
|
||||||
{
|
{
|
||||||
int tab = 0;
|
int tab = 0;
|
||||||
|
|
||||||
@@ -78,11 +78,11 @@ void CDialogManage::Open(const WCHAR* name)
|
|||||||
** Opens the Manage dialog.
|
** Opens the Manage dialog.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogManage::Open(int tab)
|
void DialogManage::Open(int tab)
|
||||||
{
|
{
|
||||||
if (!c_Dialog)
|
if (!c_Dialog)
|
||||||
{
|
{
|
||||||
c_Dialog = new CDialogManage();
|
c_Dialog = new DialogManage();
|
||||||
}
|
}
|
||||||
|
|
||||||
c_Dialog->ShowDialogWindow(
|
c_Dialog->ShowDialogWindow(
|
||||||
@@ -90,7 +90,7 @@ void CDialogManage::Open(int tab)
|
|||||||
0, 0, 500, 322,
|
0, 0, 500, 322,
|
||||||
DS_CENTER | WS_POPUP | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
|
DS_CENTER | WS_POPUP | WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
|
||||||
WS_EX_APPWINDOW | WS_EX_CONTROLPARENT | ((*GetString(ID_STR_ISRTL) == L'1') ? WS_EX_LAYOUTRTL : 0),
|
WS_EX_APPWINDOW | WS_EX_CONTROLPARENT | ((*GetString(ID_STR_ISRTL) == L'1') ? WS_EX_LAYOUTRTL : 0),
|
||||||
Rainmeter->GetWindow());
|
g_Rainmeter->GetWindow());
|
||||||
|
|
||||||
// Fake WM_NOTIFY to change tab
|
// Fake WM_NOTIFY to change tab
|
||||||
NMHDR nm;
|
NMHDR nm;
|
||||||
@@ -105,7 +105,7 @@ void CDialogManage::Open(int tab)
|
|||||||
** Opens the Manage dialog Skins tab with skin selected.
|
** Opens the Manage dialog Skins tab with skin selected.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogManage::OpenSkin(CMeterWindow* meterWindow)
|
void DialogManage::OpenSkin(MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
Open();
|
Open();
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ void CDialogManage::OpenSkin(CMeterWindow* meterWindow)
|
|||||||
std::wstring name = meterWindow->GetFolderPath() + L'\\';
|
std::wstring name = meterWindow->GetFolderPath() + L'\\';
|
||||||
name += meterWindow->GetFileName();
|
name += meterWindow->GetFileName();
|
||||||
|
|
||||||
HWND item = c_Dialog->m_TabSkins.GetControl(CTabSkins::Id_SkinsTreeView);
|
HWND item = c_Dialog->m_TabSkins.GetControl(TabSkins::Id_SkinsTreeView);
|
||||||
c_Dialog->m_TabSkins.SelectTreeItem(item, TreeView_GetRoot(item), name.c_str());
|
c_Dialog->m_TabSkins.SelectTreeItem(item, TreeView_GetRoot(item), name.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ void CDialogManage::OpenSkin(CMeterWindow* meterWindow)
|
|||||||
** Updates Skins tab.
|
** Updates Skins tab.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogManage::UpdateSkins(CMeterWindow* meterWindow, bool deleted)
|
void DialogManage::UpdateSkins(MeterWindow* meterWindow, bool deleted)
|
||||||
{
|
{
|
||||||
if (c_Dialog && c_Dialog->m_TabSkins.IsInitialized())
|
if (c_Dialog && c_Dialog->m_TabSkins.IsInitialized())
|
||||||
{
|
{
|
||||||
@@ -131,7 +131,7 @@ void CDialogManage::UpdateSkins(CMeterWindow* meterWindow, bool deleted)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CDialog::CTab& CDialogManage::GetActiveTab()
|
Dialog::Tab& DialogManage::GetActiveTab()
|
||||||
{
|
{
|
||||||
int sel = TabCtrl_GetCurSel(GetControl(Id_Tab));
|
int sel = TabCtrl_GetCurSel(GetControl(Id_Tab));
|
||||||
if (sel == 0)
|
if (sel == 0)
|
||||||
@@ -148,7 +148,7 @@ CDialog::CTab& CDialogManage::GetActiveTab()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogManage::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogManage::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
@@ -181,7 +181,7 @@ INT_PTR CDialogManage::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// FIXME: Temporary hack.
|
// FIXME: Temporary hack.
|
||||||
short buttonWidth = (short)_wtoi(GetString(ID_STR_NUM_BUTTONWIDTH));
|
short buttonWidth = (short)_wtoi(GetString(ID_STR_NUM_BUTTONWIDTH));
|
||||||
@@ -230,13 +230,13 @@ INT_PTR CDialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam)
|
|||||||
item = GetControl(Id_CloseButton);
|
item = GetControl(Id_CloseButton);
|
||||||
SendMessage(m_Window, WM_NEXTDLGCTL, (WPARAM)item, TRUE);
|
SendMessage(m_Window, WM_NEXTDLGCTL, (WPARAM)item, TRUE);
|
||||||
|
|
||||||
item = m_TabSkins.GetControl(CTabSkins::Id_FileLabel);
|
item = m_TabSkins.GetControl(TabSkins::Id_FileLabel);
|
||||||
SendMessage(item, WM_SETFONT, (WPARAM)m_FontBold, 0);
|
SendMessage(item, WM_SETFONT, (WPARAM)m_FontBold, 0);
|
||||||
|
|
||||||
if (Platform::IsAtLeastWinVista())
|
if (Platform::IsAtLeastWinVista())
|
||||||
{
|
{
|
||||||
// Use arrows instead of plus/minus in the tree for Vista+
|
// Use arrows instead of plus/minus in the tree for Vista+
|
||||||
item = m_TabSkins.GetControl(CTabSkins::Id_SkinsTreeView);
|
item = m_TabSkins.GetControl(TabSkins::Id_SkinsTreeView);
|
||||||
SetWindowTheme(item, L"explorer", NULL);
|
SetWindowTheme(item, L"explorer", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,20 +251,20 @@ INT_PTR CDialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogManage::OnCommand(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogManage::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case Id_RefreshAllButton:
|
case Id_RefreshAllButton:
|
||||||
Rainmeter->RefreshAll();
|
g_Rainmeter->RefreshAll();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_EditSettingsButton:
|
case Id_EditSettingsButton:
|
||||||
Rainmeter->EditSettings();
|
g_Rainmeter->EditSettings();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_OpenLogButton:
|
case Id_OpenLogButton:
|
||||||
CDialogAbout::Open();
|
DialogAbout::Open();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_CloseButton:
|
case Id_CloseButton:
|
||||||
@@ -275,7 +275,7 @@ INT_PTR CDialogManage::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
std::wstring url = L"http://docs.rainmeter.net/manual/user-interface/manage#";
|
std::wstring url = L"http://docs.rainmeter.net/manual/user-interface/manage#";
|
||||||
|
|
||||||
CTab& tab = GetActiveTab();
|
Tab& tab = GetActiveTab();
|
||||||
if (&tab == &m_TabSkins)
|
if (&tab == &m_TabSkins)
|
||||||
{
|
{
|
||||||
url += L"Skins";
|
url += L"Skins";
|
||||||
@@ -301,7 +301,7 @@ INT_PTR CDialogManage::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogManage::OnNotify(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogManage::OnNotify(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LPNMHDR nm = (LPNMHDR)lParam;
|
LPNMHDR nm = (LPNMHDR)lParam;
|
||||||
switch (nm->idFrom)
|
switch (nm->idFrom)
|
||||||
@@ -335,16 +335,16 @@ INT_PTR CDialogManage::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
** Constructor.
|
** Constructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialogManage::CTabSkins::CTabSkins() : CTab(),
|
DialogManage::TabSkins::TabSkins() : Tab(),
|
||||||
m_SkinWindow(),
|
m_SkinWindow(),
|
||||||
m_HandleCommands(false),
|
m_HandleCommands(false),
|
||||||
m_IgnoreUpdate(false)
|
m_IgnoreUpdate(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogManage::CTabSkins::Create(HWND owner)
|
void DialogManage::TabSkins::Create(HWND owner)
|
||||||
{
|
{
|
||||||
CTab::CreateTabWindow(15, 30, 470, 260, owner);
|
Tab::CreateTabWindow(15, 30, 470, 260, owner);
|
||||||
|
|
||||||
// FIXME: Temporary hack.
|
// FIXME: Temporary hack.
|
||||||
short labelWidth = (short)_wtoi(GetString(ID_STR_NUM_LABELWIDTH));
|
short labelWidth = (short)_wtoi(GetString(ID_STR_NUM_LABELWIDTH));
|
||||||
@@ -466,7 +466,7 @@ void CDialogManage::CTabSkins::Create(HWND owner)
|
|||||||
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogManage::CTabSkins::Initialize()
|
void DialogManage::TabSkins::Initialize()
|
||||||
{
|
{
|
||||||
BUTTON_SPLITINFO bsi;
|
BUTTON_SPLITINFO bsi;
|
||||||
bsi.mask = BCSIF_SIZE;
|
bsi.mask = BCSIF_SIZE;
|
||||||
@@ -474,10 +474,10 @@ void CDialogManage::CTabSkins::Initialize()
|
|||||||
bsi.size.cy = 14;
|
bsi.size.cy = 14;
|
||||||
|
|
||||||
HWND item = GetControl(Id_ActiveSkinsButton);
|
HWND item = GetControl(Id_ActiveSkinsButton);
|
||||||
CDialog::SetMenuButton(item);
|
Dialog::SetMenuButton(item);
|
||||||
|
|
||||||
item = GetControl(Id_DisplayMonitorButton);
|
item = GetControl(Id_DisplayMonitorButton);
|
||||||
CDialog::SetMenuButton(item);
|
Dialog::SetMenuButton(item);
|
||||||
|
|
||||||
// Load folder/.ini icons from shell32
|
// Load folder/.ini icons from shell32
|
||||||
HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR32, 2, 10);
|
HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR32, 2, 10);
|
||||||
@@ -531,7 +531,7 @@ void CDialogManage::CTabSkins::Initialize()
|
|||||||
** Updates metadata and settings when changed.
|
** Updates metadata and settings when changed.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogManage::CTabSkins::Update(CMeterWindow* meterWindow, bool deleted)
|
void DialogManage::TabSkins::Update(MeterWindow* meterWindow, bool deleted)
|
||||||
{
|
{
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
{
|
{
|
||||||
@@ -572,14 +572,14 @@ void CDialogManage::CTabSkins::Update(CMeterWindow* meterWindow, bool deleted)
|
|||||||
tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
|
||||||
tvi.item.iImage = tvi.item.iSelectedImage = 0;
|
tvi.item.iImage = tvi.item.iSelectedImage = 0;
|
||||||
|
|
||||||
if (!Rainmeter->m_SkinFolders.empty())
|
if (!g_Rainmeter->m_SkinFolders.empty())
|
||||||
{
|
{
|
||||||
PopulateTree(item, tvi);
|
PopulateTree(item, tvi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogManage::CTabSkins::SetControls()
|
void DialogManage::TabSkins::SetControls()
|
||||||
{
|
{
|
||||||
WCHAR buffer[64];
|
WCHAR buffer[64];
|
||||||
|
|
||||||
@@ -610,7 +610,7 @@ void CDialogManage::CTabSkins::SetControls()
|
|||||||
EnableWindow(item, TRUE);
|
EnableWindow(item, TRUE);
|
||||||
|
|
||||||
item = GetControl(Id_DraggableCheckBox);
|
item = GetControl(Id_DraggableCheckBox);
|
||||||
if (Rainmeter->GetDisableDragging())
|
if (g_Rainmeter->GetDisableDragging())
|
||||||
{
|
{
|
||||||
EnableWindow(item, FALSE);
|
EnableWindow(item, FALSE);
|
||||||
Button_SetCheck(item, BST_UNCHECKED);
|
Button_SetCheck(item, BST_UNCHECKED);
|
||||||
@@ -650,7 +650,7 @@ void CDialogManage::CTabSkins::SetControls()
|
|||||||
|
|
||||||
item = GetControl(Id_LoadOrderEdit);
|
item = GetControl(Id_LoadOrderEdit);
|
||||||
EnableWindow(item, TRUE);
|
EnableWindow(item, TRUE);
|
||||||
_itow_s(Rainmeter->GetLoadOrder(m_SkinFolderPath), buffer, 10);
|
_itow_s(g_Rainmeter->GetLoadOrder(m_SkinFolderPath), buffer, 10);
|
||||||
SetWindowText(item, buffer);
|
SetWindowText(item, buffer);
|
||||||
|
|
||||||
item = GetControl(Id_OnHoverDropDownList);
|
item = GetControl(Id_OnHoverDropDownList);
|
||||||
@@ -663,7 +663,7 @@ void CDialogManage::CTabSkins::SetControls()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogManage::CTabSkins::DisableControls(bool clear)
|
void DialogManage::TabSkins::DisableControls(bool clear)
|
||||||
{
|
{
|
||||||
HWND item = GetControl(Id_LoadButton);
|
HWND item = GetControl(Id_LoadButton);
|
||||||
SetWindowText(item, GetString(ID_STR_LOAD));
|
SetWindowText(item, GetString(ID_STR_LOAD));
|
||||||
@@ -753,7 +753,7 @@ void CDialogManage::CTabSkins::DisableControls(bool clear)
|
|||||||
ComboBox_SetCurSel(item, -1);
|
ComboBox_SetCurSel(item, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogManage::CTabSkins::ReadSkin()
|
void DialogManage::TabSkins::ReadSkin()
|
||||||
{
|
{
|
||||||
HWND item = GetControl(Id_FileLabel);
|
HWND item = GetControl(Id_FileLabel);
|
||||||
SetWindowText(item, m_SkinFileName.c_str());
|
SetWindowText(item, m_SkinFileName.c_str());
|
||||||
@@ -763,10 +763,10 @@ void CDialogManage::CTabSkins::ReadSkin()
|
|||||||
item = GetControl(Id_EditButton);
|
item = GetControl(Id_EditButton);
|
||||||
EnableWindow(item, TRUE);
|
EnableWindow(item, TRUE);
|
||||||
|
|
||||||
std::wstring file = Rainmeter->GetSkinPath() + m_SkinFolderPath;
|
std::wstring file = g_Rainmeter->GetSkinPath() + m_SkinFolderPath;
|
||||||
file += L'\\';
|
file += L'\\';
|
||||||
file += m_SkinFileName;
|
file += m_SkinFileName;
|
||||||
m_SkinWindow = Rainmeter->GetMeterWindowByINI(file);
|
m_SkinWindow = g_Rainmeter->GetMeterWindowByINI(file);
|
||||||
if (!m_SkinWindow)
|
if (!m_SkinWindow)
|
||||||
{
|
{
|
||||||
DisableControls();
|
DisableControls();
|
||||||
@@ -854,7 +854,7 @@ void CDialogManage::CTabSkins::ReadSkin()
|
|||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring CDialogManage::CTabSkins::GetTreeSelectionPath(HWND tree)
|
std::wstring DialogManage::TabSkins::GetTreeSelectionPath(HWND tree)
|
||||||
{
|
{
|
||||||
WCHAR buffer[MAX_PATH];
|
WCHAR buffer[MAX_PATH];
|
||||||
|
|
||||||
@@ -881,14 +881,14 @@ std::wstring CDialogManage::CTabSkins::GetTreeSelectionPath(HWND tree)
|
|||||||
** Populates the treeview with folders and skins.
|
** Populates the treeview with folders and skins.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
int CDialogManage::CTabSkins::PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int index)
|
int DialogManage::TabSkins::PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int index)
|
||||||
{
|
{
|
||||||
int initialLevel = Rainmeter->m_SkinFolders[index].level;
|
int initialLevel = g_Rainmeter->m_SkinFolders[index].level;
|
||||||
|
|
||||||
const size_t max = Rainmeter->m_SkinFolders.size();
|
const size_t max = g_Rainmeter->m_SkinFolders.size();
|
||||||
while (index < max)
|
while (index < max)
|
||||||
{
|
{
|
||||||
const CRainmeter::SkinFolder& skinFolder = Rainmeter->m_SkinFolders[index];
|
const Rainmeter::SkinFolder& skinFolder = g_Rainmeter->m_SkinFolders[index];
|
||||||
if (skinFolder.level != initialLevel)
|
if (skinFolder.level != initialLevel)
|
||||||
{
|
{
|
||||||
return index - 1;
|
return index - 1;
|
||||||
@@ -903,7 +903,7 @@ int CDialogManage::CTabSkins::PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int i
|
|||||||
|
|
||||||
// Add subfolders
|
// Add subfolders
|
||||||
if ((index + 1) < max &&
|
if ((index + 1) < max &&
|
||||||
Rainmeter->m_SkinFolders[index + 1].level == initialLevel + 1)
|
g_Rainmeter->m_SkinFolders[index + 1].level == initialLevel + 1)
|
||||||
{
|
{
|
||||||
index = PopulateTree(tree, tvi, index + 1);
|
index = PopulateTree(tree, tvi, index + 1);
|
||||||
}
|
}
|
||||||
@@ -928,7 +928,7 @@ int CDialogManage::CTabSkins::PopulateTree(HWND tree, TVINSERTSTRUCT& tvi, int i
|
|||||||
** Selects an item in the treeview.
|
** Selects an item in the treeview.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CDialogManage::CTabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR name)
|
void DialogManage::TabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR name)
|
||||||
{
|
{
|
||||||
WCHAR buffer[MAX_PATH];
|
WCHAR buffer[MAX_PATH];
|
||||||
TVITEM tvi = {0};
|
TVITEM tvi = {0};
|
||||||
@@ -978,7 +978,7 @@ void CDialogManage::CTabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogManage::CTabSkins::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogManage::TabSkins::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
@@ -992,7 +992,7 @@ INT_PTR CDialogManage::CTabSkins::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogManage::TabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (!m_HandleCommands)
|
if (!m_HandleCommands)
|
||||||
{
|
{
|
||||||
@@ -1007,9 +1007,9 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
HMENU menu = CreatePopupMenu();
|
HMENU menu = CreatePopupMenu();
|
||||||
|
|
||||||
// Add active skins to menu
|
// Add active skins to menu
|
||||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
|
std::map<std::wstring, MeterWindow*>::const_iterator iter = g_Rainmeter->GetAllMeterWindows().begin();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
|
for ( ; iter != g_Rainmeter->GetAllMeterWindows().end(); ++iter)
|
||||||
{
|
{
|
||||||
std::wstring name = ((*iter).second)->GetFolderPath() + L'\\';
|
std::wstring name = ((*iter).second)->GetFolderPath() + L'\\';
|
||||||
name += ((*iter).second)->GetFileName();
|
name += ((*iter).second)->GetFileName();
|
||||||
@@ -1040,8 +1040,8 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
case Id_CreateSkinPackageButton:
|
case Id_CreateSkinPackageButton:
|
||||||
{
|
{
|
||||||
std::wstring file = Rainmeter->GetPath() + L"SkinInstaller.exe";
|
std::wstring file = g_Rainmeter->GetPath() + L"SkinInstaller.exe";
|
||||||
CCommandHandler::RunFile(file.c_str(), L"/Packager");
|
CommandHandler::RunFile(file.c_str(), L"/Packager");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1050,11 +1050,11 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
if (!m_SkinWindow)
|
if (!m_SkinWindow)
|
||||||
{
|
{
|
||||||
// Skin not active, load
|
// Skin not active, load
|
||||||
std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(m_SkinFolderPath, m_SkinFileName);
|
std::pair<int, int> indexes = g_Rainmeter->GetMeterWindowIndex(m_SkinFolderPath, m_SkinFileName);
|
||||||
if (indexes.first != -1 && indexes.second != -1)
|
if (indexes.first != -1 && indexes.second != -1)
|
||||||
{
|
{
|
||||||
m_HandleCommands = false;
|
m_HandleCommands = false;
|
||||||
Rainmeter->ActivateSkin(indexes.first, indexes.second);
|
g_Rainmeter->ActivateSkin(indexes.first, indexes.second);
|
||||||
m_HandleCommands = true;
|
m_HandleCommands = true;
|
||||||
|
|
||||||
// Fake selection change to update controls
|
// Fake selection change to update controls
|
||||||
@@ -1068,7 +1068,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_HandleCommands = false;
|
m_HandleCommands = false;
|
||||||
Rainmeter->DeactivateSkin(m_SkinWindow, -1);
|
g_Rainmeter->DeactivateSkin(m_SkinWindow, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1081,7 +1081,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_EditButton:
|
case Id_EditButton:
|
||||||
Rainmeter->EditSkinFile(m_SkinFolderPath, m_SkinFileName);
|
g_Rainmeter->EditSkinFile(m_SkinFolderPath, m_SkinFileName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_XPositionEdit:
|
case Id_XPositionEdit:
|
||||||
@@ -1148,22 +1148,22 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
// Reset selection
|
// Reset selection
|
||||||
Edit_SetSel((HWND)lParam, LOWORD(sel), HIWORD(sel));
|
Edit_SetSel((HWND)lParam, LOWORD(sel), HIWORD(sel));
|
||||||
|
|
||||||
WritePrivateProfileString(m_SkinFolderPath.c_str(), L"LoadOrder", buffer, Rainmeter->GetIniFile().c_str());
|
WritePrivateProfileString(m_SkinFolderPath.c_str(), L"LoadOrder", buffer, g_Rainmeter->GetIniFile().c_str());
|
||||||
std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(m_SkinWindow);
|
std::pair<int, int> indexes = g_Rainmeter->GetMeterWindowIndex(m_SkinWindow);
|
||||||
if (indexes.first != -1)
|
if (indexes.first != -1)
|
||||||
{
|
{
|
||||||
Rainmeter->SetLoadOrder(indexes.first, value);
|
g_Rainmeter->SetLoadOrder(indexes.first, value);
|
||||||
|
|
||||||
std::multimap<int, CMeterWindow*> windows;
|
std::multimap<int, MeterWindow*> windows;
|
||||||
Rainmeter->GetMeterWindowsByLoadOrder(windows);
|
g_Rainmeter->GetMeterWindowsByLoadOrder(windows);
|
||||||
|
|
||||||
CSystem::PrepareHelperWindow();
|
System::PrepareHelperWindow();
|
||||||
|
|
||||||
// Reorder window z-position to reflect load order
|
// Reorder window z-position to reflect load order
|
||||||
std::multimap<int, CMeterWindow*>::const_iterator iter = windows.begin();
|
std::multimap<int, MeterWindow*>::const_iterator iter = windows.begin();
|
||||||
for ( ; iter != windows.end(); ++iter)
|
for ( ; iter != windows.end(); ++iter)
|
||||||
{
|
{
|
||||||
CMeterWindow* mw = (*iter).second;
|
MeterWindow* mw = (*iter).second;
|
||||||
mw->ChangeZPos(mw->GetWindowZPosition(), true);
|
mw->ChangeZPos(mw->GetWindowZPosition(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1185,7 +1185,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
HMENU menu = MenuTemplate::CreateMenu(s_Menu, _countof(s_Menu), GetString);
|
HMENU menu = MenuTemplate::CreateMenu(s_Menu, _countof(s_Menu), GetString);
|
||||||
if (menu)
|
if (menu)
|
||||||
{
|
{
|
||||||
Rainmeter->CreateMonitorMenu(menu, m_SkinWindow);
|
g_Rainmeter->CreateMonitorMenu(menu, m_SkinWindow);
|
||||||
|
|
||||||
RECT r;
|
RECT r;
|
||||||
GetWindowRect((HWND)lParam, &r);
|
GetWindowRect((HWND)lParam, &r);
|
||||||
@@ -1269,17 +1269,17 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
case IDM_MANAGESKINSMENU_OPENFOLDER:
|
case IDM_MANAGESKINSMENU_OPENFOLDER:
|
||||||
{
|
{
|
||||||
HWND tree = GetControl(Id_SkinsTreeView);
|
HWND tree = GetControl(Id_SkinsTreeView);
|
||||||
Rainmeter->OpenSkinFolder(GetTreeSelectionPath(tree));
|
g_Rainmeter->OpenSkinFolder(GetTreeSelectionPath(tree));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (wParam >= ID_CONFIG_FIRST && wParam <= ID_CONFIG_LAST)
|
if (wParam >= ID_CONFIG_FIRST && wParam <= ID_CONFIG_LAST)
|
||||||
{
|
{
|
||||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
|
std::map<std::wstring, MeterWindow*>::const_iterator iter = g_Rainmeter->GetAllMeterWindows().begin();
|
||||||
int index = (int)wParam - ID_CONFIG_FIRST;
|
int index = (int)wParam - ID_CONFIG_FIRST;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
|
for ( ; iter != g_Rainmeter->GetAllMeterWindows().end(); ++iter)
|
||||||
{
|
{
|
||||||
if (i == index)
|
if (i == index)
|
||||||
{
|
{
|
||||||
@@ -1311,7 +1311,7 @@ INT_PTR CDialogManage::CTabSkins::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogManage::TabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LPNMHDR nm = (LPNMHDR)lParam;
|
LPNMHDR nm = (LPNMHDR)lParam;
|
||||||
switch (nm->code)
|
switch (nm->code)
|
||||||
@@ -1319,7 +1319,7 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
case NM_CLICK:
|
case NM_CLICK:
|
||||||
if (nm->idFrom == Id_AddMetadataLink)
|
if (nm->idFrom == Id_AddMetadataLink)
|
||||||
{
|
{
|
||||||
std::wstring file = Rainmeter->GetSkinPath() + m_SkinFolderPath;
|
std::wstring file = g_Rainmeter->GetSkinPath() + m_SkinFolderPath;
|
||||||
file += L'\\';
|
file += L'\\';
|
||||||
file += m_SkinFileName;
|
file += m_SkinFileName;
|
||||||
const WCHAR* str = L"\r\n" // Hack to add below [Rainmeter].
|
const WCHAR* str = L"\r\n" // Hack to add below [Rainmeter].
|
||||||
@@ -1345,7 +1345,7 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
case NM_RCLICK:
|
case NM_RCLICK:
|
||||||
if (nm->idFrom == Id_SkinsTreeView)
|
if (nm->idFrom == Id_SkinsTreeView)
|
||||||
{
|
{
|
||||||
POINT pt = CSystem::GetCursorPosition();
|
POINT pt = System::GetCursorPosition();
|
||||||
|
|
||||||
TVHITTESTINFO ht;
|
TVHITTESTINFO ht;
|
||||||
ht.pt = pt;
|
ht.pt = pt;
|
||||||
@@ -1490,13 +1490,13 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
** Constructor.
|
** Constructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialogManage::CTabLayouts::CTabLayouts() : CTab()
|
DialogManage::TabLayouts::TabLayouts() : Tab()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogManage::CTabLayouts::Create(HWND owner)
|
void DialogManage::TabLayouts::Create(HWND owner)
|
||||||
{
|
{
|
||||||
CTab::CreateTabWindow(15, 30, 470, 260, owner);
|
Tab::CreateTabWindow(15, 30, 470, 260, owner);
|
||||||
|
|
||||||
static const ControlTemplate::Control s_Controls[] =
|
static const ControlTemplate::Control s_Controls[] =
|
||||||
{
|
{
|
||||||
@@ -1545,10 +1545,10 @@ void CDialogManage::CTabLayouts::Create(HWND owner)
|
|||||||
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogManage::CTabLayouts::Initialize()
|
void DialogManage::TabLayouts::Initialize()
|
||||||
{
|
{
|
||||||
HWND item = GetControl(Id_List);
|
HWND item = GetControl(Id_List);
|
||||||
const std::vector<std::wstring>& layouts = Rainmeter->GetAllLayouts();
|
const std::vector<std::wstring>& layouts = g_Rainmeter->GetAllLayouts();
|
||||||
for (int i = 0, isize = layouts.size(); i < isize; ++i)
|
for (int i = 0, isize = layouts.size(); i < isize; ++i)
|
||||||
{
|
{
|
||||||
ListBox_AddString(item, layouts[i].c_str());
|
ListBox_AddString(item, layouts[i].c_str());
|
||||||
@@ -1557,7 +1557,7 @@ void CDialogManage::CTabLayouts::Initialize()
|
|||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogManage::CTabLayouts::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogManage::TabLayouts::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
@@ -1568,7 +1568,7 @@ INT_PTR CDialogManage::CTabLayouts::HandleMessage(UINT uMsg, WPARAM wParam, LPAR
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogManage::TabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
@@ -1611,7 +1611,7 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
item = GetControl(Id_EditButton);
|
item = GetControl(Id_EditButton);
|
||||||
EnableWindow(item, TRUE);
|
EnableWindow(item, TRUE);
|
||||||
|
|
||||||
const std::vector<std::wstring>& layouts = Rainmeter->GetAllLayouts();
|
const std::vector<std::wstring>& layouts = g_Rainmeter->GetAllLayouts();
|
||||||
item = GetControl(Id_List);
|
item = GetControl(Id_List);
|
||||||
int sel = ListBox_GetCurSel(item);
|
int sel = ListBox_GetCurSel(item);
|
||||||
|
|
||||||
@@ -1628,7 +1628,7 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
Edit_GetText(item, buffer, MAX_PATH);
|
Edit_GetText(item, buffer, MAX_PATH);
|
||||||
|
|
||||||
std::wstring layout = buffer;
|
std::wstring layout = buffer;
|
||||||
std::wstring path = Rainmeter->GetLayoutPath();
|
std::wstring path = g_Rainmeter->GetLayoutPath();
|
||||||
CreateDirectory(path.c_str(), 0);
|
CreateDirectory(path.c_str(), 0);
|
||||||
|
|
||||||
path += layout;
|
path += layout;
|
||||||
@@ -1636,7 +1636,7 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
if (alreadyExists)
|
if (alreadyExists)
|
||||||
{
|
{
|
||||||
std::wstring text = GetFormattedString(ID_STR_THEMEALREADYEXISTS, layout.c_str());
|
std::wstring text = GetFormattedString(ID_STR_THEMEALREADYEXISTS, layout.c_str());
|
||||||
if (Rainmeter->ShowMessage(m_Window, text.c_str(), MB_ICONWARNING | MB_YESNO) != IDYES)
|
if (g_Rainmeter->ShowMessage(m_Window, text.c_str(), MB_ICONWARNING | MB_YESNO) != IDYES)
|
||||||
{
|
{
|
||||||
// Cancel
|
// Cancel
|
||||||
break;
|
break;
|
||||||
@@ -1653,10 +1653,10 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
item = GetControl(Id_SaveEmptyThemeCheckBox);
|
item = GetControl(Id_SaveEmptyThemeCheckBox);
|
||||||
if (Button_GetCheck(item) != BST_CHECKED)
|
if (Button_GetCheck(item) != BST_CHECKED)
|
||||||
{
|
{
|
||||||
if (!CSystem::CopyFiles(Rainmeter->GetIniFile(), path))
|
if (!System::CopyFiles(g_Rainmeter->GetIniFile(), path))
|
||||||
{
|
{
|
||||||
std::wstring text = GetFormattedString(ID_STR_THEMESAVEFAIL, path.c_str());
|
std::wstring text = GetFormattedString(ID_STR_THEMESAVEFAIL, path.c_str());
|
||||||
Rainmeter->ShowMessage(m_Window, text.c_str(), MB_OK | MB_ICONERROR);
|
g_Rainmeter->ShowMessage(m_Window, text.c_str(), MB_OK | MB_ICONERROR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1664,7 +1664,7 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
item = GetControl(Id_ExcludeUnusedSkinsCheckBox);
|
item = GetControl(Id_ExcludeUnusedSkinsCheckBox);
|
||||||
if (Button_GetCheck(item) == BST_CHECKED)
|
if (Button_GetCheck(item) == BST_CHECKED)
|
||||||
{
|
{
|
||||||
CConfigParser parser;
|
ConfigParser parser;
|
||||||
parser.Initialize(path);
|
parser.Initialize(path);
|
||||||
|
|
||||||
// Remove sections with Active=0
|
// Remove sections with Active=0
|
||||||
@@ -1687,7 +1687,7 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
std::wstring::size_type pos = path.find_last_of(L'\\');
|
std::wstring::size_type pos = path.find_last_of(L'\\');
|
||||||
path.replace(pos + 1, path.length() - pos - 1, L"Wallpaper.bmp");
|
path.replace(pos + 1, path.length() - pos - 1, L"Wallpaper.bmp");
|
||||||
CSystem::CopyFiles((std::wstring)buffer, path);
|
System::CopyFiles((std::wstring)buffer, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1698,7 +1698,7 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
if (file == INVALID_HANDLE_VALUE)
|
if (file == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
std::wstring text = GetFormattedString(ID_STR_THEMESAVEFAIL, path.c_str());
|
std::wstring text = GetFormattedString(ID_STR_THEMESAVEFAIL, path.c_str());
|
||||||
Rainmeter->ShowMessage(m_Window, text.c_str(), MB_OK | MB_ICONERROR);
|
g_Rainmeter->ShowMessage(m_Window, text.c_str(), MB_OK | MB_ICONERROR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1710,7 +1710,7 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
item = GetControl(Id_List);
|
item = GetControl(Id_List);
|
||||||
ListBox_AddString(item, layout.c_str());
|
ListBox_AddString(item, layout.c_str());
|
||||||
|
|
||||||
Rainmeter->ScanForLayouts();
|
g_Rainmeter->ScanForLayouts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1719,7 +1719,7 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
HWND item = GetControl(Id_List);
|
HWND item = GetControl(Id_List);
|
||||||
int sel = ListBox_GetCurSel(item);
|
int sel = ListBox_GetCurSel(item);
|
||||||
Rainmeter->LoadLayout(Rainmeter->m_Layouts[sel]);
|
g_Rainmeter->LoadLayout(g_Rainmeter->m_Layouts[sel]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1727,13 +1727,13 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
HWND item = GetControl(Id_List);
|
HWND item = GetControl(Id_List);
|
||||||
int sel = ListBox_GetCurSel(item);
|
int sel = ListBox_GetCurSel(item);
|
||||||
const std::vector<std::wstring>& layouts = Rainmeter->GetAllLayouts();
|
const std::vector<std::wstring>& layouts = g_Rainmeter->GetAllLayouts();
|
||||||
|
|
||||||
std::wstring args = L"\"" + Rainmeter->GetLayoutPath();
|
std::wstring args = L"\"" + g_Rainmeter->GetLayoutPath();
|
||||||
args += layouts[sel];
|
args += layouts[sel];
|
||||||
args += L"\\Rainmeter.ini";
|
args += L"\\Rainmeter.ini";
|
||||||
args += L'"';
|
args += L'"';
|
||||||
CCommandHandler::RunFile(Rainmeter->GetSkinEditor().c_str(), args.c_str());
|
CommandHandler::RunFile(g_Rainmeter->GetSkinEditor().c_str(), args.c_str());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1741,19 +1741,19 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
HWND item = GetControl(Id_List);
|
HWND item = GetControl(Id_List);
|
||||||
int sel = ListBox_GetCurSel(item);
|
int sel = ListBox_GetCurSel(item);
|
||||||
std::vector<std::wstring>& layouts = const_cast<std::vector<std::wstring>&>(Rainmeter->GetAllLayouts());
|
std::vector<std::wstring>& layouts = const_cast<std::vector<std::wstring>&>(g_Rainmeter->GetAllLayouts());
|
||||||
|
|
||||||
std::wstring text = GetFormattedString(ID_STR_THEMEDELETE, layouts[sel].c_str());
|
std::wstring text = GetFormattedString(ID_STR_THEMEDELETE, layouts[sel].c_str());
|
||||||
if (Rainmeter->ShowMessage(m_Window, text.c_str(), MB_ICONQUESTION | MB_YESNO) != IDYES)
|
if (g_Rainmeter->ShowMessage(m_Window, text.c_str(), MB_ICONQUESTION | MB_YESNO) != IDYES)
|
||||||
{
|
{
|
||||||
// Cancel
|
// Cancel
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring folder = Rainmeter->GetLayoutPath();
|
std::wstring folder = g_Rainmeter->GetLayoutPath();
|
||||||
folder += layouts[sel];
|
folder += layouts[sel];
|
||||||
|
|
||||||
if (CSystem::RemoveFolder(folder))
|
if (System::RemoveFolder(folder))
|
||||||
{
|
{
|
||||||
ListBox_DeleteString(item, sel);
|
ListBox_DeleteString(item, sel);
|
||||||
|
|
||||||
@@ -1792,13 +1792,13 @@ INT_PTR CDialogManage::CTabLayouts::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
** Constructor.
|
** Constructor.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CDialogManage::CTabSettings::CTabSettings() : CTab()
|
DialogManage::TabSettings::TabSettings() : Tab()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogManage::CTabSettings::Create(HWND owner)
|
void DialogManage::TabSettings::Create(HWND owner)
|
||||||
{
|
{
|
||||||
CTab::CreateTabWindow(15, 30, 470, 260, owner);
|
Tab::CreateTabWindow(15, 30, 470, 260, owner);
|
||||||
|
|
||||||
// FIXME: Temporary hack.
|
// FIXME: Temporary hack.
|
||||||
short buttonWidth = (short)_wtoi(GetString(ID_STR_NUM_BUTTONWIDTH));
|
short buttonWidth = (short)_wtoi(GetString(ID_STR_NUM_BUTTONWIDTH));
|
||||||
@@ -1856,12 +1856,12 @@ void CDialogManage::CTabSettings::Create(HWND owner)
|
|||||||
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
CreateControls(s_Controls, _countof(s_Controls), c_Dialog->m_Font, GetString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDialogManage::CTabSettings::Initialize()
|
void DialogManage::TabSettings::Initialize()
|
||||||
{
|
{
|
||||||
// Scan for languages
|
// Scan for languages
|
||||||
HWND item = GetControl(Id_LanguageDropDownList);
|
HWND item = GetControl(Id_LanguageDropDownList);
|
||||||
|
|
||||||
std::wstring files = Rainmeter->GetPath() + L"Languages\\*.dll";
|
std::wstring files = g_Rainmeter->GetPath() + L"Languages\\*.dll";
|
||||||
WIN32_FIND_DATA fd;
|
WIN32_FIND_DATA fd;
|
||||||
HANDLE hSearch = FindFirstFile(files.c_str(), &fd);
|
HANDLE hSearch = FindFirstFile(files.c_str(), &fd);
|
||||||
if (hSearch != INVALID_HANDLE_VALUE)
|
if (hSearch != INVALID_HANDLE_VALUE)
|
||||||
@@ -1886,7 +1886,7 @@ void CDialogManage::CTabSettings::Initialize()
|
|||||||
int index = ComboBox_AddString(item, text.c_str());
|
int index = ComboBox_AddString(item, text.c_str());
|
||||||
ComboBox_SetItemData(item, index, (LPARAM)lcid);
|
ComboBox_SetItemData(item, index, (LPARAM)lcid);
|
||||||
|
|
||||||
if (lcid == Rainmeter->GetResourceLCID())
|
if (lcid == g_Rainmeter->GetResourceLCID())
|
||||||
{
|
{
|
||||||
ComboBox_SetCurSel(item, index);
|
ComboBox_SetCurSel(item, index);
|
||||||
}
|
}
|
||||||
@@ -1898,24 +1898,24 @@ void CDialogManage::CTabSettings::Initialize()
|
|||||||
FindClose(hSearch);
|
FindClose(hSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
Button_SetCheck(GetControl(Id_CheckForUpdatesCheckBox), !Rainmeter->GetDisableVersionCheck());
|
Button_SetCheck(GetControl(Id_CheckForUpdatesCheckBox), !g_Rainmeter->GetDisableVersionCheck());
|
||||||
Button_SetCheck(GetControl(Id_LockSkinsCheckBox), Rainmeter->GetDisableDragging());
|
Button_SetCheck(GetControl(Id_LockSkinsCheckBox), g_Rainmeter->GetDisableDragging());
|
||||||
Button_SetCheck(GetControl(Id_LogToFileCheckBox), CLogger::GetInstance().IsLogToFile());
|
Button_SetCheck(GetControl(Id_LogToFileCheckBox), Logger::GetInstance().IsLogToFile());
|
||||||
Button_SetCheck(GetControl(Id_VerboseLoggingCheckbox), Rainmeter->GetDebug());
|
Button_SetCheck(GetControl(Id_VerboseLoggingCheckbox), g_Rainmeter->GetDebug());
|
||||||
|
|
||||||
BOOL isLogFile = (_waccess(CLogger::GetInstance().GetLogFilePath().c_str(), 0) != -1);
|
BOOL isLogFile = (_waccess(Logger::GetInstance().GetLogFilePath().c_str(), 0) != -1);
|
||||||
EnableWindow(GetControl(Id_ShowLogFileButton), isLogFile);
|
EnableWindow(GetControl(Id_ShowLogFileButton), isLogFile);
|
||||||
EnableWindow(GetControl(Id_DeleteLogFileButton), isLogFile);
|
EnableWindow(GetControl(Id_DeleteLogFileButton), isLogFile);
|
||||||
|
|
||||||
Edit_SetText(GetControl(Id_EditorEdit), Rainmeter->GetSkinEditor().c_str());
|
Edit_SetText(GetControl(Id_EditorEdit), g_Rainmeter->GetSkinEditor().c_str());
|
||||||
|
|
||||||
bool iconEnabled = Rainmeter->GetTrayWindow()->IsTrayIconEnabled();
|
bool iconEnabled = g_Rainmeter->GetTrayWindow()->IsTrayIconEnabled();
|
||||||
Button_SetCheck(GetControl(Id_ShowTrayIconCheckBox), iconEnabled);
|
Button_SetCheck(GetControl(Id_ShowTrayIconCheckBox), iconEnabled);
|
||||||
|
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogManage::CTabSettings::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogManage::TabSettings::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
@@ -1926,7 +1926,7 @@ INT_PTR CDialogManage::CTabSettings::HandleMessage(UINT uMsg, WPARAM wParam, LPA
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
|
INT_PTR DialogManage::TabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (!m_Initialized)
|
if (!m_Initialized)
|
||||||
{
|
{
|
||||||
@@ -1940,66 +1940,66 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
int sel = ComboBox_GetCurSel((HWND)lParam);
|
int sel = ComboBox_GetCurSel((HWND)lParam);
|
||||||
LCID lcid = (LCID)ComboBox_GetItemData((HWND)lParam, sel);
|
LCID lcid = (LCID)ComboBox_GetItemData((HWND)lParam, sel);
|
||||||
if (lcid != Rainmeter->m_ResourceLCID)
|
if (lcid != g_Rainmeter->m_ResourceLCID)
|
||||||
{
|
{
|
||||||
WCHAR buffer[16];
|
WCHAR buffer[16];
|
||||||
_ultow(lcid, buffer, 10);
|
_ultow(lcid, buffer, 10);
|
||||||
WritePrivateProfileString(L"Rainmeter", L"Language", buffer, Rainmeter->GetIniFile().c_str());
|
WritePrivateProfileString(L"Rainmeter", L"Language", buffer, g_Rainmeter->GetIniFile().c_str());
|
||||||
|
|
||||||
std::wstring resource = Rainmeter->GetPath() + L"Languages\\";
|
std::wstring resource = g_Rainmeter->GetPath() + L"Languages\\";
|
||||||
resource += buffer;
|
resource += buffer;
|
||||||
resource += L".dll";
|
resource += L".dll";
|
||||||
FreeLibrary(Rainmeter->m_ResourceInstance);
|
FreeLibrary(g_Rainmeter->m_ResourceInstance);
|
||||||
Rainmeter->m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
|
g_Rainmeter->m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE);
|
||||||
Rainmeter->m_ResourceLCID = lcid;
|
g_Rainmeter->m_ResourceLCID = lcid;
|
||||||
|
|
||||||
if (CDialogAbout::GetDialog())
|
if (DialogAbout::GetDialog())
|
||||||
{
|
{
|
||||||
int sel = TabCtrl_GetCurSel(CDialogAbout::GetDialog()->GetControl(CDialogManage::Id_Tab));
|
int sel = TabCtrl_GetCurSel(DialogAbout::GetDialog()->GetControl(DialogManage::Id_Tab));
|
||||||
SendMessage(CDialogAbout::GetDialog()->GetWindow(), WM_CLOSE, 0, 0);
|
SendMessage(DialogAbout::GetDialog()->GetWindow(), WM_CLOSE, 0, 0);
|
||||||
if (sel == 0)
|
if (sel == 0)
|
||||||
{
|
{
|
||||||
Rainmeter->DelayedExecuteCommand(L"!About");
|
g_Rainmeter->DelayedExecuteCommand(L"!About");
|
||||||
}
|
}
|
||||||
else if (sel == 1)
|
else if (sel == 1)
|
||||||
{
|
{
|
||||||
Rainmeter->DelayedExecuteCommand(L"!About Skins");
|
g_Rainmeter->DelayedExecuteCommand(L"!About Skins");
|
||||||
}
|
}
|
||||||
else if (sel == 2)
|
else if (sel == 2)
|
||||||
{
|
{
|
||||||
Rainmeter->DelayedExecuteCommand(L"!About Plugins");
|
g_Rainmeter->DelayedExecuteCommand(L"!About Plugins");
|
||||||
}
|
}
|
||||||
else //if (sel == 3)
|
else //if (sel == 3)
|
||||||
{
|
{
|
||||||
Rainmeter->DelayedExecuteCommand(L"!About Version");
|
g_Rainmeter->DelayedExecuteCommand(L"!About Version");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(c_Dialog->GetWindow(), WM_CLOSE, 0, 0);
|
SendMessage(c_Dialog->GetWindow(), WM_CLOSE, 0, 0);
|
||||||
Rainmeter->DelayedExecuteCommand(L"!Manage Settings");
|
g_Rainmeter->DelayedExecuteCommand(L"!Manage Settings");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_CheckForUpdatesCheckBox:
|
case Id_CheckForUpdatesCheckBox:
|
||||||
Rainmeter->SetDisableVersionCheck(!Rainmeter->GetDisableVersionCheck());
|
g_Rainmeter->SetDisableVersionCheck(!g_Rainmeter->GetDisableVersionCheck());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_LockSkinsCheckBox:
|
case Id_LockSkinsCheckBox:
|
||||||
Rainmeter->SetDisableDragging(!Rainmeter->GetDisableDragging());
|
g_Rainmeter->SetDisableDragging(!g_Rainmeter->GetDisableDragging());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_ResetStatisticsButton:
|
case Id_ResetStatisticsButton:
|
||||||
Rainmeter->ResetStats();
|
g_Rainmeter->ResetStats();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_ShowLogFileButton:
|
case Id_ShowLogFileButton:
|
||||||
Rainmeter->ShowLogFile();
|
g_Rainmeter->ShowLogFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_DeleteLogFileButton:
|
case Id_DeleteLogFileButton:
|
||||||
CLogger::GetInstance().DeleteLogFile();
|
Logger::GetInstance().DeleteLogFile();
|
||||||
if (_waccess(CLogger::GetInstance().GetLogFilePath().c_str(), 0) == -1)
|
if (_waccess(Logger::GetInstance().GetLogFilePath().c_str(), 0) == -1)
|
||||||
{
|
{
|
||||||
Button_SetCheck(GetControl(Id_LogToFileCheckBox), BST_UNCHECKED);
|
Button_SetCheck(GetControl(Id_LogToFileCheckBox), BST_UNCHECKED);
|
||||||
EnableWindow(GetControl(Id_ShowLogFileButton), FALSE);
|
EnableWindow(GetControl(Id_ShowLogFileButton), FALSE);
|
||||||
@@ -2008,14 +2008,14 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_LogToFileCheckBox:
|
case Id_LogToFileCheckBox:
|
||||||
if (CLogger::GetInstance().IsLogToFile())
|
if (Logger::GetInstance().IsLogToFile())
|
||||||
{
|
{
|
||||||
CLogger::GetInstance().StopLogFile();
|
Logger::GetInstance().StopLogFile();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLogger::GetInstance().StartLogFile();
|
Logger::GetInstance().StartLogFile();
|
||||||
if (_waccess(CLogger::GetInstance().GetLogFilePath().c_str(), 0) != -1)
|
if (_waccess(Logger::GetInstance().GetLogFilePath().c_str(), 0) != -1)
|
||||||
{
|
{
|
||||||
EnableWindow(GetControl(Id_ShowLogFileButton), TRUE);
|
EnableWindow(GetControl(Id_ShowLogFileButton), TRUE);
|
||||||
EnableWindow(GetControl(Id_DeleteLogFileButton), TRUE);
|
EnableWindow(GetControl(Id_DeleteLogFileButton), TRUE);
|
||||||
@@ -2024,7 +2024,7 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_VerboseLoggingCheckbox:
|
case Id_VerboseLoggingCheckbox:
|
||||||
Rainmeter->SetDebug(!Rainmeter->GetDebug());
|
g_Rainmeter->SetDebug(!g_Rainmeter->GetDebug());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_EditorEdit:
|
case Id_EditorEdit:
|
||||||
@@ -2033,7 +2033,7 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
WCHAR buffer[MAX_PATH];
|
WCHAR buffer[MAX_PATH];
|
||||||
if (GetWindowText((HWND)lParam, buffer, _countof(buffer)) > 0)
|
if (GetWindowText((HWND)lParam, buffer, _countof(buffer)) > 0)
|
||||||
{
|
{
|
||||||
Rainmeter->SetSkinEditor(buffer);
|
g_Rainmeter->SetSkinEditor(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2043,7 +2043,7 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
WCHAR buffer[MAX_PATH];
|
WCHAR buffer[MAX_PATH];
|
||||||
buffer[0] = L'\0';
|
buffer[0] = L'\0';
|
||||||
|
|
||||||
std::wstring editor = Rainmeter->GetSkinEditor();
|
std::wstring editor = g_Rainmeter->GetSkinEditor();
|
||||||
editor = editor.substr(0, editor.find_last_of(L"/\\")).c_str();
|
editor = editor.substr(0, editor.find_last_of(L"/\\")).c_str();
|
||||||
|
|
||||||
OPENFILENAME ofn = { sizeof(OPENFILENAME) };
|
OPENFILENAME ofn = { sizeof(OPENFILENAME) };
|
||||||
@@ -2067,7 +2067,7 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Id_ShowTrayIconCheckBox:
|
case Id_ShowTrayIconCheckBox:
|
||||||
Rainmeter->GetTrayWindow()->SetTrayIcon(!Rainmeter->GetTrayWindow()->IsTrayIconEnabled());
|
g_Rainmeter->GetTrayWindow()->SetTrayIcon(!g_Rainmeter->GetTrayWindow()->IsTrayIconEnabled());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -22,19 +22,19 @@
|
|||||||
#include "../Common/Dialog.h"
|
#include "../Common/Dialog.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
class CDialogManage : public CDialog
|
class DialogManage : public Dialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CDialogManage();
|
DialogManage();
|
||||||
virtual ~CDialogManage();
|
virtual ~DialogManage();
|
||||||
|
|
||||||
static CDialog* GetDialog() { return c_Dialog; }
|
static Dialog* GetDialog() { return c_Dialog; }
|
||||||
|
|
||||||
static void Open(const WCHAR* name);
|
static void Open(const WCHAR* name);
|
||||||
static void Open(int tab = 0);
|
static void Open(int tab = 0);
|
||||||
static void OpenSkin(CMeterWindow* meterWindow);
|
static void OpenSkin(MeterWindow* meterWindow);
|
||||||
|
|
||||||
static void UpdateSkins(CMeterWindow* meterWindow, bool deleted = false);
|
static void UpdateSkins(MeterWindow* meterWindow, bool deleted = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
virtual INT_PTR HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
@@ -44,7 +44,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Skins tab
|
// Skins tab
|
||||||
class CTabSkins : public CTab
|
class TabSkins : public Tab
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Id
|
enum Id
|
||||||
@@ -77,12 +77,12 @@ private:
|
|||||||
Id_EditButton = IDM_MANAGESKINSMENU_EDIT
|
Id_EditButton = IDM_MANAGESKINSMENU_EDIT
|
||||||
};
|
};
|
||||||
|
|
||||||
CTabSkins();
|
TabSkins();
|
||||||
|
|
||||||
void Create(HWND owner);
|
void Create(HWND owner);
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
|
|
||||||
void Update(CMeterWindow* meterWindow, bool deleted);
|
void Update(MeterWindow* meterWindow, bool deleted);
|
||||||
|
|
||||||
static void SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR name);
|
static void SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR name);
|
||||||
|
|
||||||
@@ -101,13 +101,13 @@ private:
|
|||||||
|
|
||||||
std::wstring m_SkinFileName;
|
std::wstring m_SkinFileName;
|
||||||
std::wstring m_SkinFolderPath;
|
std::wstring m_SkinFolderPath;
|
||||||
CMeterWindow* m_SkinWindow;
|
MeterWindow* m_SkinWindow;
|
||||||
bool m_HandleCommands;
|
bool m_HandleCommands;
|
||||||
bool m_IgnoreUpdate;
|
bool m_IgnoreUpdate;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Layouts tab
|
// Layouts tab
|
||||||
class CTabLayouts : public CTab
|
class TabLayouts : public Tab
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Id
|
enum Id
|
||||||
@@ -123,7 +123,7 @@ private:
|
|||||||
Id_NameLabel
|
Id_NameLabel
|
||||||
};
|
};
|
||||||
|
|
||||||
CTabLayouts();
|
TabLayouts();
|
||||||
|
|
||||||
void Create(HWND owner);
|
void Create(HWND owner);
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
@@ -134,7 +134,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Settings tab
|
// Settings tab
|
||||||
class CTabSettings : public CTab
|
class TabSettings : public Tab
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Id
|
enum Id
|
||||||
@@ -152,7 +152,7 @@ private:
|
|||||||
Id_ShowTrayIconCheckBox
|
Id_ShowTrayIconCheckBox
|
||||||
};
|
};
|
||||||
|
|
||||||
CTabSettings();
|
TabSettings();
|
||||||
|
|
||||||
void Create(HWND owner);
|
void Create(HWND owner);
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
@@ -172,14 +172,14 @@ private:
|
|||||||
Id_HelpButton
|
Id_HelpButton
|
||||||
};
|
};
|
||||||
|
|
||||||
CTab& GetActiveTab();
|
Tab& GetActiveTab();
|
||||||
|
|
||||||
CTabSkins m_TabSkins;
|
TabSkins m_TabSkins;
|
||||||
CTabLayouts m_TabLayouts;
|
TabLayouts m_TabLayouts;
|
||||||
CTabSettings m_TabSettings;
|
TabSettings m_TabSettings;
|
||||||
|
|
||||||
static WINDOWPLACEMENT c_WindowPlacement;
|
static WINDOWPLACEMENT c_WindowPlacement;
|
||||||
static CDialogManage* c_Dialog;
|
static DialogManage* c_Dialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#define NULLCHECK(str) { if ((str) == NULL) { (str) = L""; } }
|
#define NULLCHECK(str) { if ((str) == NULL) { (str) = L""; } }
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
static std::wstring g_Buffer;
|
static std::wstring g_Buffer;
|
||||||
|
|
||||||
@@ -34,8 +34,8 @@ LPCWSTR __stdcall RmReadString(void* rm, LPCWSTR option, LPCWSTR defValue, BOOL
|
|||||||
NULLCHECK(option);
|
NULLCHECK(option);
|
||||||
NULLCHECK(defValue);
|
NULLCHECK(defValue);
|
||||||
|
|
||||||
CMeasurePlugin* measure = (CMeasurePlugin*)rm;
|
MeasurePlugin* measure = (MeasurePlugin*)rm;
|
||||||
CConfigParser& parser = measure->GetMeterWindow()->GetParser();
|
ConfigParser& parser = measure->GetMeterWindow()->GetParser();
|
||||||
return parser.ReadString(measure->GetName(), option, defValue, (bool)replaceMeasures).c_str();
|
return parser.ReadString(measure->GetName(), option, defValue, (bool)replaceMeasures).c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,8 +43,8 @@ double __stdcall RmReadFormula(void* rm, LPCWSTR option, double defValue)
|
|||||||
{
|
{
|
||||||
NULLCHECK(option);
|
NULLCHECK(option);
|
||||||
|
|
||||||
CMeasurePlugin* measure = (CMeasurePlugin*)rm;
|
MeasurePlugin* measure = (MeasurePlugin*)rm;
|
||||||
CConfigParser& parser = measure->GetMeterWindow()->GetParser();
|
ConfigParser& parser = measure->GetMeterWindow()->GetParser();
|
||||||
return parser.ReadFloat(measure->GetName(), option, defValue);
|
return parser.ReadFloat(measure->GetName(), option, defValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ LPCWSTR __stdcall RmPathToAbsolute(void* rm, LPCWSTR relativePath)
|
|||||||
{
|
{
|
||||||
NULLCHECK(relativePath);
|
NULLCHECK(relativePath);
|
||||||
|
|
||||||
CMeasurePlugin* measure = (CMeasurePlugin*)rm;
|
MeasurePlugin* measure = (MeasurePlugin*)rm;
|
||||||
g_Buffer = relativePath;
|
g_Buffer = relativePath;
|
||||||
measure->GetMeterWindow()->MakePathAbsolute(g_Buffer);
|
measure->GetMeterWindow()->MakePathAbsolute(g_Buffer);
|
||||||
return g_Buffer.c_str();
|
return g_Buffer.c_str();
|
||||||
@@ -60,7 +60,7 @@ LPCWSTR __stdcall RmPathToAbsolute(void* rm, LPCWSTR relativePath)
|
|||||||
|
|
||||||
void* __stdcall RmGet(void* rm, int type)
|
void* __stdcall RmGet(void* rm, int type)
|
||||||
{
|
{
|
||||||
CMeasurePlugin* measure = (CMeasurePlugin*)rm;
|
MeasurePlugin* measure = (MeasurePlugin*)rm;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
@@ -76,19 +76,19 @@ void* __stdcall RmGet(void* rm, int type)
|
|||||||
|
|
||||||
case RMG_SETTINGSFILE:
|
case RMG_SETTINGSFILE:
|
||||||
{
|
{
|
||||||
return (void*)Rainmeter->GetDataFile().c_str();
|
return (void*)g_Rainmeter->GetDataFile().c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
case RMG_SKINNAME:
|
case RMG_SKINNAME:
|
||||||
{
|
{
|
||||||
CMeterWindow* window = measure->GetMeterWindow();
|
MeterWindow* window = measure->GetMeterWindow();
|
||||||
if (!window) break;
|
if (!window) break;
|
||||||
return (void*)window->GetFolderPath().c_str();
|
return (void*)window->GetFolderPath().c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
case RMG_SKINWINDOWHANDLE:
|
case RMG_SKINWINDOWHANDLE:
|
||||||
{
|
{
|
||||||
CMeterWindow* window = measure->GetMeterWindow();
|
MeterWindow* window = measure->GetMeterWindow();
|
||||||
if (!window) break;
|
if (!window) break;
|
||||||
return (void*)window->GetWindow();
|
return (void*)window->GetWindow();
|
||||||
}
|
}
|
||||||
@@ -99,11 +99,11 @@ void* __stdcall RmGet(void* rm, int type)
|
|||||||
|
|
||||||
void __stdcall RmExecute(void* skin, LPCWSTR command)
|
void __stdcall RmExecute(void* skin, LPCWSTR command)
|
||||||
{
|
{
|
||||||
CMeterWindow* mw = (CMeterWindow*)skin;
|
MeterWindow* mw = (MeterWindow*)skin;
|
||||||
if (command)
|
if (command)
|
||||||
{
|
{
|
||||||
// WM_RAINMETER_EXECUTE used instead of ExecuteCommand for thread-safety
|
// WM_RAINMETER_EXECUTE used instead of ExecuteCommand for thread-safety
|
||||||
SendMessage(Rainmeter->GetWindow(), WM_RAINMETER_EXECUTE, (WPARAM)mw, (LPARAM)command);
|
SendMessage(g_Rainmeter->GetWindow(), WM_RAINMETER_EXECUTE, (WPARAM)mw, (LPARAM)command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,9 +112,9 @@ BOOL LSLog(int nLevel, LPCWSTR unused, LPCWSTR pszMessage)
|
|||||||
NULLCHECK(pszMessage);
|
NULLCHECK(pszMessage);
|
||||||
|
|
||||||
// Ignore Level::Debug messages from plugins unless in debug mode
|
// Ignore Level::Debug messages from plugins unless in debug mode
|
||||||
if (nLevel != (int)CLogger::Level::Debug || Rainmeter->GetDebug())
|
if (nLevel != (int)Logger::Level::Debug || g_Rainmeter->GetDebug())
|
||||||
{
|
{
|
||||||
CLogger::GetInstance().Log((CLogger::Level)nLevel, pszMessage);
|
Logger::GetInstance().Log((Logger::Level)nLevel, pszMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -127,7 +127,7 @@ LPCWSTR ReadConfigString(LPCWSTR section, LPCWSTR option, LPCWSTR defValue)
|
|||||||
NULLCHECK(option);
|
NULLCHECK(option);
|
||||||
NULLCHECK(defValue);
|
NULLCHECK(defValue);
|
||||||
|
|
||||||
CConfigParser* parser = Rainmeter->GetCurrentParser();
|
ConfigParser* parser = g_Rainmeter->GetCurrentParser();
|
||||||
if (parser)
|
if (parser)
|
||||||
{
|
{
|
||||||
return parser->ReadString(section, option, defValue, false).c_str();
|
return parser->ReadString(section, option, defValue, false).c_str();
|
||||||
@@ -148,7 +148,7 @@ LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data)
|
|||||||
|
|
||||||
if (_wcsicmp(command, L"GetConfig") == 0)
|
if (_wcsicmp(command, L"GetConfig") == 0)
|
||||||
{
|
{
|
||||||
CMeterWindow* meterWindow = Rainmeter->GetMeterWindowByINI(data);
|
MeterWindow* meterWindow = g_Rainmeter->GetMeterWindowByINI(data);
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
{
|
{
|
||||||
g_Buffer = L"\"";
|
g_Buffer = L"\"";
|
||||||
@@ -161,13 +161,13 @@ LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data)
|
|||||||
}
|
}
|
||||||
else if (_wcsicmp(command, L"GetWindow") == 0)
|
else if (_wcsicmp(command, L"GetWindow") == 0)
|
||||||
{
|
{
|
||||||
std::vector<std::wstring> subStrings = CCommandHandler::ParseString(data);
|
std::vector<std::wstring> subStrings = CommandHandler::ParseString(data);
|
||||||
|
|
||||||
if (subStrings.size() >= 1)
|
if (subStrings.size() >= 1)
|
||||||
{
|
{
|
||||||
const std::wstring& config = subStrings[0];
|
const std::wstring& config = subStrings[0];
|
||||||
|
|
||||||
CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(config);
|
MeterWindow* meterWindow = g_Rainmeter->GetMeterWindow(config);
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
{
|
{
|
||||||
WCHAR buf1[64];
|
WCHAR buf1[64];
|
||||||
@@ -181,13 +181,13 @@ LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data)
|
|||||||
}
|
}
|
||||||
else if (_wcsicmp(command, L"GetVariable") == 0)
|
else if (_wcsicmp(command, L"GetVariable") == 0)
|
||||||
{
|
{
|
||||||
std::vector<std::wstring> subStrings = CCommandHandler::ParseString(data);
|
std::vector<std::wstring> subStrings = CommandHandler::ParseString(data);
|
||||||
|
|
||||||
if (subStrings.size() >= 2)
|
if (subStrings.size() >= 2)
|
||||||
{
|
{
|
||||||
const std::wstring& config = subStrings[0];
|
const std::wstring& config = subStrings[0];
|
||||||
|
|
||||||
CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(config);
|
MeterWindow* meterWindow = g_Rainmeter->GetMeterWindow(config);
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
{
|
{
|
||||||
const std::wstring& variable = subStrings[1];
|
const std::wstring& variable = subStrings[1];
|
||||||
@@ -204,11 +204,11 @@ LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data)
|
|||||||
}
|
}
|
||||||
else if (_wcsicmp(command, L"SetVariable") == 0)
|
else if (_wcsicmp(command, L"SetVariable") == 0)
|
||||||
{
|
{
|
||||||
std::vector<std::wstring> subStrings = CCommandHandler::ParseString(data);
|
std::vector<std::wstring> subStrings = CommandHandler::ParseString(data);
|
||||||
|
|
||||||
if (subStrings.size() == 3)
|
if (subStrings.size() == 3)
|
||||||
{
|
{
|
||||||
CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(subStrings[0]);
|
MeterWindow* meterWindow = g_Rainmeter->GetMeterWindow(subStrings[0]);
|
||||||
if (meterWindow)
|
if (meterWindow)
|
||||||
{
|
{
|
||||||
meterWindow->SetVariable(subStrings[1], subStrings[2]);
|
meterWindow->SetVariable(subStrings[1], subStrings[2]);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "ConfigParser.h"
|
#include "ConfigParser.h"
|
||||||
|
|
||||||
void CGroup::InitializeGroup(const std::wstring& groups)
|
void Group::InitializeGroup(const std::wstring& groups)
|
||||||
{
|
{
|
||||||
if (wcscmp(groups.c_str(), m_OldGroups.c_str()) != 0)
|
if (wcscmp(groups.c_str(), m_OldGroups.c_str()) != 0)
|
||||||
{
|
{
|
||||||
@@ -29,7 +29,7 @@ void CGroup::InitializeGroup(const std::wstring& groups)
|
|||||||
|
|
||||||
if (!groups.empty())
|
if (!groups.empty())
|
||||||
{
|
{
|
||||||
std::vector<std::wstring> vGroups = CConfigParser::Tokenize(groups, L"|");
|
std::vector<std::wstring> vGroups = ConfigParser::Tokenize(groups, L"|");
|
||||||
for (auto iter = vGroups.begin(); iter != vGroups.end(); ++iter)
|
for (auto iter = vGroups.begin(); iter != vGroups.end(); ++iter)
|
||||||
{
|
{
|
||||||
m_Groups.insert(CreateGroup(*iter));
|
m_Groups.insert(CreateGroup(*iter));
|
||||||
@@ -38,18 +38,18 @@ void CGroup::InitializeGroup(const std::wstring& groups)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGroup::BelongsToGroup(const std::wstring& group) const
|
bool Group::BelongsToGroup(const std::wstring& group) const
|
||||||
{
|
{
|
||||||
return (m_Groups.find(VerifyGroup(group)) != m_Groups.end());
|
return (m_Groups.find(VerifyGroup(group)) != m_Groups.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring& CGroup::CreateGroup(std::wstring& str) const
|
std::wstring& Group::CreateGroup(std::wstring& str) const
|
||||||
{
|
{
|
||||||
_wcsupr(&str[0]);
|
_wcsupr(&str[0]);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring CGroup::VerifyGroup(const std::wstring& str) const
|
std::wstring Group::VerifyGroup(const std::wstring& str) const
|
||||||
{
|
{
|
||||||
std::wstring strTmp;
|
std::wstring strTmp;
|
||||||
|
|
||||||
|
|||||||
@@ -22,15 +22,15 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
class __declspec(novtable) CGroup
|
class __declspec(novtable) Group
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~CGroup() {}
|
virtual ~Group() {}
|
||||||
|
|
||||||
bool BelongsToGroup(const std::wstring& group) const;
|
bool BelongsToGroup(const std::wstring& group) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CGroup() {}
|
Group() {}
|
||||||
|
|
||||||
void InitializeGroup(const std::wstring& groups);
|
void InitializeGroup(const std::wstring& groups);
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#include "DialogAbout.h"
|
#include "DialogAbout.h"
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
UINT GetUniqueID()
|
UINT GetUniqueID()
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,7 @@ UINT GetUniqueID()
|
|||||||
WCHAR* GetString(UINT id)
|
WCHAR* GetString(UINT id)
|
||||||
{
|
{
|
||||||
LPWSTR pData;
|
LPWSTR pData;
|
||||||
int len = LoadString(Rainmeter->GetResourceInstance(), id, (LPWSTR)&pData, 0);
|
int len = LoadString(g_Rainmeter->GetResourceInstance(), id, (LPWSTR)&pData, 0);
|
||||||
return len ? pData : L"";
|
return len ? pData : L"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "System.h"
|
#include "System.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -32,26 +32,26 @@ const size_t MAX_LOG_ENTIRES = 20;
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
CLogger::CLogger() :
|
Logger::Logger() :
|
||||||
m_LogToFile(false)
|
m_LogToFile(false)
|
||||||
{
|
{
|
||||||
CSystem::InitializeCriticalSection(&m_CsLog);
|
System::InitializeCriticalSection(&m_CsLog);
|
||||||
CSystem::InitializeCriticalSection(&m_CsLogDelay);
|
System::InitializeCriticalSection(&m_CsLogDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLogger::~CLogger()
|
Logger::~Logger()
|
||||||
{
|
{
|
||||||
DeleteCriticalSection(&m_CsLog);
|
DeleteCriticalSection(&m_CsLog);
|
||||||
DeleteCriticalSection(&m_CsLogDelay);
|
DeleteCriticalSection(&m_CsLogDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLogger& CLogger::GetInstance()
|
Logger& Logger::GetInstance()
|
||||||
{
|
{
|
||||||
static CLogger s_CLogger;
|
static Logger s_Logger;
|
||||||
return s_CLogger;
|
return s_Logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogger::StartLogFile()
|
void Logger::StartLogFile()
|
||||||
{
|
{
|
||||||
const WCHAR* filePath = m_LogFilePath.c_str();
|
const WCHAR* filePath = m_LogFilePath.c_str();
|
||||||
if (_waccess(filePath, 0) == -1)
|
if (_waccess(filePath, 0) == -1)
|
||||||
@@ -65,7 +65,7 @@ void CLogger::StartLogFile()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
const std::wstring text = GetFormattedString(ID_STR_LOGFILECREATEFAIL, filePath);
|
const std::wstring text = GetFormattedString(ID_STR_LOGFILECREATEFAIL, filePath);
|
||||||
Rainmeter->ShowMessage(NULL, text.c_str(), MB_OK | MB_ICONERROR);
|
g_Rainmeter->ShowMessage(NULL, text.c_str(), MB_OK | MB_ICONERROR);
|
||||||
SetLogToFile(false);
|
SetLogToFile(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -74,34 +74,34 @@ void CLogger::StartLogFile()
|
|||||||
SetLogToFile(true);
|
SetLogToFile(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogger::StopLogFile()
|
void Logger::StopLogFile()
|
||||||
{
|
{
|
||||||
SetLogToFile(false);
|
SetLogToFile(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogger::DeleteLogFile()
|
void Logger::DeleteLogFile()
|
||||||
{
|
{
|
||||||
const WCHAR* filePath = m_LogFilePath.c_str();
|
const WCHAR* filePath = m_LogFilePath.c_str();
|
||||||
if (_waccess(filePath, 0) != -1)
|
if (_waccess(filePath, 0) != -1)
|
||||||
{
|
{
|
||||||
const std::wstring text = GetFormattedString(ID_STR_LOGFILEDELETE, filePath);
|
const std::wstring text = GetFormattedString(ID_STR_LOGFILEDELETE, filePath);
|
||||||
const int res = Rainmeter->ShowMessage(NULL, text.c_str(), MB_YESNO | MB_ICONQUESTION);
|
const int res = g_Rainmeter->ShowMessage(NULL, text.c_str(), MB_YESNO | MB_ICONQUESTION);
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
{
|
{
|
||||||
SetLogToFile(false);
|
SetLogToFile(false);
|
||||||
CSystem::RemoveFile(m_LogFilePath);
|
System::RemoveFile(m_LogFilePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogger::SetLogToFile(bool logToFile)
|
void Logger::SetLogToFile(bool logToFile)
|
||||||
{
|
{
|
||||||
m_LogToFile = logToFile;
|
m_LogToFile = logToFile;
|
||||||
WritePrivateProfileString(
|
WritePrivateProfileString(
|
||||||
L"Rainmeter", L"Logging", logToFile ? L"1" : L"0", Rainmeter->GetIniFile().c_str());
|
L"Rainmeter", L"Logging", logToFile ? L"1" : L"0", g_Rainmeter->GetIniFile().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogger::LogInternal(Level level, ULONGLONG timestamp, const WCHAR* msg)
|
void Logger::LogInternal(Level level, ULONGLONG timestamp, const WCHAR* msg)
|
||||||
{
|
{
|
||||||
WCHAR timestampSz[128];
|
WCHAR timestampSz[128];
|
||||||
size_t len = _snwprintf_s(
|
size_t len = _snwprintf_s(
|
||||||
@@ -121,11 +121,11 @@ void CLogger::LogInternal(Level level, ULONGLONG timestamp, const WCHAR* msg)
|
|||||||
m_Entries.pop_front();
|
m_Entries.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
CDialogAbout::AddLogItem(level, timestampSz, msg);
|
DialogAbout::AddLogItem(level, timestampSz, msg);
|
||||||
WriteToLogFile(entry);
|
WriteToLogFile(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogger::WriteToLogFile(Entry& entry)
|
void Logger::WriteToLogFile(Entry& entry)
|
||||||
{
|
{
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
if (!m_LogToFile) return;
|
if (!m_LogToFile) return;
|
||||||
@@ -166,7 +166,7 @@ void CLogger::WriteToLogFile(Entry& entry)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogger::Log(Level level, const WCHAR* msg)
|
void Logger::Log(Level level, const WCHAR* msg)
|
||||||
{
|
{
|
||||||
struct DelayedEntry
|
struct DelayedEntry
|
||||||
{
|
{
|
||||||
@@ -176,8 +176,8 @@ void CLogger::Log(Level level, const WCHAR* msg)
|
|||||||
};
|
};
|
||||||
static std::list<DelayedEntry> s_DelayedEntries;
|
static std::list<DelayedEntry> s_DelayedEntries;
|
||||||
|
|
||||||
static ULONGLONG s_StartTime = CSystem::GetTickCount64();
|
static ULONGLONG s_StartTime = System::GetTickCount64();
|
||||||
ULONGLONG elapsed = CSystem::GetTickCount64() - s_StartTime;
|
ULONGLONG elapsed = System::GetTickCount64() - s_StartTime;
|
||||||
|
|
||||||
if (TryEnterCriticalSection(&m_CsLog))
|
if (TryEnterCriticalSection(&m_CsLog))
|
||||||
{
|
{
|
||||||
@@ -211,7 +211,7 @@ void CLogger::Log(Level level, const WCHAR* msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogger::LogF(Level level, const WCHAR* format, ...)
|
void Logger::LogF(Level level, const WCHAR* format, ...)
|
||||||
{
|
{
|
||||||
WCHAR* buffer = new WCHAR[1024];
|
WCHAR* buffer = new WCHAR[1024];
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
// Singleton class to handle and store log messages and control the log file.
|
// Singleton class to handle and store log messages and control the log file.
|
||||||
class CLogger
|
class Logger
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class Level
|
enum class Level
|
||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
std::wstring message;
|
std::wstring message;
|
||||||
};
|
};
|
||||||
|
|
||||||
static CLogger& GetInstance();
|
static Logger& GetInstance();
|
||||||
|
|
||||||
void SetLogFilePath(std::wstring path) { m_LogFilePath = path; }
|
void SetLogFilePath(std::wstring path) { m_LogFilePath = path; }
|
||||||
|
|
||||||
@@ -66,8 +66,8 @@ private:
|
|||||||
// Appends |entry| to the log file.
|
// Appends |entry| to the log file.
|
||||||
void WriteToLogFile(Entry& entry);
|
void WriteToLogFile(Entry& entry);
|
||||||
|
|
||||||
CLogger();
|
Logger();
|
||||||
~CLogger();
|
~Logger();
|
||||||
|
|
||||||
bool m_LogToFile;
|
bool m_LogToFile;
|
||||||
std::wstring m_LogFilePath;
|
std::wstring m_LogFilePath;
|
||||||
@@ -82,13 +82,13 @@ private:
|
|||||||
#define RM_LOGGER_DEFINE_LOG_FUNCTION(name) \
|
#define RM_LOGGER_DEFINE_LOG_FUNCTION(name) \
|
||||||
inline void Log ## name(const WCHAR* msg) \
|
inline void Log ## name(const WCHAR* msg) \
|
||||||
{ \
|
{ \
|
||||||
CLogger::GetInstance().Log(CLogger::Level::name, msg); \
|
Logger::GetInstance().Log(Logger::Level::name, msg); \
|
||||||
} \
|
} \
|
||||||
/* \
|
/* \
|
||||||
template<typename... Args> \
|
template<typename... Args> \
|
||||||
inline void Log ## name ## F(const WCHAR* format, Args... args) \
|
inline void Log ## name ## F(const WCHAR* format, Args... args) \
|
||||||
{ \
|
{ \
|
||||||
GetInstance().LogF(CLogger::Level::name, args...); \
|
GetInstance().LogF(Logger::Level::name, args...); \
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ RM_LOGGER_DEFINE_LOG_FUNCTION(Debug)
|
|||||||
|
|
||||||
// FIXME: Temporary solution until VS support variadic templates.
|
// FIXME: Temporary solution until VS support variadic templates.
|
||||||
#define RM_LOGGER_LOGF_HELPER(name, format, ...) \
|
#define RM_LOGGER_LOGF_HELPER(name, format, ...) \
|
||||||
CLogger::GetInstance().LogF(CLogger::Level::name, format, __VA_ARGS__)
|
Logger::GetInstance().LogF(Logger::Level::name, format, __VA_ARGS__)
|
||||||
#define LogErrorF(format, ...) RM_LOGGER_LOGF_HELPER(Error, format, __VA_ARGS__)
|
#define LogErrorF(format, ...) RM_LOGGER_LOGF_HELPER(Error, format, __VA_ARGS__)
|
||||||
#define LogWarningF(format, ...) RM_LOGGER_LOGF_HELPER(Warning, format, __VA_ARGS__)
|
#define LogWarningF(format, ...) RM_LOGGER_LOGF_HELPER(Warning, format, __VA_ARGS__)
|
||||||
#define LogNoticeF(format, ...) RM_LOGGER_LOGF_HELPER(Notice, format, __VA_ARGS__)
|
#define LogNoticeF(format, ...) RM_LOGGER_LOGF_HELPER(Notice, format, __VA_ARGS__)
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ const WCHAR* MathParser::CheckedParse(const WCHAR* formula, double* result)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const WCHAR* MathParser::Parse(const WCHAR* formula, CMeasureCalc* calc, double* result)
|
const WCHAR* MathParser::Parse(const WCHAR* formula, MeasureCalc* calc, double* result)
|
||||||
{
|
{
|
||||||
static WCHAR errorBuffer[128];
|
static WCHAR errorBuffer[128];
|
||||||
|
|
||||||
|
|||||||
@@ -21,13 +21,13 @@
|
|||||||
#ifndef __MATHPARSER_H__
|
#ifndef __MATHPARSER_H__
|
||||||
#define __MATHPARSER_H__
|
#define __MATHPARSER_H__
|
||||||
|
|
||||||
class CMeasureCalc;
|
class MeasureCalc;
|
||||||
|
|
||||||
namespace MathParser
|
namespace MathParser
|
||||||
{
|
{
|
||||||
const WCHAR* Check(const WCHAR* formula);
|
const WCHAR* Check(const WCHAR* formula);
|
||||||
const WCHAR* CheckedParse(const WCHAR* formula, double* result);
|
const WCHAR* CheckedParse(const WCHAR* formula, double* result);
|
||||||
const WCHAR* Parse(const WCHAR* formula, CMeasureCalc* calc, double* result);
|
const WCHAR* Parse(const WCHAR* formula, MeasureCalc* calc, double* result);
|
||||||
|
|
||||||
bool IsDelimiter(WCHAR ch);
|
bool IsDelimiter(WCHAR ch);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,13 +63,13 @@ static const double g_TblScale[2][4] = {
|
|||||||
|
|
||||||
const int MEDIAN_SIZE = 3;
|
const int MEDIAN_SIZE = 3;
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasure::CMeasure(CMeterWindow* meterWindow, const WCHAR* name) : CSection(meterWindow, name),
|
Measure::Measure(MeterWindow* meterWindow, const WCHAR* name) : Section(meterWindow, name),
|
||||||
m_Invert(false),
|
m_Invert(false),
|
||||||
m_LogMaxValue(false),
|
m_LogMaxValue(false),
|
||||||
m_MinValue(),
|
m_MinValue(),
|
||||||
@@ -96,7 +96,7 @@ CMeasure::CMeasure(CMeterWindow* meterWindow, const WCHAR* name) : CSection(mete
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasure::~CMeasure()
|
Measure::~Measure()
|
||||||
{
|
{
|
||||||
delete m_OldValue;
|
delete m_OldValue;
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ CMeasure::~CMeasure()
|
|||||||
** Initializes the measure.
|
** Initializes the measure.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasure::Initialize()
|
void Measure::Initialize()
|
||||||
{
|
{
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
@@ -115,11 +115,11 @@ void CMeasure::Initialize()
|
|||||||
** call this base implementation if they overwrite this method.
|
** call this base implementation if they overwrite this method.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasure::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void Measure::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
bool oldOnChangeActionEmpty = m_OnChangeAction.empty();
|
bool oldOnChangeActionEmpty = m_OnChangeAction.empty();
|
||||||
|
|
||||||
CSection::ReadOptions(parser, section);
|
Section::ReadOptions(parser, section);
|
||||||
|
|
||||||
// Clear substitutes to prevent from being added more than once.
|
// Clear substitutes to prevent from being added more than once.
|
||||||
if (!m_Substitute.empty())
|
if (!m_Substitute.empty())
|
||||||
@@ -173,7 +173,7 @@ void CMeasure::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeasure::Disable()
|
void Measure::Disable()
|
||||||
{
|
{
|
||||||
m_Disabled = true;
|
m_Disabled = true;
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ void CMeasure::Disable()
|
|||||||
m_MeterWindow->GetParser().SetValue(m_Name, L"Disabled", L"1");
|
m_MeterWindow->GetParser().SetValue(m_Name, L"Disabled", L"1");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeasure::Enable()
|
void Measure::Enable()
|
||||||
{
|
{
|
||||||
m_Disabled = false;
|
m_Disabled = false;
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ void CMeasure::Enable()
|
|||||||
/*
|
/*
|
||||||
** Substitues text using a straight find and replace method
|
** Substitues text using a straight find and replace method
|
||||||
*/
|
*/
|
||||||
bool CMeasure::MakePlainSubstitute(std::wstring& str, size_t index)
|
bool Measure::MakePlainSubstitute(std::wstring& str, size_t index)
|
||||||
{
|
{
|
||||||
size_t start = 0, pos;
|
size_t start = 0, pos;
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ bool CMeasure::MakePlainSubstitute(std::wstring& str, size_t index)
|
|||||||
/*
|
/*
|
||||||
** Substitutes part of the text
|
** Substitutes part of the text
|
||||||
*/
|
*/
|
||||||
const WCHAR* CMeasure::CheckSubstitute(const WCHAR* buffer)
|
const WCHAR* Measure::CheckSubstitute(const WCHAR* buffer)
|
||||||
{
|
{
|
||||||
static std::wstring str;
|
static std::wstring str;
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ const WCHAR* CMeasure::CheckSubstitute(const WCHAR* buffer)
|
|||||||
** Reads the buffer for "Name":"Value"-pairs separated with comma and
|
** Reads the buffer for "Name":"Value"-pairs separated with comma and
|
||||||
** fills the map with the parsed data.
|
** fills the map with the parsed data.
|
||||||
*/
|
*/
|
||||||
bool CMeasure::ParseSubstitute(std::wstring buffer)
|
bool Measure::ParseSubstitute(std::wstring buffer)
|
||||||
{
|
{
|
||||||
if (buffer.empty()) return true;
|
if (buffer.empty()) return true;
|
||||||
|
|
||||||
@@ -373,7 +373,7 @@ bool CMeasure::ParseSubstitute(std::wstring buffer)
|
|||||||
** If not, the separators are ' ', '\t', ',' and ':'. Whitespaces are removed
|
** If not, the separators are ' ', '\t', ',' and ':'. Whitespaces are removed
|
||||||
** and buffer _will_ be modified.
|
** and buffer _will_ be modified.
|
||||||
*/
|
*/
|
||||||
std::wstring CMeasure::ExtractWord(std::wstring& buffer)
|
std::wstring Measure::ExtractWord(std::wstring& buffer)
|
||||||
{
|
{
|
||||||
std::wstring::size_type end, len = buffer.size();
|
std::wstring::size_type end, len = buffer.size();
|
||||||
std::wstring ret;
|
std::wstring ret;
|
||||||
@@ -435,7 +435,7 @@ std::wstring CMeasure::ExtractWord(std::wstring& buffer)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMeasure::Update()
|
bool Measure::Update()
|
||||||
{
|
{
|
||||||
if (!m_Disabled)
|
if (!m_Disabled)
|
||||||
{
|
{
|
||||||
@@ -501,7 +501,7 @@ bool CMeasure::Update()
|
|||||||
if (!m_IfEqualCommitted)
|
if (!m_IfEqualCommitted)
|
||||||
{
|
{
|
||||||
m_IfEqualCommitted = true; // To avoid infinite loop from !Update
|
m_IfEqualCommitted = true; // To avoid infinite loop from !Update
|
||||||
Rainmeter->ExecuteCommand(m_IfEqualAction.c_str(), m_MeterWindow);
|
g_Rainmeter->ExecuteCommand(m_IfEqualAction.c_str(), m_MeterWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -517,7 +517,7 @@ bool CMeasure::Update()
|
|||||||
if (!m_IfAboveCommitted)
|
if (!m_IfAboveCommitted)
|
||||||
{
|
{
|
||||||
m_IfAboveCommitted = true; // To avoid infinite loop from !Update
|
m_IfAboveCommitted = true; // To avoid infinite loop from !Update
|
||||||
Rainmeter->ExecuteCommand(m_IfAboveAction.c_str(), m_MeterWindow);
|
g_Rainmeter->ExecuteCommand(m_IfAboveAction.c_str(), m_MeterWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -533,7 +533,7 @@ bool CMeasure::Update()
|
|||||||
if (!m_IfBelowCommitted)
|
if (!m_IfBelowCommitted)
|
||||||
{
|
{
|
||||||
m_IfBelowCommitted = true; // To avoid infinite loop from !Update
|
m_IfBelowCommitted = true; // To avoid infinite loop from !Update
|
||||||
Rainmeter->ExecuteCommand(m_IfBelowAction.c_str(), m_MeterWindow);
|
g_Rainmeter->ExecuteCommand(m_IfBelowAction.c_str(), m_MeterWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -574,7 +574,7 @@ bool CMeasure::Update()
|
|||||||
** Returns the value of the measure.
|
** Returns the value of the measure.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
double CMeasure::GetValue()
|
double Measure::GetValue()
|
||||||
{
|
{
|
||||||
// Invert if so requested
|
// Invert if so requested
|
||||||
if (m_Invert)
|
if (m_Invert)
|
||||||
@@ -589,7 +589,7 @@ double CMeasure::GetValue()
|
|||||||
** Returns the relative value of the measure (0.0 - 1.0).
|
** Returns the relative value of the measure (0.0 - 1.0).
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
double CMeasure::GetRelativeValue()
|
double Measure::GetRelativeValue()
|
||||||
{
|
{
|
||||||
double range = GetValueRange();
|
double range = GetValueRange();
|
||||||
|
|
||||||
@@ -612,7 +612,7 @@ double CMeasure::GetRelativeValue()
|
|||||||
** Returns the value range.
|
** Returns the value range.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
double CMeasure::GetValueRange()
|
double Measure::GetValueRange()
|
||||||
{
|
{
|
||||||
return m_MaxValue - m_MinValue;
|
return m_MaxValue - m_MinValue;
|
||||||
}
|
}
|
||||||
@@ -622,7 +622,7 @@ double CMeasure::GetValueRange()
|
|||||||
** string value that is not based on m_Value.
|
** string value that is not based on m_Value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
const WCHAR* CMeasure::GetStringValue()
|
const WCHAR* Measure::GetStringValue()
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -631,7 +631,7 @@ const WCHAR* CMeasure::GetStringValue()
|
|||||||
** Returns the unformatted string value if the measure has one or a formatted value otherwise.
|
** Returns the unformatted string value if the measure has one or a formatted value otherwise.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
const WCHAR* CMeasure::GetStringOrFormattedValue(AUTOSCALE autoScale, double scale, int decimals, bool percentual)
|
const WCHAR* Measure::GetStringOrFormattedValue(AUTOSCALE autoScale, double scale, int decimals, bool percentual)
|
||||||
{
|
{
|
||||||
const WCHAR* stringValue = GetStringValue();
|
const WCHAR* stringValue = GetStringValue();
|
||||||
return stringValue ? stringValue : GetFormattedValue(autoScale, scale, decimals, percentual);
|
return stringValue ? stringValue : GetFormattedValue(autoScale, scale, decimals, percentual);
|
||||||
@@ -646,7 +646,7 @@ const WCHAR* CMeasure::GetStringOrFormattedValue(AUTOSCALE autoScale, double sca
|
|||||||
** decimals Number of decimals used in the value. If -1, get rid of ".00000" for dynamic variables.
|
** decimals Number of decimals used in the value. If -1, get rid of ".00000" for dynamic variables.
|
||||||
** percentual Return the value as % from the maximum value.
|
** percentual Return the value as % from the maximum value.
|
||||||
*/
|
*/
|
||||||
const WCHAR* CMeasure::GetFormattedValue(AUTOSCALE autoScale, double scale, int decimals, bool percentual)
|
const WCHAR* Measure::GetFormattedValue(AUTOSCALE autoScale, double scale, int decimals, bool percentual)
|
||||||
{
|
{
|
||||||
static WCHAR buffer[128];
|
static WCHAR buffer[128];
|
||||||
WCHAR format[32];
|
WCHAR format[32];
|
||||||
@@ -681,7 +681,7 @@ const WCHAR* CMeasure::GetFormattedValue(AUTOSCALE autoScale, double scale, int
|
|||||||
return CheckSubstitute(buffer);
|
return CheckSubstitute(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeasure::GetScaledValue(AUTOSCALE autoScale, int decimals, double theValue, WCHAR* buffer, size_t sizeInWords)
|
void Measure::GetScaledValue(AUTOSCALE autoScale, int decimals, double theValue, WCHAR* buffer, size_t sizeInWords)
|
||||||
{
|
{
|
||||||
WCHAR format[32];
|
WCHAR format[32];
|
||||||
double value = 0;
|
double value = 0;
|
||||||
@@ -726,7 +726,7 @@ void CMeasure::GetScaledValue(AUTOSCALE autoScale, int decimals, double theValue
|
|||||||
_snwprintf_s(buffer, sizeInWords, _TRUNCATE, format, value);
|
_snwprintf_s(buffer, sizeInWords, _TRUNCATE, format, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeasure::RemoveTrailingZero(WCHAR* str, int strLen)
|
void Measure::RemoveTrailingZero(WCHAR* str, int strLen)
|
||||||
{
|
{
|
||||||
--strLen;
|
--strLen;
|
||||||
while (strLen >= 0)
|
while (strLen >= 0)
|
||||||
@@ -752,7 +752,7 @@ void CMeasure::RemoveTrailingZero(WCHAR* str, int strLen)
|
|||||||
** If execute parameter is set to false, only updates old value with current value.
|
** If execute parameter is set to false, only updates old value with current value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasure::DoChangeAction(bool execute)
|
void Measure::DoChangeAction(bool execute)
|
||||||
{
|
{
|
||||||
if (!m_OnChangeAction.empty() && m_ValueAssigned)
|
if (!m_OnChangeAction.empty() && m_ValueAssigned)
|
||||||
{
|
{
|
||||||
@@ -765,13 +765,13 @@ void CMeasure::DoChangeAction(bool execute)
|
|||||||
|
|
||||||
if (!m_OldValue)
|
if (!m_OldValue)
|
||||||
{
|
{
|
||||||
m_OldValue = new CMeasureValueSet(newValue, newStringValue);
|
m_OldValue = new MeasureValueSet(newValue, newStringValue);
|
||||||
}
|
}
|
||||||
else if (execute)
|
else if (execute)
|
||||||
{
|
{
|
||||||
if (m_OldValue->IsChanged(newValue, newStringValue))
|
if (m_OldValue->IsChanged(newValue, newStringValue))
|
||||||
{
|
{
|
||||||
Rainmeter->ExecuteCommand(m_OnChangeAction.c_str(), m_MeterWindow);
|
g_Rainmeter->ExecuteCommand(m_OnChangeAction.c_str(), m_MeterWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -786,65 +786,65 @@ void CMeasure::DoChangeAction(bool execute)
|
|||||||
** If new measures are implemented this method needs to be updated.
|
** If new measures are implemented this method needs to be updated.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow, const WCHAR* name)
|
Measure* Measure::Create(const WCHAR* measure, MeterWindow* meterWindow, const WCHAR* name)
|
||||||
{
|
{
|
||||||
// Comparison is caseinsensitive
|
// Comparison is caseinsensitive
|
||||||
|
|
||||||
if (_wcsicmp(L"CPU", measure) == 0)
|
if (_wcsicmp(L"CPU", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureCPU(meterWindow, name);
|
return new MeasureCPU(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"Memory", measure) == 0)
|
else if (_wcsicmp(L"Memory", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureMemory(meterWindow, name);
|
return new MeasureMemory(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"NetIn", measure) == 0)
|
else if (_wcsicmp(L"NetIn", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureNetIn(meterWindow, name);
|
return new MeasureNetIn(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"NetOut", measure) == 0)
|
else if (_wcsicmp(L"NetOut", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureNetOut(meterWindow, name);
|
return new MeasureNetOut(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"NetTotal", measure) == 0)
|
else if (_wcsicmp(L"NetTotal", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureNetTotal(meterWindow, name);
|
return new MeasureNetTotal(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"PhysicalMemory", measure) == 0)
|
else if (_wcsicmp(L"PhysicalMemory", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasurePhysicalMemory(meterWindow, name);
|
return new MeasurePhysicalMemory(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"SwapMemory", measure) == 0)
|
else if (_wcsicmp(L"SwapMemory", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureVirtualMemory(meterWindow, name);
|
return new MeasureVirtualMemory(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"FreeDiskSpace", measure) == 0)
|
else if (_wcsicmp(L"FreeDiskSpace", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureDiskSpace(meterWindow, name);
|
return new MeasureDiskSpace(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"Uptime", measure) == 0)
|
else if (_wcsicmp(L"Uptime", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureUptime(meterWindow, name);
|
return new MeasureUptime(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"Time", measure) == 0)
|
else if (_wcsicmp(L"Time", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureTime(meterWindow, name);
|
return new MeasureTime(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"Plugin", measure) == 0)
|
else if (_wcsicmp(L"Plugin", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasurePlugin(meterWindow, name);
|
return new MeasurePlugin(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"Registry", measure) == 0)
|
else if (_wcsicmp(L"Registry", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureRegistry(meterWindow, name);
|
return new MeasureRegistry(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"Calc", measure) == 0)
|
else if (_wcsicmp(L"Calc", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureCalc(meterWindow, name);
|
return new MeasureCalc(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"Script", measure) == 0)
|
else if (_wcsicmp(L"Script", measure) == 0)
|
||||||
{
|
{
|
||||||
return new CMeasureScript(meterWindow, name);
|
return new MeasureScript(meterWindow, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogErrorF(L"Measure=%s is not valid in [%s]", measure, name);
|
LogErrorF(L"Measure=%s is not valid in [%s]", measure, name);
|
||||||
@@ -856,7 +856,7 @@ CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow, cons
|
|||||||
** Executes a custom bang.
|
** Executes a custom bang.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasure::Command(const std::wstring& command)
|
void Measure::Command(const std::wstring& command)
|
||||||
{
|
{
|
||||||
LogWarningF(L"!CommandMeasure: Not supported by [%s]", m_Name.c_str());
|
LogWarningF(L"!CommandMeasure: Not supported by [%s]", m_Name.c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ enum AUTOSCALE
|
|||||||
AUTOSCALE_ON = AUTOSCALE_1024
|
AUTOSCALE_ON = AUTOSCALE_1024
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMeasureValueSet
|
class MeasureValueSet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureValueSet(double val, const WCHAR* str) : m_Value(val), m_StringValue(str) {}
|
MeasureValueSet(double val, const WCHAR* str) : m_Value(val), m_StringValue(str) {}
|
||||||
void Set(double val, const WCHAR* str) { m_Value = val; m_StringValue = str; }
|
void Set(double val, const WCHAR* str) { m_Value = val; m_StringValue = str; }
|
||||||
bool IsChanged(double val, const WCHAR* str) { if (m_Value != val || wcscmp(m_StringValue.c_str(), str) != 0) { Set(val, str); return true; } return false; }
|
bool IsChanged(double val, const WCHAR* str) { if (m_Value != val || wcscmp(m_StringValue.c_str(), str) != 0) { Set(val, str); return true; } return false; }
|
||||||
private:
|
private:
|
||||||
@@ -48,16 +48,16 @@ private:
|
|||||||
std::wstring m_StringValue;
|
std::wstring m_StringValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMeter;
|
class Meter;
|
||||||
class CMeterWindow;
|
class MeterWindow;
|
||||||
class CConfigParser;
|
class ConfigParser;
|
||||||
|
|
||||||
class __declspec(novtable) CMeasure : public CSection
|
class __declspec(novtable) Measure : public Section
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~CMeasure();
|
virtual ~Measure();
|
||||||
|
|
||||||
void ReadOptions(CConfigParser& parser) { ReadOptions(parser, GetName()); }
|
void ReadOptions(ConfigParser& parser) { ReadOptions(parser, GetName()); }
|
||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
bool Update();
|
bool Update();
|
||||||
@@ -84,12 +84,12 @@ public:
|
|||||||
const std::wstring& GetOnChangeAction() { return m_OnChangeAction; }
|
const std::wstring& GetOnChangeAction() { return m_OnChangeAction; }
|
||||||
void DoChangeAction(bool execute = true);
|
void DoChangeAction(bool execute = true);
|
||||||
|
|
||||||
static CMeasure* Create(const WCHAR* measure, CMeterWindow* meterWindow, const WCHAR* name);
|
static Measure* Create(const WCHAR* measure, MeterWindow* meterWindow, const WCHAR* name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CMeasure(CMeterWindow* meterWindow, const WCHAR* name);
|
Measure(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
|
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue() = 0;
|
virtual void UpdateValue() = 0;
|
||||||
|
|
||||||
bool ParseSubstitute(std::wstring buffer);
|
bool ParseSubstitute(std::wstring buffer);
|
||||||
@@ -126,7 +126,7 @@ protected:
|
|||||||
bool m_Initialized;
|
bool m_Initialized;
|
||||||
|
|
||||||
std::wstring m_OnChangeAction;
|
std::wstring m_OnChangeAction;
|
||||||
CMeasureValueSet* m_OldValue;
|
MeasureValueSet* m_OldValue;
|
||||||
bool m_ValueAssigned;
|
bool m_ValueAssigned;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
|
|||||||
#define Li2Double(x) ((double)((x).QuadPart))
|
#define Li2Double(x) ((double)((x).QuadPart))
|
||||||
#define Ft2Double(x) ((double)((x).dwHighDateTime) * 4.294967296E9 + (double)((x).dwLowDateTime))
|
#define Ft2Double(x) ((double)((x).dwHighDateTime) * 4.294967296E9 + (double)((x).dwLowDateTime))
|
||||||
|
|
||||||
FPNTQSI CMeasureCPU::c_NtQuerySystemInformation = NULL;
|
FPNTQSI MeasureCPU::c_NtQuerySystemInformation = NULL;
|
||||||
int CMeasureCPU::c_NumOfProcessors = 0;
|
int MeasureCPU::c_NumOfProcessors = 0;
|
||||||
ULONG CMeasureCPU::c_BufferSize = 0;
|
ULONG MeasureCPU::c_BufferSize = 0;
|
||||||
|
|
||||||
// ntdll!NtQuerySystemInformation (NT specific!)
|
// ntdll!NtQuerySystemInformation (NT specific!)
|
||||||
//
|
//
|
||||||
@@ -64,7 +64,7 @@ ULONG CMeasureCPU::c_BufferSize = 0;
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureCPU::CMeasureCPU(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
MeasureCPU::MeasureCPU(MeterWindow* meterWindow, const WCHAR* name) : Measure(meterWindow, name),
|
||||||
m_Processor(),
|
m_Processor(),
|
||||||
m_OldTime()
|
m_OldTime()
|
||||||
{
|
{
|
||||||
@@ -75,7 +75,7 @@ CMeasureCPU::CMeasureCPU(CMeterWindow* meterWindow, const WCHAR* name) : CMeasur
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureCPU::~CMeasureCPU()
|
MeasureCPU::~MeasureCPU()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,9 +83,9 @@ CMeasureCPU::~CMeasureCPU()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureCPU::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasureCPU::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
|
|
||||||
int processor = parser.ReadInt(section, L"Processor", 0);
|
int processor = parser.ReadInt(section, L"Processor", 0);
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ void CMeasureCPU::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the current CPU utilization value.
|
** Updates the current CPU utilization value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureCPU::UpdateValue()
|
void MeasureCPU::UpdateValue()
|
||||||
{
|
{
|
||||||
if (m_Processor == 0)
|
if (m_Processor == 0)
|
||||||
{
|
{
|
||||||
@@ -194,7 +194,7 @@ void CMeasureCPU::UpdateValue()
|
|||||||
** Calculates the current CPU utilization value.
|
** Calculates the current CPU utilization value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureCPU::CalcUsage(double idleTime, double systemTime)
|
void MeasureCPU::CalcUsage(double idleTime, double systemTime)
|
||||||
{
|
{
|
||||||
// CurrentCpuUsage% = 100 - ((IdleTime / SystemTime) * 100)
|
// CurrentCpuUsage% = 100 - ((IdleTime / SystemTime) * 100)
|
||||||
double dbCpuUsage = 100.0 - ((idleTime - m_OldTime[0]) / (systemTime - m_OldTime[1])) * 100.0;
|
double dbCpuUsage = 100.0 - ((idleTime - m_OldTime[0]) / (systemTime - m_OldTime[1])) * 100.0;
|
||||||
@@ -207,7 +207,7 @@ void CMeasureCPU::CalcUsage(double idleTime, double systemTime)
|
|||||||
m_OldTime[1] = systemTime;
|
m_OldTime[1] = systemTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeasureCPU::InitializeStatic()
|
void MeasureCPU::InitializeStatic()
|
||||||
{
|
{
|
||||||
c_NtQuerySystemInformation = (FPNTQSI)GetProcAddress(GetModuleHandle(L"ntdll"), "NtQuerySystemInformation");
|
c_NtQuerySystemInformation = (FPNTQSI)GetProcAddress(GetModuleHandle(L"ntdll"), "NtQuerySystemInformation");
|
||||||
|
|
||||||
@@ -216,6 +216,6 @@ void CMeasureCPU::InitializeStatic()
|
|||||||
c_NumOfProcessors = (int)systemInfo.dwNumberOfProcessors;
|
c_NumOfProcessors = (int)systemInfo.dwNumberOfProcessors;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeasureCPU::FinalizeStatic()
|
void MeasureCPU::FinalizeStatic()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,19 +23,19 @@
|
|||||||
|
|
||||||
typedef LONG (WINAPI *FPNTQSI)(UINT, PVOID, ULONG, PULONG);
|
typedef LONG (WINAPI *FPNTQSI)(UINT, PVOID, ULONG, PULONG);
|
||||||
|
|
||||||
class CMeasureCPU : public CMeasure
|
class MeasureCPU : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureCPU(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureCPU(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureCPU();
|
virtual ~MeasureCPU();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasureCPU>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasureCPU>(); }
|
||||||
|
|
||||||
static void InitializeStatic();
|
static void InitializeStatic();
|
||||||
static void FinalizeStatic();
|
static void FinalizeStatic();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -21,13 +21,13 @@
|
|||||||
#include "Rainmeter.h"
|
#include "Rainmeter.h"
|
||||||
#include "MathParser.h"
|
#include "MathParser.h"
|
||||||
|
|
||||||
bool CMeasureCalc::c_RandSeeded = false;
|
bool MeasureCalc::c_RandSeeded = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureCalc::CMeasureCalc(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
MeasureCalc::MeasureCalc(MeterWindow* meterWindow, const WCHAR* name) : Measure(meterWindow, name),
|
||||||
m_ParseError(false),
|
m_ParseError(false),
|
||||||
m_LowBound(),
|
m_LowBound(),
|
||||||
m_HighBound(100),
|
m_HighBound(100),
|
||||||
@@ -46,7 +46,7 @@ CMeasureCalc::CMeasureCalc(CMeterWindow* meterWindow, const WCHAR* name) : CMeas
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureCalc::~CMeasureCalc()
|
MeasureCalc::~MeasureCalc()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ CMeasureCalc::~CMeasureCalc()
|
|||||||
** Updates the calculation
|
** Updates the calculation
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureCalc::UpdateValue()
|
void MeasureCalc::UpdateValue()
|
||||||
{
|
{
|
||||||
const WCHAR* errMsg = MathParser::Parse(m_Formula.c_str(), this, &m_Value);
|
const WCHAR* errMsg = MathParser::Parse(m_Formula.c_str(), this, &m_Value);
|
||||||
if (errMsg != NULL)
|
if (errMsg != NULL)
|
||||||
@@ -75,9 +75,9 @@ void CMeasureCalc::UpdateValue()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureCalc::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasureCalc::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
|
|
||||||
// Store the current values so we know if the value needs to be updated
|
// Store the current values so we know if the value needs to be updated
|
||||||
int oldLowBound = m_LowBound;
|
int oldLowBound = m_LowBound;
|
||||||
@@ -115,7 +115,7 @@ void CMeasureCalc::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** This replaces the word Random in the formula with a random number
|
** This replaces the word Random in the formula with a random number
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureCalc::FormulaReplace()
|
void MeasureCalc::FormulaReplace()
|
||||||
{
|
{
|
||||||
size_t start = 0, pos;
|
size_t start = 0, pos;
|
||||||
do
|
do
|
||||||
@@ -145,11 +145,11 @@ void CMeasureCalc::FormulaReplace()
|
|||||||
while (pos != std::wstring::npos);
|
while (pos != std::wstring::npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMeasureCalc::GetMeasureValue(const WCHAR* str, int len, double* value)
|
bool MeasureCalc::GetMeasureValue(const WCHAR* str, int len, double* value)
|
||||||
{
|
{
|
||||||
const std::vector<CMeasure*>& measures = m_MeterWindow->GetMeasures();
|
const std::vector<Measure*>& measures = m_MeterWindow->GetMeasures();
|
||||||
|
|
||||||
std::vector<CMeasure*>::const_iterator iter = measures.begin();
|
std::vector<Measure*>::const_iterator iter = measures.begin();
|
||||||
for ( ; iter != measures.end(); ++iter)
|
for ( ; iter != measures.end(); ++iter)
|
||||||
{
|
{
|
||||||
if ((*iter)->GetOriginalName().length() == len &&
|
if ((*iter)->GetOriginalName().length() == len &&
|
||||||
@@ -174,7 +174,7 @@ bool CMeasureCalc::GetMeasureValue(const WCHAR* str, int len, double* value)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMeasureCalc::GetRandom()
|
int MeasureCalc::GetRandom()
|
||||||
{
|
{
|
||||||
double range = (m_HighBound - m_LowBound) + 1;
|
double range = (m_HighBound - m_LowBound) + 1;
|
||||||
srand((unsigned)rand());
|
srand((unsigned)rand());
|
||||||
|
|||||||
@@ -21,18 +21,18 @@
|
|||||||
|
|
||||||
#include "Measure.h"
|
#include "Measure.h"
|
||||||
|
|
||||||
class CMeasureCalc : public CMeasure
|
class MeasureCalc : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureCalc(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureCalc(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureCalc();
|
virtual ~MeasureCalc();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasureCalc>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasureCalc>(); }
|
||||||
|
|
||||||
bool GetMeasureValue(const WCHAR* str, int len, double* value);
|
bool GetMeasureValue(const WCHAR* str, int len, double* value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ enum DRIVETYPE
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureDiskSpace::CMeasureDiskSpace(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
MeasureDiskSpace::MeasureDiskSpace(MeterWindow* meterWindow, const WCHAR* name) : Measure(meterWindow, name),
|
||||||
m_Type(false),
|
m_Type(false),
|
||||||
m_Total(false),
|
m_Total(false),
|
||||||
m_Label(false),
|
m_Label(false),
|
||||||
@@ -52,7 +52,7 @@ CMeasureDiskSpace::CMeasureDiskSpace(CMeterWindow* meterWindow, const WCHAR* nam
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureDiskSpace::~CMeasureDiskSpace()
|
MeasureDiskSpace::~MeasureDiskSpace()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ CMeasureDiskSpace::~CMeasureDiskSpace()
|
|||||||
** Updates the current disk free space value.
|
** Updates the current disk free space value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureDiskSpace::UpdateValue()
|
void MeasureDiskSpace::UpdateValue()
|
||||||
{
|
{
|
||||||
if (!m_Drive.empty())
|
if (!m_Drive.empty())
|
||||||
{
|
{
|
||||||
@@ -164,7 +164,7 @@ void CMeasureDiskSpace::UpdateValue()
|
|||||||
** Returns the time as string.
|
** Returns the time as string.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
const WCHAR* CMeasureDiskSpace::GetStringValue()
|
const WCHAR* MeasureDiskSpace::GetStringValue()
|
||||||
{
|
{
|
||||||
return (m_Type || m_Label) ? CheckSubstitute(m_StringValue.c_str()) : NULL;
|
return (m_Type || m_Label) ? CheckSubstitute(m_StringValue.c_str()) : NULL;
|
||||||
}
|
}
|
||||||
@@ -173,11 +173,11 @@ const WCHAR* CMeasureDiskSpace::GetStringValue()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureDiskSpace::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasureDiskSpace::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
double oldMaxValue = m_MaxValue;
|
double oldMaxValue = m_MaxValue;
|
||||||
|
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
|
|
||||||
m_Drive = parser.ReadString(section, L"Drive", L"C:\\");
|
m_Drive = parser.ReadString(section, L"Drive", L"C:\\");
|
||||||
if (m_Drive.empty())
|
if (m_Drive.empty())
|
||||||
@@ -188,7 +188,7 @@ void CMeasureDiskSpace::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
m_OldTotalBytes = 0;
|
m_OldTotalBytes = 0;
|
||||||
m_StringValue.clear();
|
m_StringValue.clear();
|
||||||
}
|
}
|
||||||
else if (!CSystem::IsPathSeparator(m_Drive[m_Drive.length() - 1])) // E.g. "C:"
|
else if (!System::IsPathSeparator(m_Drive[m_Drive.length() - 1])) // E.g. "C:"
|
||||||
{
|
{
|
||||||
m_Drive += L'\\'; // A trailing backslash is required.
|
m_Drive += L'\\'; // A trailing backslash is required.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,18 +21,18 @@
|
|||||||
|
|
||||||
#include "Measure.h"
|
#include "Measure.h"
|
||||||
|
|
||||||
class CMeasureDiskSpace : public CMeasure
|
class MeasureDiskSpace : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureDiskSpace(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureDiskSpace(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureDiskSpace();
|
virtual ~MeasureDiskSpace();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasureDiskSpace>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasureDiskSpace>(); }
|
||||||
|
|
||||||
virtual const WCHAR* GetStringValue();
|
virtual const WCHAR* GetStringValue();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureMemory::CMeasureMemory(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
MeasureMemory::MeasureMemory(MeterWindow* meterWindow, const WCHAR* name) : Measure(meterWindow, name),
|
||||||
m_Total(false)
|
m_Total(false)
|
||||||
{
|
{
|
||||||
MEMORYSTATUSEX stat;
|
MEMORYSTATUSEX stat;
|
||||||
@@ -37,7 +37,7 @@ CMeasureMemory::CMeasureMemory(CMeterWindow* meterWindow, const WCHAR* name) : C
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureMemory::~CMeasureMemory()
|
MeasureMemory::~MeasureMemory()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ CMeasureMemory::~CMeasureMemory()
|
|||||||
** Updates the current total memory value.
|
** Updates the current total memory value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureMemory::UpdateValue()
|
void MeasureMemory::UpdateValue()
|
||||||
{
|
{
|
||||||
MEMORYSTATUSEX stat;
|
MEMORYSTATUSEX stat;
|
||||||
stat.dwLength = sizeof(MEMORYSTATUSEX);
|
stat.dwLength = sizeof(MEMORYSTATUSEX);
|
||||||
@@ -66,10 +66,10 @@ void CMeasureMemory::UpdateValue()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureMemory::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasureMemory::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
double oldMaxValue = m_MaxValue;
|
double oldMaxValue = m_MaxValue;
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
m_MaxValue = oldMaxValue;
|
m_MaxValue = oldMaxValue;
|
||||||
|
|
||||||
m_Total = (1 == parser.ReadInt(section, L"Total", 0));
|
m_Total = (1 == parser.ReadInt(section, L"Total", 0));
|
||||||
|
|||||||
@@ -21,16 +21,16 @@
|
|||||||
|
|
||||||
#include "Measure.h"
|
#include "Measure.h"
|
||||||
|
|
||||||
class CMeasureMemory : public CMeasure
|
class MeasureMemory : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureMemory(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureMemory(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureMemory();
|
virtual ~MeasureMemory();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasureMemory>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasureMemory>(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -21,21 +21,21 @@
|
|||||||
#include "Rainmeter.h"
|
#include "Rainmeter.h"
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
|
|
||||||
BYTE* CMeasureNet::c_Table = NULL;
|
BYTE* MeasureNet::c_Table = NULL;
|
||||||
UINT CMeasureNet::c_NumOfTables = 0;
|
UINT MeasureNet::c_NumOfTables = 0;
|
||||||
std::vector<ULONG64> CMeasureNet::c_StatValues;
|
std::vector<ULONG64> MeasureNet::c_StatValues;
|
||||||
std::vector<ULONG64> CMeasureNet::c_OldStatValues;
|
std::vector<ULONG64> MeasureNet::c_OldStatValues;
|
||||||
|
|
||||||
FPGETIFTABLE2 CMeasureNet::c_GetIfTable2 = NULL;
|
FPGETIFTABLE2 MeasureNet::c_GetIfTable2 = NULL;
|
||||||
FPFREEMIBTABLE CMeasureNet::c_FreeMibTable = NULL;
|
FPFREEMIBTABLE MeasureNet::c_FreeMibTable = NULL;
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor. This is the base class for the net-meters.
|
** The constructor. This is the base class for the net-meters.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureNet::CMeasureNet(CMeterWindow* meterWindow, const WCHAR* name, NET type) : CMeasure(meterWindow, name),
|
MeasureNet::MeasureNet(MeterWindow* meterWindow, const WCHAR* name, NET type) : Measure(meterWindow, name),
|
||||||
m_Net(type),
|
m_Net(type),
|
||||||
m_Interface(),
|
m_Interface(),
|
||||||
m_Octets(),
|
m_Octets(),
|
||||||
@@ -48,7 +48,7 @@ CMeasureNet::CMeasureNet(CMeterWindow* meterWindow, const WCHAR* name, NET type)
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureNet::~CMeasureNet()
|
MeasureNet::~MeasureNet()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ CMeasureNet::~CMeasureNet()
|
|||||||
** Reads the tables for all net interfaces
|
** Reads the tables for all net interfaces
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureNet::UpdateIFTable()
|
void MeasureNet::UpdateIFTable()
|
||||||
{
|
{
|
||||||
bool logging = false;
|
bool logging = false;
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ void CMeasureNet::UpdateIFTable()
|
|||||||
logging = true;
|
logging = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Rainmeter->GetDebug() && logging)
|
if (g_Rainmeter->GetDebug() && logging)
|
||||||
{
|
{
|
||||||
LogDebug(L"------------------------------");
|
LogDebug(L"------------------------------");
|
||||||
LogDebugF(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables);
|
LogDebugF(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables);
|
||||||
@@ -171,7 +171,7 @@ void CMeasureNet::UpdateIFTable()
|
|||||||
logging = true;
|
logging = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Rainmeter->GetDebug() && logging)
|
if (g_Rainmeter->GetDebug() && logging)
|
||||||
{
|
{
|
||||||
LogDebug(L"------------------------------");
|
LogDebug(L"------------------------------");
|
||||||
LogDebugF(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables);
|
LogDebugF(L"* NETWORK-INTERFACE: Count=%i", c_NumOfTables);
|
||||||
@@ -226,7 +226,7 @@ void CMeasureNet::UpdateIFTable()
|
|||||||
** the net-parameter informs which inherited class called this method.
|
** the net-parameter informs which inherited class called this method.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
ULONG64 CMeasureNet::GetNetOctets(NET net)
|
ULONG64 MeasureNet::GetNetOctets(NET net)
|
||||||
{
|
{
|
||||||
ULONG64 value = 0;
|
ULONG64 value = 0;
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ ULONG64 CMeasureNet::GetNetOctets(NET net)
|
|||||||
** Returns the stats value of the interface
|
** Returns the stats value of the interface
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
ULONG64 CMeasureNet::GetNetStatsValue(NET net)
|
ULONG64 MeasureNet::GetNetStatsValue(NET net)
|
||||||
{
|
{
|
||||||
ULONG64 value = 0;
|
ULONG64 value = 0;
|
||||||
size_t statsSize = c_StatValues.size() / 2;
|
size_t statsSize = c_StatValues.size() / 2;
|
||||||
@@ -414,7 +414,7 @@ ULONG64 CMeasureNet::GetNetStatsValue(NET net)
|
|||||||
** Updates the current value.
|
** Updates the current value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureNet::UpdateValue()
|
void MeasureNet::UpdateValue()
|
||||||
{
|
{
|
||||||
if (c_Table == NULL) return;
|
if (c_Table == NULL) return;
|
||||||
|
|
||||||
@@ -455,9 +455,9 @@ void CMeasureNet::UpdateValue()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureNet::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasureNet::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
|
|
||||||
double value;
|
double value;
|
||||||
const WCHAR* netName = NULL;
|
const WCHAR* netName = NULL;
|
||||||
@@ -465,17 +465,17 @@ void CMeasureNet::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
if (m_Net == NET_IN)
|
if (m_Net == NET_IN)
|
||||||
{
|
{
|
||||||
netName = L"NetInSpeed";
|
netName = L"NetInSpeed";
|
||||||
value = Rainmeter->GetGlobalOptions().netInSpeed;
|
value = g_Rainmeter->GetGlobalOptions().netInSpeed;
|
||||||
}
|
}
|
||||||
else if (m_Net == NET_OUT)
|
else if (m_Net == NET_OUT)
|
||||||
{
|
{
|
||||||
netName = L"NetOutSpeed";
|
netName = L"NetOutSpeed";
|
||||||
value = Rainmeter->GetGlobalOptions().netOutSpeed;
|
value = g_Rainmeter->GetGlobalOptions().netOutSpeed;
|
||||||
}
|
}
|
||||||
else // if (m_Net == NET_TOTAL)
|
else // if (m_Net == NET_TOTAL)
|
||||||
{
|
{
|
||||||
netName = L"NetTotalSpeed";
|
netName = L"NetTotalSpeed";
|
||||||
value = Rainmeter->GetGlobalOptions().netInSpeed + Rainmeter->GetGlobalOptions().netOutSpeed;
|
value = g_Rainmeter->GetGlobalOptions().netInSpeed + g_Rainmeter->GetGlobalOptions().netOutSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
double maxValue = parser.ReadFloat(section, L"MaxValue", -1);
|
double maxValue = parser.ReadFloat(section, L"MaxValue", -1);
|
||||||
@@ -493,7 +493,7 @@ void CMeasureNet::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
m_Cumulative = 0!=parser.ReadInt(section, L"Cumulative", 0);
|
m_Cumulative = 0!=parser.ReadInt(section, L"Cumulative", 0);
|
||||||
if (m_Cumulative)
|
if (m_Cumulative)
|
||||||
{
|
{
|
||||||
Rainmeter->SetNetworkStatisticsTimer();
|
g_Rainmeter->SetNetworkStatisticsTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxValue == 0.0)
|
if (maxValue == 0.0)
|
||||||
@@ -516,7 +516,7 @@ void CMeasureNet::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the statistics.
|
** Updates the statistics.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureNet::UpdateStats()
|
void MeasureNet::UpdateStats()
|
||||||
{
|
{
|
||||||
if (c_Table)
|
if (c_Table)
|
||||||
{
|
{
|
||||||
@@ -574,7 +574,7 @@ void CMeasureNet::UpdateStats()
|
|||||||
** Resets the statistics.
|
** Resets the statistics.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureNet::ResetStats()
|
void MeasureNet::ResetStats()
|
||||||
{
|
{
|
||||||
c_StatValues.clear();
|
c_StatValues.clear();
|
||||||
}
|
}
|
||||||
@@ -583,11 +583,11 @@ void CMeasureNet::ResetStats()
|
|||||||
** Reads statistics.
|
** Reads statistics.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureNet::ReadStats(const std::wstring& iniFile, std::wstring& statsDate)
|
void MeasureNet::ReadStats(const std::wstring& iniFile, std::wstring& statsDate)
|
||||||
{
|
{
|
||||||
WCHAR buffer[48];
|
WCHAR buffer[48];
|
||||||
|
|
||||||
CConfigParser parser;
|
ConfigParser parser;
|
||||||
parser.Initialize(iniFile, NULL, L"Statistics");
|
parser.Initialize(iniFile, NULL, L"Statistics");
|
||||||
|
|
||||||
const std::wstring& date = parser.ReadString(L"Statistics", L"Since", L"", false);
|
const std::wstring& date = parser.ReadString(L"Statistics", L"Since", L"", false);
|
||||||
@@ -639,7 +639,7 @@ void CMeasureNet::ReadStats(const std::wstring& iniFile, std::wstring& statsDate
|
|||||||
** Writes statistics.
|
** Writes statistics.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureNet::WriteStats(const WCHAR* iniFile, const std::wstring& statsDate)
|
void MeasureNet::WriteStats(const WCHAR* iniFile, const std::wstring& statsDate)
|
||||||
{
|
{
|
||||||
WCHAR buffer[48];
|
WCHAR buffer[48];
|
||||||
int len;
|
int len;
|
||||||
@@ -689,7 +689,7 @@ void CMeasureNet::WriteStats(const WCHAR* iniFile, const std::wstring& statsDate
|
|||||||
** Prepares in order to use the new APIs which are available on Vista or newer.
|
** Prepares in order to use the new APIs which are available on Vista or newer.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureNet::InitializeStatic()
|
void MeasureNet::InitializeStatic()
|
||||||
{
|
{
|
||||||
if (Platform::IsAtLeastWinVista())
|
if (Platform::IsAtLeastWinVista())
|
||||||
{
|
{
|
||||||
@@ -707,7 +707,7 @@ void CMeasureNet::InitializeStatic()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Rainmeter->GetDebug())
|
if (g_Rainmeter->GetDebug())
|
||||||
{
|
{
|
||||||
UpdateIFTable();
|
UpdateIFTable();
|
||||||
}
|
}
|
||||||
@@ -717,7 +717,7 @@ void CMeasureNet::InitializeStatic()
|
|||||||
** Frees the resources.
|
** Frees the resources.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureNet::FinalizeStatic()
|
void MeasureNet::FinalizeStatic()
|
||||||
{
|
{
|
||||||
if (c_GetIfTable2)
|
if (c_GetIfTable2)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,10 +27,10 @@
|
|||||||
typedef NETIO_STATUS (NETIOAPI_API_ * FPGETIFTABLE2)(PMIB_IF_TABLE2* Table);
|
typedef NETIO_STATUS (NETIOAPI_API_ * FPGETIFTABLE2)(PMIB_IF_TABLE2* Table);
|
||||||
typedef VOID (NETIOAPI_API_ * FPFREEMIBTABLE)(PVOID Memory);
|
typedef VOID (NETIOAPI_API_ * FPFREEMIBTABLE)(PVOID Memory);
|
||||||
|
|
||||||
class CMeasureNet : public CMeasure
|
class MeasureNet : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasureNet>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasureNet>(); }
|
||||||
|
|
||||||
static void UpdateIFTable();
|
static void UpdateIFTable();
|
||||||
|
|
||||||
@@ -50,10 +50,10 @@ protected:
|
|||||||
NET_TOTAL
|
NET_TOTAL
|
||||||
};
|
};
|
||||||
|
|
||||||
CMeasureNet(CMeterWindow* meterWindow, const WCHAR* name, NET type);
|
MeasureNet(MeterWindow* meterWindow, const WCHAR* name, NET type);
|
||||||
virtual ~CMeasureNet();
|
virtual ~MeasureNet();
|
||||||
|
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureNetIn::CMeasureNetIn(CMeterWindow* meterWindow, const WCHAR* name) : CMeasureNet(meterWindow, name, NET_IN)
|
MeasureNetIn::MeasureNetIn(MeterWindow* meterWindow, const WCHAR* name) : MeasureNet(meterWindow, name, NET_IN)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +31,6 @@ CMeasureNetIn::CMeasureNetIn(CMeterWindow* meterWindow, const WCHAR* name) : CMe
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureNetIn::~CMeasureNetIn()
|
MeasureNetIn::~MeasureNetIn()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -21,11 +21,11 @@
|
|||||||
|
|
||||||
#include "MeasureNet.h"
|
#include "MeasureNet.h"
|
||||||
|
|
||||||
class CMeasureNetIn : public CMeasureNet
|
class MeasureNetIn : public MeasureNet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureNetIn(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureNetIn(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureNetIn();
|
virtual ~MeasureNetIn();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureNetOut::CMeasureNetOut(CMeterWindow* meterWindow, const WCHAR* name) : CMeasureNet(meterWindow, name, NET_OUT)
|
MeasureNetOut::MeasureNetOut(MeterWindow* meterWindow, const WCHAR* name) : MeasureNet(meterWindow, name, NET_OUT)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +31,6 @@ CMeasureNetOut::CMeasureNetOut(CMeterWindow* meterWindow, const WCHAR* name) : C
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureNetOut::~CMeasureNetOut()
|
MeasureNetOut::~MeasureNetOut()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
|
|
||||||
#include "MeasureNet.h"
|
#include "MeasureNet.h"
|
||||||
|
|
||||||
class CMeasureNetOut : public CMeasureNet
|
class MeasureNetOut : public MeasureNet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureNetOut(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureNetOut(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureNetOut();
|
virtual ~MeasureNetOut();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureNetTotal::CMeasureNetTotal(CMeterWindow* meterWindow, const WCHAR* name) : CMeasureNet(meterWindow, name, NET_TOTAL)
|
MeasureNetTotal::MeasureNetTotal(MeterWindow* meterWindow, const WCHAR* name) : MeasureNet(meterWindow, name, NET_TOTAL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +31,6 @@ CMeasureNetTotal::CMeasureNetTotal(CMeterWindow* meterWindow, const WCHAR* name)
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureNetTotal::~CMeasureNetTotal()
|
MeasureNetTotal::~MeasureNetTotal()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
|
|
||||||
#include "MeasureNet.h"
|
#include "MeasureNet.h"
|
||||||
|
|
||||||
class CMeasureNetTotal : public CMeasureNet
|
class MeasureNetTotal : public MeasureNet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureNetTotal(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureNetTotal(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureNetTotal();
|
virtual ~MeasureNetTotal();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasurePhysicalMemory::CMeasurePhysicalMemory(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
MeasurePhysicalMemory::MeasurePhysicalMemory(MeterWindow* meterWindow, const WCHAR* name) : Measure(meterWindow, name),
|
||||||
m_Total(false)
|
m_Total(false)
|
||||||
{
|
{
|
||||||
MEMORYSTATUSEX stat;
|
MEMORYSTATUSEX stat;
|
||||||
@@ -37,7 +37,7 @@ CMeasurePhysicalMemory::CMeasurePhysicalMemory(CMeterWindow* meterWindow, const
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasurePhysicalMemory::~CMeasurePhysicalMemory()
|
MeasurePhysicalMemory::~MeasurePhysicalMemory()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ CMeasurePhysicalMemory::~CMeasurePhysicalMemory()
|
|||||||
** Updates the current physical memory value.
|
** Updates the current physical memory value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasurePhysicalMemory::UpdateValue()
|
void MeasurePhysicalMemory::UpdateValue()
|
||||||
{
|
{
|
||||||
if (!m_Total)
|
if (!m_Total)
|
||||||
{
|
{
|
||||||
@@ -61,10 +61,10 @@ void CMeasurePhysicalMemory::UpdateValue()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasurePhysicalMemory::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasurePhysicalMemory::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
double oldMaxValue = m_MaxValue;
|
double oldMaxValue = m_MaxValue;
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
m_MaxValue = oldMaxValue;
|
m_MaxValue = oldMaxValue;
|
||||||
|
|
||||||
m_Total = (1 == parser.ReadInt(section, L"Total", 0));
|
m_Total = (1 == parser.ReadInt(section, L"Total", 0));
|
||||||
|
|||||||
@@ -21,16 +21,16 @@
|
|||||||
|
|
||||||
#include "Measure.h"
|
#include "Measure.h"
|
||||||
|
|
||||||
class CMeasurePhysicalMemory : public CMeasure
|
class MeasurePhysicalMemory : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasurePhysicalMemory(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasurePhysicalMemory(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasurePhysicalMemory();
|
virtual ~MeasurePhysicalMemory();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasurePhysicalMemory>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasurePhysicalMemory>(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -23,13 +23,13 @@
|
|||||||
#include "System.h"
|
#include "System.h"
|
||||||
#include "Error.h"
|
#include "Error.h"
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasurePlugin::CMeasurePlugin(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
MeasurePlugin::MeasurePlugin(MeterWindow* meterWindow, const WCHAR* name) : Measure(meterWindow, name),
|
||||||
m_Plugin(),
|
m_Plugin(),
|
||||||
m_ReloadFunc(),
|
m_ReloadFunc(),
|
||||||
m_ID(),
|
m_ID(),
|
||||||
@@ -45,7 +45,7 @@ CMeasurePlugin::CMeasurePlugin(CMeterWindow* meterWindow, const WCHAR* name) : C
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasurePlugin::~CMeasurePlugin()
|
MeasurePlugin::~MeasurePlugin()
|
||||||
{
|
{
|
||||||
if (m_Plugin)
|
if (m_Plugin)
|
||||||
{
|
{
|
||||||
@@ -70,7 +70,7 @@ CMeasurePlugin::~CMeasurePlugin()
|
|||||||
** Gets the current value from the plugin
|
** Gets the current value from the plugin
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasurePlugin::UpdateValue()
|
void MeasurePlugin::UpdateValue()
|
||||||
{
|
{
|
||||||
if (m_UpdateFunc)
|
if (m_UpdateFunc)
|
||||||
{
|
{
|
||||||
@@ -91,7 +91,7 @@ void CMeasurePlugin::UpdateValue()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset to default
|
// Reset to default
|
||||||
CSystem::ResetWorkingDirectory();
|
System::ResetWorkingDirectory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,11 +99,11 @@ void CMeasurePlugin::UpdateValue()
|
|||||||
** Reads the options and loads the plugin
|
** Reads the options and loads the plugin
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasurePlugin::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasurePlugin::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
static UINT id = 0;
|
static UINT id = 0;
|
||||||
|
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
|
|
||||||
if (m_Initialized)
|
if (m_Initialized)
|
||||||
{
|
{
|
||||||
@@ -129,17 +129,17 @@ void CMeasurePlugin::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First try from program path
|
// First try from program path
|
||||||
std::wstring pluginFile = Rainmeter->GetPluginPath();
|
std::wstring pluginFile = g_Rainmeter->GetPluginPath();
|
||||||
pluginFile += pluginName;
|
pluginFile += pluginName;
|
||||||
m_Plugin = CSystem::RmLoadLibrary(pluginFile.c_str());
|
m_Plugin = System::RmLoadLibrary(pluginFile.c_str());
|
||||||
if (!m_Plugin)
|
if (!m_Plugin)
|
||||||
{
|
{
|
||||||
if (Rainmeter->HasUserPluginPath())
|
if (g_Rainmeter->HasUserPluginPath())
|
||||||
{
|
{
|
||||||
// Try from settings path
|
// Try from settings path
|
||||||
pluginFile = Rainmeter->GetUserPluginPath();
|
pluginFile = g_Rainmeter->GetUserPluginPath();
|
||||||
pluginFile += pluginName;
|
pluginFile += pluginName;
|
||||||
m_Plugin = CSystem::RmLoadLibrary(pluginFile.c_str());
|
m_Plugin = System::RmLoadLibrary(pluginFile.c_str());
|
||||||
}
|
}
|
||||||
if (!m_Plugin)
|
if (!m_Plugin)
|
||||||
{
|
{
|
||||||
@@ -204,7 +204,7 @@ void CMeasurePlugin::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
|
|
||||||
// Reset to default
|
// Reset to default
|
||||||
SetDllDirectory(L"");
|
SetDllDirectory(L"");
|
||||||
CSystem::ResetWorkingDirectory();
|
System::ResetWorkingDirectory();
|
||||||
|
|
||||||
++id;
|
++id;
|
||||||
}
|
}
|
||||||
@@ -213,7 +213,7 @@ void CMeasurePlugin::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Gets the string value from the plugin.
|
** Gets the string value from the plugin.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
const WCHAR* CMeasurePlugin::GetStringValue()
|
const WCHAR* MeasurePlugin::GetStringValue()
|
||||||
{
|
{
|
||||||
if (m_GetStringFunc)
|
if (m_GetStringFunc)
|
||||||
{
|
{
|
||||||
@@ -237,7 +237,7 @@ const WCHAR* CMeasurePlugin::GetStringValue()
|
|||||||
** Sends a bang to the plugin
|
** Sends a bang to the plugin
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasurePlugin::Command(const std::wstring& command)
|
void MeasurePlugin::Command(const std::wstring& command)
|
||||||
{
|
{
|
||||||
if (m_ExecuteBangFunc)
|
if (m_ExecuteBangFunc)
|
||||||
{
|
{
|
||||||
@@ -253,6 +253,6 @@ void CMeasurePlugin::Command(const std::wstring& command)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CMeasure::Command(command);
|
Measure::Command(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,19 +36,19 @@ typedef double (*NEWUPDATE)(void*);
|
|||||||
typedef LPCWSTR (*NEWGETSTRING)(void*);
|
typedef LPCWSTR (*NEWGETSTRING)(void*);
|
||||||
typedef void (*NEWEXECUTEBANG)(void*, LPCWSTR);
|
typedef void (*NEWEXECUTEBANG)(void*, LPCWSTR);
|
||||||
|
|
||||||
class CMeasurePlugin : public CMeasure
|
class MeasurePlugin : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasurePlugin(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasurePlugin(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasurePlugin();
|
virtual ~MeasurePlugin();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasurePlugin>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasurePlugin>(); }
|
||||||
|
|
||||||
virtual const WCHAR* GetStringValue();
|
virtual const WCHAR* GetStringValue();
|
||||||
virtual void Command(const std::wstring& command);
|
virtual void Command(const std::wstring& command);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureRegistry::CMeasureRegistry(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
MeasureRegistry::MeasureRegistry(MeterWindow* meterWindow, const WCHAR* name) : Measure(meterWindow, name),
|
||||||
m_RegKey(),
|
m_RegKey(),
|
||||||
m_HKey(HKEY_CURRENT_USER)
|
m_HKey(HKEY_CURRENT_USER)
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,7 @@ CMeasureRegistry::CMeasureRegistry(CMeterWindow* meterWindow, const WCHAR* name)
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureRegistry::~CMeasureRegistry()
|
MeasureRegistry::~MeasureRegistry()
|
||||||
{
|
{
|
||||||
if (m_RegKey) RegCloseKey(m_RegKey);
|
if (m_RegKey) RegCloseKey(m_RegKey);
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ CMeasureRegistry::~CMeasureRegistry()
|
|||||||
** Gets the current value from the registry
|
** Gets the current value from the registry
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureRegistry::UpdateValue()
|
void MeasureRegistry::UpdateValue()
|
||||||
{
|
{
|
||||||
if (m_RegKey != NULL)
|
if (m_RegKey != NULL)
|
||||||
{
|
{
|
||||||
@@ -104,9 +104,9 @@ void CMeasureRegistry::UpdateValue()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureRegistry::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasureRegistry::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
|
|
||||||
const WCHAR* keyname = parser.ReadString(section, L"RegHKey", L"HKEY_CURRENT_USER").c_str();
|
const WCHAR* keyname = parser.ReadString(section, L"RegHKey", L"HKEY_CURRENT_USER").c_str();
|
||||||
if (_wcsicmp(keyname, L"HKEY_CURRENT_USER") == 0)
|
if (_wcsicmp(keyname, L"HKEY_CURRENT_USER") == 0)
|
||||||
@@ -157,7 +157,7 @@ void CMeasureRegistry::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** value to string as normal.
|
** value to string as normal.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
const WCHAR* CMeasureRegistry::GetStringValue()
|
const WCHAR* MeasureRegistry::GetStringValue()
|
||||||
{
|
{
|
||||||
return !m_StringValue.empty() ? CheckSubstitute(m_StringValue.c_str()) : NULL;
|
return !m_StringValue.empty() ? CheckSubstitute(m_StringValue.c_str()) : NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,18 +21,18 @@
|
|||||||
|
|
||||||
#include "Measure.h"
|
#include "Measure.h"
|
||||||
|
|
||||||
class CMeasureRegistry : public CMeasure
|
class MeasureRegistry : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureRegistry(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureRegistry(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureRegistry();
|
virtual ~MeasureRegistry();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasureRegistry>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasureRegistry>(); }
|
||||||
|
|
||||||
virtual const WCHAR* GetStringValue();
|
virtual const WCHAR* GetStringValue();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const char* g_GetStringFunctionName = "GetStringValue";
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureScript::CMeasureScript(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
MeasureScript::MeasureScript(MeterWindow* meterWindow, const WCHAR* name) : Measure(meterWindow, name),
|
||||||
m_HasUpdateFunction(false),
|
m_HasUpdateFunction(false),
|
||||||
m_HasGetStringFunction(false),
|
m_HasGetStringFunction(false),
|
||||||
m_ValueType(LUA_TNIL)
|
m_ValueType(LUA_TNIL)
|
||||||
@@ -40,13 +40,13 @@ CMeasureScript::CMeasureScript(CMeterWindow* meterWindow, const WCHAR* name) : C
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureScript::~CMeasureScript()
|
MeasureScript::~MeasureScript()
|
||||||
{
|
{
|
||||||
UninitializeLuaScript();
|
UninitializeLuaScript();
|
||||||
LuaManager::Finalize();
|
LuaManager::Finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeasureScript::UninitializeLuaScript()
|
void MeasureScript::UninitializeLuaScript()
|
||||||
{
|
{
|
||||||
m_LuaScript.Uninitialize();
|
m_LuaScript.Uninitialize();
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ void CMeasureScript::UninitializeLuaScript()
|
|||||||
** Runs the function "Update()" in the script.
|
** Runs the function "Update()" in the script.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureScript::UpdateValue()
|
void MeasureScript::UpdateValue()
|
||||||
{
|
{
|
||||||
if (m_HasUpdateFunction)
|
if (m_HasUpdateFunction)
|
||||||
{
|
{
|
||||||
@@ -76,7 +76,7 @@ void CMeasureScript::UpdateValue()
|
|||||||
** Returns the value as a string.
|
** Returns the value as a string.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
const WCHAR* CMeasureScript::GetStringValue()
|
const WCHAR* MeasureScript::GetStringValue()
|
||||||
{
|
{
|
||||||
return (m_ValueType == LUA_TSTRING) ? CheckSubstitute(m_StringValue.c_str()) : NULL;
|
return (m_ValueType == LUA_TSTRING) ? CheckSubstitute(m_StringValue.c_str()) : NULL;
|
||||||
}
|
}
|
||||||
@@ -85,9 +85,9 @@ const WCHAR* CMeasureScript::GetStringValue()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureScript::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasureScript::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
|
|
||||||
std::wstring scriptFile = parser.ReadString(section, L"ScriptFile", L"");
|
std::wstring scriptFile = parser.ReadString(section, L"ScriptFile", L"");
|
||||||
if (!scriptFile.empty())
|
if (!scriptFile.empty())
|
||||||
@@ -116,13 +116,13 @@ void CMeasureScript::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
|
|
||||||
lua_rawgeti(L, LUA_GLOBALSINDEX, m_LuaScript.GetRef());
|
lua_rawgeti(L, LUA_GLOBALSINDEX, m_LuaScript.GetRef());
|
||||||
|
|
||||||
*(CMeterWindow**)lua_newuserdata(L, sizeof(CMeterWindow*)) = m_MeterWindow;
|
*(MeterWindow**)lua_newuserdata(L, sizeof(MeterWindow*)) = m_MeterWindow;
|
||||||
lua_getglobal(L, "CMeterWindow");
|
lua_getglobal(L, "MeterWindow");
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
lua_setfield(L, -2, "SKIN");
|
lua_setfield(L, -2, "SKIN");
|
||||||
|
|
||||||
*(CMeasure**)lua_newuserdata(L, sizeof(CMeasure*)) = this;
|
*(Measure**)lua_newuserdata(L, sizeof(Measure*)) = this;
|
||||||
lua_getglobal(L, "CMeasure");
|
lua_getglobal(L, "Measure");
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
lua_setfield(L, -2, "SELF");
|
lua_setfield(L, -2, "SELF");
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ void CMeasureScript::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Executes a custom bang.
|
** Executes a custom bang.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureScript::Command(const std::wstring& command)
|
void MeasureScript::Command(const std::wstring& command)
|
||||||
{
|
{
|
||||||
std::string str = StringUtil::Narrow(command);
|
std::string str = StringUtil::Narrow(command);
|
||||||
m_LuaScript.RunString(str.c_str());
|
m_LuaScript.RunString(str.c_str());
|
||||||
|
|||||||
@@ -21,13 +21,13 @@
|
|||||||
#include "lua/LuaScript.h"
|
#include "lua/LuaScript.h"
|
||||||
#include "MeterWindow.h"
|
#include "MeterWindow.h"
|
||||||
|
|
||||||
class CMeasureScript : public CMeasure
|
class MeasureScript : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureScript(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureScript(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureScript();
|
virtual ~MeasureScript();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasureScript>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasureScript>(); }
|
||||||
|
|
||||||
virtual const WCHAR* GetStringValue();
|
virtual const WCHAR* GetStringValue();
|
||||||
virtual void Command(const std::wstring& command);
|
virtual void Command(const std::wstring& command);
|
||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
void UninitializeLuaScript();
|
void UninitializeLuaScript();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ int GetYearDay(int year, int month, int day)
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureTime::CMeasureTime(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
MeasureTime::MeasureTime(MeterWindow* meterWindow, const WCHAR* name) : Measure(meterWindow, name),
|
||||||
m_DeltaTime(),
|
m_DeltaTime(),
|
||||||
m_Time(),
|
m_Time(),
|
||||||
m_TimeStamp(-1)
|
m_TimeStamp(-1)
|
||||||
@@ -53,7 +53,7 @@ CMeasureTime::CMeasureTime(CMeterWindow* meterWindow, const WCHAR* name) : CMeas
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureTime::~CMeasureTime()
|
MeasureTime::~MeasureTime()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ CMeasureTime::~CMeasureTime()
|
|||||||
** This function is a wrapper function for wcsftime.
|
** This function is a wrapper function for wcsftime.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureTime::TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format, const struct tm* time)
|
void MeasureTime::TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format, const struct tm* time)
|
||||||
{
|
{
|
||||||
if (bufLen > 0)
|
if (bufLen > 0)
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,7 @@ void CMeasureTime::TimeToString(WCHAR* buf, size_t bufLen, const WCHAR* format,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeasureTime::FillCurrentTime()
|
void MeasureTime::FillCurrentTime()
|
||||||
{
|
{
|
||||||
if (m_TimeStamp < 0.0)
|
if (m_TimeStamp < 0.0)
|
||||||
{
|
{
|
||||||
@@ -105,7 +105,7 @@ void CMeasureTime::FillCurrentTime()
|
|||||||
** Updates the current time
|
** Updates the current time
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureTime::UpdateValue()
|
void MeasureTime::UpdateValue()
|
||||||
{
|
{
|
||||||
FillCurrentTime();
|
FillCurrentTime();
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ void CMeasureTime::UpdateValue()
|
|||||||
** Returns the time as string.
|
** Returns the time as string.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
const WCHAR* CMeasureTime::GetStringValue()
|
const WCHAR* MeasureTime::GetStringValue()
|
||||||
{
|
{
|
||||||
static WCHAR tmpSz[MAX_LINE_LENGTH];
|
static WCHAR tmpSz[MAX_LINE_LENGTH];
|
||||||
struct tm today;
|
struct tm today;
|
||||||
@@ -216,9 +216,9 @@ const WCHAR* CMeasureTime::GetStringValue()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureTime::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasureTime::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
|
|
||||||
m_Format = parser.ReadString(section, L"Format", L"");
|
m_Format = parser.ReadString(section, L"Format", L"");
|
||||||
|
|
||||||
|
|||||||
@@ -21,18 +21,18 @@
|
|||||||
|
|
||||||
#include "Measure.h"
|
#include "Measure.h"
|
||||||
|
|
||||||
class CMeasureTime : public CMeasure
|
class MeasureTime : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureTime(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureTime(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureTime();
|
virtual ~MeasureTime();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasureTime>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasureTime>(); }
|
||||||
|
|
||||||
virtual const WCHAR* GetStringValue();
|
virtual const WCHAR* GetStringValue();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureUptime::CMeasureUptime(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
MeasureUptime::MeasureUptime(MeterWindow* meterWindow, const WCHAR* name) : Measure(meterWindow, name),
|
||||||
m_AddDaysToHours(false)
|
m_AddDaysToHours(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ CMeasureUptime::CMeasureUptime(CMeterWindow* meterWindow, const WCHAR* name) : C
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureUptime::~CMeasureUptime()
|
MeasureUptime::~MeasureUptime()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,9 +42,9 @@ CMeasureUptime::~CMeasureUptime()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureUptime::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasureUptime::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
|
|
||||||
m_Format = parser.ReadString(section, L"Format", L"%4!i!d %3!i!:%2!02i!");
|
m_Format = parser.ReadString(section, L"Format", L"%4!i!d %3!i!:%2!02i!");
|
||||||
|
|
||||||
@@ -62,9 +62,9 @@ void CMeasureUptime::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the current uptime
|
** Updates the current uptime
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureUptime::UpdateValue()
|
void MeasureUptime::UpdateValue()
|
||||||
{
|
{
|
||||||
ULONGLONG ticks = CSystem::GetTickCount64();
|
ULONGLONG ticks = System::GetTickCount64();
|
||||||
m_Value = (double)(__int64)(ticks / 1000);
|
m_Value = (double)(__int64)(ticks / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ void CMeasureUptime::UpdateValue()
|
|||||||
** Returns the uptime as string.
|
** Returns the uptime as string.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
const WCHAR* CMeasureUptime::GetStringValue()
|
const WCHAR* MeasureUptime::GetStringValue()
|
||||||
{
|
{
|
||||||
static WCHAR buffer[MAX_LINE_LENGTH];
|
static WCHAR buffer[MAX_LINE_LENGTH];
|
||||||
|
|
||||||
|
|||||||
@@ -21,18 +21,18 @@
|
|||||||
|
|
||||||
#include "Measure.h"
|
#include "Measure.h"
|
||||||
|
|
||||||
class CMeasureUptime : public CMeasure
|
class MeasureUptime : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureUptime(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureUptime(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureUptime();
|
virtual ~MeasureUptime();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasureUptime>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasureUptime>(); }
|
||||||
|
|
||||||
virtual const WCHAR* GetStringValue();
|
virtual const WCHAR* GetStringValue();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureVirtualMemory::CMeasureVirtualMemory(CMeterWindow* meterWindow, const WCHAR* name) : CMeasure(meterWindow, name),
|
MeasureVirtualMemory::MeasureVirtualMemory(MeterWindow* meterWindow, const WCHAR* name) : Measure(meterWindow, name),
|
||||||
m_Total(false)
|
m_Total(false)
|
||||||
{
|
{
|
||||||
MEMORYSTATUSEX stat;
|
MEMORYSTATUSEX stat;
|
||||||
@@ -37,7 +37,7 @@ CMeasureVirtualMemory::CMeasureVirtualMemory(CMeterWindow* meterWindow, const WC
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeasureVirtualMemory::~CMeasureVirtualMemory()
|
MeasureVirtualMemory::~MeasureVirtualMemory()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ CMeasureVirtualMemory::~CMeasureVirtualMemory()
|
|||||||
** Updates the current virtual memory value.
|
** Updates the current virtual memory value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureVirtualMemory::UpdateValue()
|
void MeasureVirtualMemory::UpdateValue()
|
||||||
{
|
{
|
||||||
MEMORYSTATUSEX stat;
|
MEMORYSTATUSEX stat;
|
||||||
stat.dwLength = sizeof(MEMORYSTATUSEX);
|
stat.dwLength = sizeof(MEMORYSTATUSEX);
|
||||||
@@ -66,10 +66,10 @@ void CMeasureVirtualMemory::UpdateValue()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeasureVirtualMemory::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeasureVirtualMemory::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
double oldMaxValue = m_MaxValue;
|
double oldMaxValue = m_MaxValue;
|
||||||
CMeasure::ReadOptions(parser, section);
|
Measure::ReadOptions(parser, section);
|
||||||
m_MaxValue = oldMaxValue;
|
m_MaxValue = oldMaxValue;
|
||||||
|
|
||||||
m_Total = (1 == parser.ReadInt(section, L"Total", 0));
|
m_Total = (1 == parser.ReadInt(section, L"Total", 0));
|
||||||
|
|||||||
@@ -21,16 +21,16 @@
|
|||||||
|
|
||||||
#include "Measure.h"
|
#include "Measure.h"
|
||||||
|
|
||||||
class CMeasureVirtualMemory : public CMeasure
|
class MeasureVirtualMemory : public Measure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeasureVirtualMemory(CMeterWindow* meterWindow, const WCHAR* name);
|
MeasureVirtualMemory(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeasureVirtualMemory();
|
virtual ~MeasureVirtualMemory();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeasureVirtualMemory>(); }
|
virtual UINT GetTypeID() { return TypeID<MeasureVirtualMemory>(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void UpdateValue();
|
virtual void UpdateValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -34,13 +34,13 @@
|
|||||||
|
|
||||||
using namespace Gdiplus;
|
using namespace Gdiplus;
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeter::CMeter(CMeterWindow* meterWindow, const WCHAR* name) : CSection(meterWindow, name),
|
Meter::Meter(MeterWindow* meterWindow, const WCHAR* name) : Section(meterWindow, name),
|
||||||
m_X(),
|
m_X(),
|
||||||
m_Y(),
|
m_Y(),
|
||||||
m_W(0),
|
m_W(0),
|
||||||
@@ -70,7 +70,7 @@ CMeter::CMeter(CMeterWindow* meterWindow, const WCHAR* name) : CSection(meterWin
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeter::~CMeter()
|
Meter::~Meter()
|
||||||
{
|
{
|
||||||
delete m_Transformation;
|
delete m_Transformation;
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ CMeter::~CMeter()
|
|||||||
** classes, which load bitmaps and such things during initialization.
|
** classes, which load bitmaps and such things during initialization.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeter::Initialize()
|
void Meter::Initialize()
|
||||||
{
|
{
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ void CMeter::Initialize()
|
|||||||
** Returns the X-position of the meter.
|
** Returns the X-position of the meter.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
int CMeter::GetX(bool abs)
|
int Meter::GetX(bool abs)
|
||||||
{
|
{
|
||||||
if (m_RelativeX != POSITION_ABSOLUTE && m_RelativeMeter)
|
if (m_RelativeX != POSITION_ABSOLUTE && m_RelativeMeter)
|
||||||
{
|
{
|
||||||
@@ -114,7 +114,7 @@ int CMeter::GetX(bool abs)
|
|||||||
** Returns the Y-position of the meter.
|
** Returns the Y-position of the meter.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
int CMeter::GetY(bool abs)
|
int Meter::GetY(bool abs)
|
||||||
{
|
{
|
||||||
if (m_RelativeY != POSITION_ABSOLUTE && m_RelativeMeter)
|
if (m_RelativeY != POSITION_ABSOLUTE && m_RelativeMeter)
|
||||||
{
|
{
|
||||||
@@ -130,7 +130,7 @@ int CMeter::GetY(bool abs)
|
|||||||
return m_Y;
|
return m_Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeter::SetX(int x)
|
void Meter::SetX(int x)
|
||||||
{
|
{
|
||||||
m_X = x;
|
m_X = x;
|
||||||
m_RelativeX = POSITION_ABSOLUTE;
|
m_RelativeX = POSITION_ABSOLUTE;
|
||||||
@@ -141,7 +141,7 @@ void CMeter::SetX(int x)
|
|||||||
m_MeterWindow->GetParser().SetValue(m_Name, L"X", buffer);
|
m_MeterWindow->GetParser().SetValue(m_Name, L"X", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeter::SetY(int y)
|
void Meter::SetY(int y)
|
||||||
{
|
{
|
||||||
m_Y = y;
|
m_Y = y;
|
||||||
m_RelativeY = POSITION_ABSOLUTE;
|
m_RelativeY = POSITION_ABSOLUTE;
|
||||||
@@ -156,7 +156,7 @@ void CMeter::SetY(int y)
|
|||||||
** Returns a RECT containing the dimensions of the meter within the MeterWindow
|
** Returns a RECT containing the dimensions of the meter within the MeterWindow
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
RECT CMeter::GetMeterRect()
|
RECT Meter::GetMeterRect()
|
||||||
{
|
{
|
||||||
RECT meterRect;
|
RECT meterRect;
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ RECT CMeter::GetMeterRect()
|
|||||||
** This function doesn't check Hidden state, so check it before calling this function if needed.
|
** This function doesn't check Hidden state, so check it before calling this function if needed.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeter::HitTest(int x, int y)
|
bool Meter::HitTest(int x, int y)
|
||||||
{
|
{
|
||||||
int p;
|
int p;
|
||||||
return (x >= (p = GetX()) && x < p + m_W && y >= (p = GetY()) && y < p + m_H);
|
return (x >= (p = GetX()) && x < p + m_W && y >= (p = GetY()) && y < p + m_H);
|
||||||
@@ -183,7 +183,7 @@ bool CMeter::HitTest(int x, int y)
|
|||||||
** Shows the meter and tooltip.
|
** Shows the meter and tooltip.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeter::Show()
|
void Meter::Show()
|
||||||
{
|
{
|
||||||
m_Hidden = false;
|
m_Hidden = false;
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ void CMeter::Show()
|
|||||||
** Hides the meter and tooltip.
|
** Hides the meter and tooltip.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeter::Hide()
|
void Meter::Hide()
|
||||||
{
|
{
|
||||||
m_Hidden = true;
|
m_Hidden = true;
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ void CMeter::Hide()
|
|||||||
** call this base implementation if they overwrite this method.
|
** call this base implementation if they overwrite this method.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void Meter::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
// The MeterStyle defines a template where the values are read if the meter doesn't have it itself
|
// The MeterStyle defines a template where the values are read if the meter doesn't have it itself
|
||||||
const std::wstring& style = parser.ReadString(section, L"MeterStyle", L"");
|
const std::wstring& style = parser.ReadString(section, L"MeterStyle", L"");
|
||||||
@@ -230,7 +230,7 @@ void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
parser.SetStyleTemplate(style);
|
parser.SetStyleTemplate(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSection::ReadOptions(parser, section);
|
Section::ReadOptions(parser, section);
|
||||||
|
|
||||||
BindMeasures(parser, section);
|
BindMeasures(parser, section);
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** several meters but one meter and only be bound to one measure.
|
** several meters but one meter and only be bound to one measure.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeter::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
void Meter::BindMeasures(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
BindPrimaryMeasure(parser, section, false);
|
BindPrimaryMeasure(parser, section, false);
|
||||||
}
|
}
|
||||||
@@ -370,43 +370,43 @@ void CMeter::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
|||||||
** If new meters are implemented this method needs to be updated.
|
** If new meters are implemented this method needs to be updated.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeter* CMeter::Create(const WCHAR* meter, CMeterWindow* meterWindow, const WCHAR* name)
|
Meter* Meter::Create(const WCHAR* meter, MeterWindow* meterWindow, const WCHAR* name)
|
||||||
{
|
{
|
||||||
if (_wcsicmp(L"STRING", meter) == 0)
|
if (_wcsicmp(L"STRING", meter) == 0)
|
||||||
{
|
{
|
||||||
return new CMeterString(meterWindow, name);
|
return new MeterString(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"IMAGE", meter) == 0)
|
else if (_wcsicmp(L"IMAGE", meter) == 0)
|
||||||
{
|
{
|
||||||
return new CMeterImage(meterWindow, name);
|
return new MeterImage(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"HISTOGRAM", meter) == 0)
|
else if (_wcsicmp(L"HISTOGRAM", meter) == 0)
|
||||||
{
|
{
|
||||||
return new CMeterHistogram(meterWindow, name);
|
return new MeterHistogram(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"BAR", meter) == 0)
|
else if (_wcsicmp(L"BAR", meter) == 0)
|
||||||
{
|
{
|
||||||
return new CMeterBar(meterWindow, name);
|
return new MeterBar(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"BITMAP", meter) == 0)
|
else if (_wcsicmp(L"BITMAP", meter) == 0)
|
||||||
{
|
{
|
||||||
return new CMeterBitmap(meterWindow, name);
|
return new MeterBitmap(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"LINE", meter) == 0)
|
else if (_wcsicmp(L"LINE", meter) == 0)
|
||||||
{
|
{
|
||||||
return new CMeterLine(meterWindow, name);
|
return new MeterLine(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"ROUNDLINE", meter) == 0)
|
else if (_wcsicmp(L"ROUNDLINE", meter) == 0)
|
||||||
{
|
{
|
||||||
return new CMeterRoundLine(meterWindow, name);
|
return new MeterRoundLine(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"ROTATOR", meter) == 0)
|
else if (_wcsicmp(L"ROTATOR", meter) == 0)
|
||||||
{
|
{
|
||||||
return new CMeterRotator(meterWindow, name);
|
return new MeterRotator(meterWindow, name);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"BUTTON", meter) == 0)
|
else if (_wcsicmp(L"BUTTON", meter) == 0)
|
||||||
{
|
{
|
||||||
return new CMeterButton(meterWindow, name);
|
return new MeterButton(meterWindow, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogErrorF(L"Meter=%s is not valid in [%s]", meter, name);
|
LogErrorF(L"Meter=%s is not valid in [%s]", meter, name);
|
||||||
@@ -418,7 +418,7 @@ CMeter* CMeter::Create(const WCHAR* meter, CMeterWindow* meterWindow, const WCHA
|
|||||||
** Updates the value(s) from the measures. Derived classes should
|
** Updates the value(s) from the measures. Derived classes should
|
||||||
** only update if this returns true;
|
** only update if this returns true;
|
||||||
*/
|
*/
|
||||||
bool CMeter::Update()
|
bool Meter::Update()
|
||||||
{
|
{
|
||||||
// Only update the meter's value when the divider is equal to the counter
|
// Only update the meter's value when the divider is equal to the counter
|
||||||
return UpdateCounter();
|
return UpdateCounter();
|
||||||
@@ -429,13 +429,13 @@ bool CMeter::Update()
|
|||||||
** BindMeasures() implementations.
|
** BindMeasures() implementations.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeter::BindPrimaryMeasure(CConfigParser& parser, const WCHAR* section, bool optional)
|
bool Meter::BindPrimaryMeasure(ConfigParser& parser, const WCHAR* section, bool optional)
|
||||||
{
|
{
|
||||||
m_Measures.clear();
|
m_Measures.clear();
|
||||||
|
|
||||||
const std::wstring& measureName = parser.ReadString(section, L"MeasureName", L"");
|
const std::wstring& measureName = parser.ReadString(section, L"MeasureName", L"");
|
||||||
|
|
||||||
CMeasure* measure = parser.GetMeasure(measureName);
|
Measure* measure = parser.GetMeasure(measureName);
|
||||||
if (measure)
|
if (measure)
|
||||||
{
|
{
|
||||||
m_Measures.push_back(measure);
|
m_Measures.push_back(measure);
|
||||||
@@ -453,7 +453,7 @@ bool CMeter::BindPrimaryMeasure(CConfigParser& parser, const WCHAR* section, boo
|
|||||||
** Reads and binds secondary measures (MeasureName2 - MeasureNameN).
|
** Reads and binds secondary measures (MeasureName2 - MeasureNameN).
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeter::BindSecondaryMeasures(CConfigParser& parser, const WCHAR* section)
|
void Meter::BindSecondaryMeasures(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
if (!m_Measures.empty())
|
if (!m_Measures.empty())
|
||||||
{
|
{
|
||||||
@@ -464,7 +464,7 @@ void CMeter::BindSecondaryMeasures(CConfigParser& parser, const WCHAR* section)
|
|||||||
{
|
{
|
||||||
_snwprintf_s(tmpName, _TRUNCATE, L"MeasureName%i", i);
|
_snwprintf_s(tmpName, _TRUNCATE, L"MeasureName%i", i);
|
||||||
const std::wstring& measureName = parser.ReadString(section, tmpName, L"");
|
const std::wstring& measureName = parser.ReadString(section, tmpName, L"");
|
||||||
CMeasure* measure = parser.GetMeasure(measureName);
|
Measure* measure = parser.GetMeasure(measureName);
|
||||||
if (measure)
|
if (measure)
|
||||||
{
|
{
|
||||||
m_Measures.push_back(measure);
|
m_Measures.push_back(measure);
|
||||||
@@ -488,7 +488,7 @@ void CMeter::BindSecondaryMeasures(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Replaces %1, %2, ... with the corresponding measure value.
|
** Replaces %1, %2, ... with the corresponding measure value.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeter::ReplaceMeasures(std::wstring& str, AUTOSCALE autoScale, double scale, int decimals, bool percentual)
|
bool Meter::ReplaceMeasures(std::wstring& str, AUTOSCALE autoScale, double scale, int decimals, bool percentual)
|
||||||
{
|
{
|
||||||
bool replaced = false;
|
bool replaced = false;
|
||||||
|
|
||||||
@@ -525,10 +525,10 @@ bool CMeter::ReplaceMeasures(std::wstring& str, AUTOSCALE autoScale, double scal
|
|||||||
/*
|
/*
|
||||||
** Does the initial construction of the ToolTip for the meter
|
** Does the initial construction of the ToolTip for the meter
|
||||||
*/
|
*/
|
||||||
void CMeter::CreateToolTip(CMeterWindow* meterWindow)
|
void Meter::CreateToolTip(MeterWindow* meterWindow)
|
||||||
{
|
{
|
||||||
HWND hMeterWindow = m_MeterWindow->GetWindow();
|
HWND hMeterWindow = m_MeterWindow->GetWindow();
|
||||||
HINSTANCE hInstance = Rainmeter->GetInstance();
|
HINSTANCE hInstance = g_Rainmeter->GetInstance();
|
||||||
DWORD style = WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP;
|
DWORD style = WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP;
|
||||||
|
|
||||||
if (m_ToolTipType)
|
if (m_ToolTipType)
|
||||||
@@ -565,7 +565,7 @@ void CMeter::CreateToolTip(CMeterWindow* meterWindow)
|
|||||||
/*
|
/*
|
||||||
** Updates the ToolTip to match new values
|
** Updates the ToolTip to match new values
|
||||||
*/
|
*/
|
||||||
void CMeter::UpdateToolTip()
|
void Meter::UpdateToolTip()
|
||||||
{
|
{
|
||||||
HWND hwndTT = m_ToolTipHandle;
|
HWND hwndTT = m_ToolTipHandle;
|
||||||
|
|
||||||
@@ -640,7 +640,7 @@ void CMeter::UpdateToolTip()
|
|||||||
/*
|
/*
|
||||||
** Draws the solid background & bevel if such are defined
|
** Draws the solid background & bevel if such are defined
|
||||||
*/
|
*/
|
||||||
bool CMeter::Draw(Gfx::Canvas& canvas)
|
bool Meter::Draw(Gfx::Canvas& canvas)
|
||||||
{
|
{
|
||||||
if (IsHidden()) return false;
|
if (IsHidden()) return false;
|
||||||
|
|
||||||
@@ -712,7 +712,7 @@ bool CMeter::Draw(Gfx::Canvas& canvas)
|
|||||||
/*
|
/*
|
||||||
** Draws a bevel inside the given area
|
** Draws a bevel inside the given area
|
||||||
*/
|
*/
|
||||||
void CMeter::DrawBevel(Graphics& graphics, const Rect& rect, const Pen& light, const Pen& dark)
|
void Meter::DrawBevel(Graphics& graphics, const Rect& rect, const Pen& light, const Pen& dark)
|
||||||
{
|
{
|
||||||
int l = rect.GetLeft();
|
int l = rect.GetLeft();
|
||||||
int r = rect.GetRight() - 1;
|
int r = rect.GetRight() - 1;
|
||||||
|
|||||||
@@ -29,14 +29,14 @@
|
|||||||
#include "Section.h"
|
#include "Section.h"
|
||||||
#include "Measure.h"
|
#include "Measure.h"
|
||||||
|
|
||||||
class CMeasure;
|
class Measure;
|
||||||
|
|
||||||
class __declspec(novtable) CMeter : public CSection
|
class __declspec(novtable) Meter : public Section
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~CMeter();
|
virtual ~Meter();
|
||||||
|
|
||||||
void ReadOptions(CConfigParser& parser) { ReadOptions(parser, GetName()); parser.ClearStyleTemplate(); }
|
void ReadOptions(ConfigParser& parser) { ReadOptions(parser, GetName()); parser.ClearStyleTemplate(); }
|
||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual bool Update();
|
virtual bool Update();
|
||||||
@@ -54,15 +54,15 @@ public:
|
|||||||
void SetX(int x);
|
void SetX(int x);
|
||||||
void SetY(int y);
|
void SetY(int y);
|
||||||
|
|
||||||
void SetRelativeMeter(CMeter* meter) { m_RelativeMeter = meter; }
|
void SetRelativeMeter(Meter* meter) { m_RelativeMeter = meter; }
|
||||||
|
|
||||||
const CMouse& GetMouse() { return m_Mouse; }
|
const Mouse& GetMouse() { return m_Mouse; }
|
||||||
bool HasMouseAction() { return m_HasMouseAction; }
|
bool HasMouseAction() { return m_HasMouseAction; }
|
||||||
|
|
||||||
const std::wstring& GetToolTipText() { return m_ToolTipText; }
|
const std::wstring& GetToolTipText() { return m_ToolTipText; }
|
||||||
bool HasToolTip() { return m_ToolTipHandle != NULL; }
|
bool HasToolTip() { return m_ToolTipHandle != NULL; }
|
||||||
|
|
||||||
void CreateToolTip(CMeterWindow* meterWindow);
|
void CreateToolTip(MeterWindow* meterWindow);
|
||||||
void UpdateToolTip();
|
void UpdateToolTip();
|
||||||
|
|
||||||
void Hide();
|
void Hide();
|
||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
void SetMouseOver(bool over) { m_MouseOver = over; }
|
void SetMouseOver(bool over) { m_MouseOver = over; }
|
||||||
bool IsMouseOver() { return m_MouseOver; }
|
bool IsMouseOver() { return m_MouseOver; }
|
||||||
|
|
||||||
static CMeter* Create(const WCHAR* meter, CMeterWindow* meterWindow, const WCHAR* name);
|
static Meter* Create(const WCHAR* meter, MeterWindow* meterWindow, const WCHAR* name);
|
||||||
|
|
||||||
static void DrawBevel(Gdiplus::Graphics& graphics, const Gdiplus::Rect& rect, const Gdiplus::Pen& light, const Gdiplus::Pen& dark);
|
static void DrawBevel(Gdiplus::Graphics& graphics, const Gdiplus::Rect& rect, const Gdiplus::Pen& light, const Gdiplus::Pen& dark);
|
||||||
|
|
||||||
@@ -102,19 +102,19 @@ protected:
|
|||||||
POSITION_RELATIVE_BR
|
POSITION_RELATIVE_BR
|
||||||
};
|
};
|
||||||
|
|
||||||
CMeter(CMeterWindow* meterWindow, const WCHAR* name);
|
Meter(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
|
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void BindMeasures(CConfigParser& parser, const WCHAR* section);
|
virtual void BindMeasures(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
virtual bool IsFixedSize(bool overwrite = false) { return true; }
|
virtual bool IsFixedSize(bool overwrite = false) { return true; }
|
||||||
|
|
||||||
bool BindPrimaryMeasure(CConfigParser& parser, const WCHAR* section, bool optional);
|
bool BindPrimaryMeasure(ConfigParser& parser, const WCHAR* section, bool optional);
|
||||||
void BindSecondaryMeasures(CConfigParser& parser, const WCHAR* section);
|
void BindSecondaryMeasures(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
bool ReplaceMeasures(std::wstring& str, AUTOSCALE autoScale = AUTOSCALE_ON, double scale = 1.0, int decimals = 0, bool percentual = false);
|
bool ReplaceMeasures(std::wstring& str, AUTOSCALE autoScale = AUTOSCALE_ON, double scale = 1.0, int decimals = 0, bool percentual = false);
|
||||||
|
|
||||||
std::vector<CMeasure*> m_Measures;
|
std::vector<Measure*> m_Measures;
|
||||||
int m_X;
|
int m_X;
|
||||||
int m_Y;
|
int m_Y;
|
||||||
int m_W;
|
int m_W;
|
||||||
@@ -122,7 +122,7 @@ protected:
|
|||||||
bool m_Hidden;
|
bool m_Hidden;
|
||||||
bool m_WDefined;
|
bool m_WDefined;
|
||||||
bool m_HDefined;
|
bool m_HDefined;
|
||||||
CMeter* m_RelativeMeter;
|
Meter* m_RelativeMeter;
|
||||||
|
|
||||||
Gdiplus::Matrix* m_Transformation;
|
Gdiplus::Matrix* m_Transformation;
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ protected:
|
|||||||
|
|
||||||
HWND m_ToolTipHandle;
|
HWND m_ToolTipHandle;
|
||||||
|
|
||||||
CMouse m_Mouse;
|
Mouse m_Mouse;
|
||||||
bool m_HasMouseAction;
|
bool m_HasMouseAction;
|
||||||
bool m_MouseOver;
|
bool m_MouseOver;
|
||||||
|
|
||||||
|
|||||||
@@ -26,13 +26,13 @@
|
|||||||
|
|
||||||
using namespace Gdiplus;
|
using namespace Gdiplus;
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterBar::CMeterBar(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name),
|
MeterBar::MeterBar(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
|
||||||
m_Image(L"BarImage"),
|
m_Image(L"BarImage"),
|
||||||
m_NeedsReload(false),
|
m_NeedsReload(false),
|
||||||
m_Color(Color::Green),
|
m_Color(Color::Green),
|
||||||
@@ -47,7 +47,7 @@ CMeterBar::CMeterBar(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(mete
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterBar::~CMeterBar()
|
MeterBar::~MeterBar()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,9 +56,9 @@ CMeterBar::~CMeterBar()
|
|||||||
** of the meter from it.
|
** of the meter from it.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterBar::Initialize()
|
void MeterBar::Initialize()
|
||||||
{
|
{
|
||||||
CMeter::Initialize();
|
Meter::Initialize();
|
||||||
|
|
||||||
// Load the bitmaps if defined
|
// Load the bitmaps if defined
|
||||||
if (!m_ImageName.empty())
|
if (!m_ImageName.empty())
|
||||||
@@ -83,14 +83,14 @@ void CMeterBar::Initialize()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterBar::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeterBar::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
// Store the current values so we know if the image needs to be updated
|
// Store the current values so we know if the image needs to be updated
|
||||||
std::wstring oldImageName = m_ImageName;
|
std::wstring oldImageName = m_ImageName;
|
||||||
int oldW = m_W;
|
int oldW = m_W;
|
||||||
int oldH = m_H;
|
int oldH = m_H;
|
||||||
|
|
||||||
CMeter::ReadOptions(parser, section);
|
Meter::ReadOptions(parser, section);
|
||||||
|
|
||||||
m_Color = parser.ReadColor(section, L"BarColor", Color::Green);
|
m_Color = parser.ReadColor(section, L"BarColor", Color::Green);
|
||||||
|
|
||||||
@@ -147,9 +147,9 @@ void CMeterBar::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the value(s) from the measures.
|
** Updates the value(s) from the measures.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterBar::Update()
|
bool MeterBar::Update()
|
||||||
{
|
{
|
||||||
if (CMeter::Update() && !m_Measures.empty())
|
if (Meter::Update() && !m_Measures.empty())
|
||||||
{
|
{
|
||||||
m_Value = m_Measures[0]->GetRelativeValue();
|
m_Value = m_Measures[0]->GetRelativeValue();
|
||||||
return true;
|
return true;
|
||||||
@@ -161,9 +161,9 @@ bool CMeterBar::Update()
|
|||||||
** Draws the meter on the double buffer
|
** Draws the meter on the double buffer
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterBar::Draw(Gfx::Canvas& canvas)
|
bool MeterBar::Draw(Gfx::Canvas& canvas)
|
||||||
{
|
{
|
||||||
if (!CMeter::Draw(canvas)) return false;
|
if (!Meter::Draw(canvas)) return false;
|
||||||
|
|
||||||
int x = GetX();
|
int x = GetX();
|
||||||
int y = GetY();
|
int y = GetY();
|
||||||
|
|||||||
@@ -22,20 +22,20 @@
|
|||||||
#include "Meter.h"
|
#include "Meter.h"
|
||||||
#include "TintedImage.h"
|
#include "TintedImage.h"
|
||||||
|
|
||||||
class CMeterBar : public CMeter
|
class MeterBar : public Meter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeterBar(CMeterWindow* meterWindow, const WCHAR* name);
|
MeterBar(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeterBar();
|
virtual ~MeterBar();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeterBar>(); }
|
virtual UINT GetTypeID() { return TypeID<MeterBar>(); }
|
||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual bool Update();
|
virtual bool Update();
|
||||||
virtual bool Draw(Gfx::Canvas& canvas);
|
virtual bool Draw(Gfx::Canvas& canvas);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
virtual bool IsFixedSize(bool overwrite = false) { return m_ImageName.empty(); }
|
virtual bool IsFixedSize(bool overwrite = false) { return m_ImageName.empty(); }
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ private:
|
|||||||
VERTICAL
|
VERTICAL
|
||||||
};
|
};
|
||||||
|
|
||||||
CTintedImage m_Image;
|
TintedImage m_Image;
|
||||||
std::wstring m_ImageName;
|
std::wstring m_ImageName;
|
||||||
bool m_NeedsReload;
|
bool m_NeedsReload;
|
||||||
|
|
||||||
|
|||||||
@@ -26,13 +26,13 @@
|
|||||||
|
|
||||||
using namespace Gdiplus;
|
using namespace Gdiplus;
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterBitmap::CMeterBitmap(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name),
|
MeterBitmap::MeterBitmap(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
|
||||||
m_Image(L"BitmapImage", NULL, true),
|
m_Image(L"BitmapImage", NULL, true),
|
||||||
m_NeedsReload(false),
|
m_NeedsReload(false),
|
||||||
m_ZeroFrame(false),
|
m_ZeroFrame(false),
|
||||||
@@ -52,7 +52,7 @@ CMeterBitmap::CMeterBitmap(CMeterWindow* meterWindow, const WCHAR* name) : CMete
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterBitmap::~CMeterBitmap()
|
MeterBitmap::~MeterBitmap()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,9 +60,9 @@ CMeterBitmap::~CMeterBitmap()
|
|||||||
** Load the image and get the dimensions of the meter from it.
|
** Load the image and get the dimensions of the meter from it.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterBitmap::Initialize()
|
void MeterBitmap::Initialize()
|
||||||
{
|
{
|
||||||
CMeter::Initialize();
|
Meter::Initialize();
|
||||||
|
|
||||||
// Load the bitmaps if defined
|
// Load the bitmaps if defined
|
||||||
if (!m_ImageName.empty())
|
if (!m_ImageName.empty())
|
||||||
@@ -96,7 +96,7 @@ void CMeterBitmap::Initialize()
|
|||||||
** Checks if the given point is inside the meter.
|
** Checks if the given point is inside the meter.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterBitmap::HitTest(int x, int y)
|
bool MeterBitmap::HitTest(int x, int y)
|
||||||
{
|
{
|
||||||
if (m_Extend)
|
if (m_Extend)
|
||||||
{
|
{
|
||||||
@@ -147,7 +147,7 @@ bool CMeterBitmap::HitTest(int x, int y)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return CMeter::HitTest(x, y);
|
return Meter::HitTest(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,14 +155,14 @@ bool CMeterBitmap::HitTest(int x, int y)
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterBitmap::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeterBitmap::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
// Store the current values so we know if the image needs to be updated
|
// Store the current values so we know if the image needs to be updated
|
||||||
std::wstring oldImageName = m_ImageName;
|
std::wstring oldImageName = m_ImageName;
|
||||||
int oldW = m_W;
|
int oldW = m_W;
|
||||||
int oldH = m_H;
|
int oldH = m_H;
|
||||||
|
|
||||||
CMeter::ReadOptions(parser, section);
|
Meter::ReadOptions(parser, section);
|
||||||
|
|
||||||
m_ImageName = parser.ReadString(section, L"BitmapImage", L"");
|
m_ImageName = parser.ReadString(section, L"BitmapImage", L"");
|
||||||
if (!m_ImageName.empty())
|
if (!m_ImageName.empty())
|
||||||
@@ -226,11 +226,11 @@ void CMeterBitmap::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the value(s) from the measures.
|
** Updates the value(s) from the measures.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterBitmap::Update()
|
bool MeterBitmap::Update()
|
||||||
{
|
{
|
||||||
if (CMeter::Update() && !m_Measures.empty())
|
if (Meter::Update() && !m_Measures.empty())
|
||||||
{
|
{
|
||||||
CMeasure* measure = m_Measures[0];
|
Measure* measure = m_Measures[0];
|
||||||
double value = (m_Extend) ? measure->GetValue() : measure->GetRelativeValue();
|
double value = (m_Extend) ? measure->GetValue() : measure->GetRelativeValue();
|
||||||
|
|
||||||
if (m_TransitionFrameCount > 0)
|
if (m_TransitionFrameCount > 0)
|
||||||
@@ -239,7 +239,7 @@ bool CMeterBitmap::Update()
|
|||||||
if ((int)(value * realFrames) != (int)(m_Value * realFrames))
|
if ((int)(value * realFrames) != (int)(m_Value * realFrames))
|
||||||
{
|
{
|
||||||
m_TransitionStartValue = m_Value;
|
m_TransitionStartValue = m_Value;
|
||||||
m_TransitionStartTicks = CSystem::GetTickCount64();
|
m_TransitionStartTicks = System::GetTickCount64();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -258,7 +258,7 @@ bool CMeterBitmap::Update()
|
|||||||
** Returns true if the meter has active transition animation.
|
** Returns true if the meter has active transition animation.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterBitmap::HasActiveTransition()
|
bool MeterBitmap::HasActiveTransition()
|
||||||
{
|
{
|
||||||
if (m_TransitionStartTicks > 0)
|
if (m_TransitionStartTicks > 0)
|
||||||
{
|
{
|
||||||
@@ -271,9 +271,9 @@ bool CMeterBitmap::HasActiveTransition()
|
|||||||
** Draws the meter on the double buffer
|
** Draws the meter on the double buffer
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterBitmap::Draw(Gfx::Canvas& canvas)
|
bool MeterBitmap::Draw(Gfx::Canvas& canvas)
|
||||||
{
|
{
|
||||||
if (!CMeter::Draw(canvas)) return false;
|
if (!Meter::Draw(canvas)) return false;
|
||||||
|
|
||||||
int newY, newX;
|
int newY, newX;
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ bool CMeterBitmap::Draw(Gfx::Canvas& canvas)
|
|||||||
// If transition is ongoing the pick the correct frame
|
// If transition is ongoing the pick the correct frame
|
||||||
if (m_TransitionStartTicks > 0)
|
if (m_TransitionStartTicks > 0)
|
||||||
{
|
{
|
||||||
int diffTicks = (int)(CSystem::GetTickCount64() - m_TransitionStartTicks);
|
int diffTicks = (int)(System::GetTickCount64() - m_TransitionStartTicks);
|
||||||
|
|
||||||
int range = ((value % realFrames) - (transitionValue % realFrames)) * (m_TransitionFrameCount + 1);
|
int range = ((value % realFrames) - (transitionValue % realFrames)) * (m_TransitionFrameCount + 1);
|
||||||
if (range < 0)
|
if (range < 0)
|
||||||
@@ -413,7 +413,7 @@ bool CMeterBitmap::Draw(Gfx::Canvas& canvas)
|
|||||||
// If transition is ongoing the pick the correct frame
|
// If transition is ongoing the pick the correct frame
|
||||||
if (m_TransitionStartTicks > 0)
|
if (m_TransitionStartTicks > 0)
|
||||||
{
|
{
|
||||||
int diffTicks = (int)(CSystem::GetTickCount64() - m_TransitionStartTicks);
|
int diffTicks = (int)(System::GetTickCount64() - m_TransitionStartTicks);
|
||||||
|
|
||||||
if (diffTicks > ((m_TransitionFrameCount + 1) * m_MeterWindow->GetTransitionUpdate()))
|
if (diffTicks > ((m_TransitionFrameCount + 1) * m_MeterWindow->GetTransitionUpdate()))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,13 +22,13 @@
|
|||||||
#include "Meter.h"
|
#include "Meter.h"
|
||||||
#include "TintedImage.h"
|
#include "TintedImage.h"
|
||||||
|
|
||||||
class CMeterBitmap : public CMeter
|
class MeterBitmap : public Meter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeterBitmap(CMeterWindow* meterWindow, const WCHAR* name);
|
MeterBitmap(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeterBitmap();
|
virtual ~MeterBitmap();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeterBitmap>(); }
|
virtual UINT GetTypeID() { return TypeID<MeterBitmap>(); }
|
||||||
|
|
||||||
virtual bool HitTest(int x, int y);
|
virtual bool HitTest(int x, int y);
|
||||||
|
|
||||||
@@ -38,10 +38,10 @@ public:
|
|||||||
virtual bool HasActiveTransition();
|
virtual bool HasActiveTransition();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CTintedImage m_Image;
|
TintedImage m_Image;
|
||||||
std::wstring m_ImageName;
|
std::wstring m_ImageName;
|
||||||
bool m_NeedsReload;
|
bool m_NeedsReload;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "Error.h"
|
#include "Error.h"
|
||||||
#include "../Common/Gfx/Canvas.h"
|
#include "../Common/Gfx/Canvas.h"
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
using namespace Gdiplus;
|
using namespace Gdiplus;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ enum BUTTON_STATE
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterButton::CMeterButton(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name),
|
MeterButton::MeterButton(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
|
||||||
m_Image(L"ButtonImage", NULL, true),
|
m_Image(L"ButtonImage", NULL, true),
|
||||||
m_NeedsReload(false),
|
m_NeedsReload(false),
|
||||||
m_Bitmaps(),
|
m_Bitmaps(),
|
||||||
@@ -52,7 +52,7 @@ CMeterButton::CMeterButton(CMeterWindow* meterWindow, const WCHAR* name) : CMete
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterButton::~CMeterButton()
|
MeterButton::~MeterButton()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < BUTTON_FRAMES; ++i)
|
for (int i = 0; i < BUTTON_FRAMES; ++i)
|
||||||
{
|
{
|
||||||
@@ -64,9 +64,9 @@ CMeterButton::~CMeterButton()
|
|||||||
** Load the image and get the dimensions of the meter from it.
|
** Load the image and get the dimensions of the meter from it.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterButton::Initialize()
|
void MeterButton::Initialize()
|
||||||
{
|
{
|
||||||
CMeter::Initialize();
|
Meter::Initialize();
|
||||||
|
|
||||||
for (int i = 0; i < BUTTON_FRAMES; ++i)
|
for (int i = 0; i < BUTTON_FRAMES; ++i)
|
||||||
{
|
{
|
||||||
@@ -127,14 +127,14 @@ void CMeterButton::Initialize()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterButton::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeterButton::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
// Store the current values so we know if the image needs to be updated
|
// Store the current values so we know if the image needs to be updated
|
||||||
std::wstring oldImageName = m_ImageName;
|
std::wstring oldImageName = m_ImageName;
|
||||||
int oldW = m_W;
|
int oldW = m_W;
|
||||||
int oldH = m_H;
|
int oldH = m_H;
|
||||||
|
|
||||||
CMeter::ReadOptions(parser, section);
|
Meter::ReadOptions(parser, section);
|
||||||
|
|
||||||
m_ImageName = parser.ReadString(section, L"ButtonImage", L"");
|
m_ImageName = parser.ReadString(section, L"ButtonImage", L"");
|
||||||
if (!m_ImageName.empty())
|
if (!m_ImageName.empty())
|
||||||
@@ -173,18 +173,18 @@ void CMeterButton::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the value(s) from the measures.
|
** Updates the value(s) from the measures.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterButton::Update()
|
bool MeterButton::Update()
|
||||||
{
|
{
|
||||||
return CMeter::Update();
|
return Meter::Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Draws the meter on the double buffer
|
** Draws the meter on the double buffer
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterButton::Draw(Gfx::Canvas& canvas)
|
bool MeterButton::Draw(Gfx::Canvas& canvas)
|
||||||
{
|
{
|
||||||
if (!CMeter::Draw(canvas)) return false;
|
if (!Meter::Draw(canvas)) return false;
|
||||||
|
|
||||||
if (m_Bitmaps[m_State] == NULL) return false; // Unable to continue
|
if (m_Bitmaps[m_State] == NULL) return false; // Unable to continue
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ bool CMeterButton::Draw(Gfx::Canvas& canvas)
|
|||||||
** Overridden method. The meters need not to be bound on anything
|
** Overridden method. The meters need not to be bound on anything
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterButton::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
void MeterButton::BindMeasures(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
BindPrimaryMeasure(parser, section, true);
|
BindPrimaryMeasure(parser, section, true);
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ void CMeterButton::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Checks if the given point is inside the button.
|
** Checks if the given point is inside the button.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterButton::HitTest2(int px, int py, bool checkAlpha)
|
bool MeterButton::HitTest2(int px, int py, bool checkAlpha)
|
||||||
{
|
{
|
||||||
int x = GetX();
|
int x = GetX();
|
||||||
int y = GetY();
|
int y = GetY();
|
||||||
@@ -253,13 +253,13 @@ bool CMeterButton::HitTest2(int px, int py, bool checkAlpha)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMeterButton::MouseUp(POINT pos, bool execute)
|
bool MeterButton::MouseUp(POINT pos, bool execute)
|
||||||
{
|
{
|
||||||
if (m_State == BUTTON_STATE_DOWN)
|
if (m_State == BUTTON_STATE_DOWN)
|
||||||
{
|
{
|
||||||
if (execute && m_Clicked && m_Focus && HitTest2(pos.x, pos.y, true))
|
if (execute && m_Clicked && m_Focus && HitTest2(pos.x, pos.y, true))
|
||||||
{
|
{
|
||||||
Rainmeter->ExecuteCommand(m_Command.c_str(), m_MeterWindow);
|
g_Rainmeter->ExecuteCommand(m_Command.c_str(), m_MeterWindow);
|
||||||
}
|
}
|
||||||
m_State = BUTTON_STATE_NORMAL;
|
m_State = BUTTON_STATE_NORMAL;
|
||||||
m_Clicked = false;
|
m_Clicked = false;
|
||||||
@@ -270,7 +270,7 @@ bool CMeterButton::MouseUp(POINT pos, bool execute)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMeterButton::MouseDown(POINT pos)
|
bool MeterButton::MouseDown(POINT pos)
|
||||||
{
|
{
|
||||||
if (m_Focus && HitTest2(pos.x, pos.y, true))
|
if (m_Focus && HitTest2(pos.x, pos.y, true))
|
||||||
{
|
{
|
||||||
@@ -281,7 +281,7 @@ bool CMeterButton::MouseDown(POINT pos)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMeterButton::MouseMove(POINT pos)
|
bool MeterButton::MouseMove(POINT pos)
|
||||||
{
|
{
|
||||||
if (m_Clicked)
|
if (m_Clicked)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,13 +24,13 @@
|
|||||||
|
|
||||||
#define BUTTON_FRAMES 3
|
#define BUTTON_FRAMES 3
|
||||||
|
|
||||||
class CMeterButton : public CMeter
|
class MeterButton : public Meter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeterButton(CMeterWindow* meterWindow, const WCHAR* name);
|
MeterButton(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeterButton();
|
virtual ~MeterButton();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeterButton>(); }
|
virtual UINT GetTypeID() { return TypeID<MeterButton>(); }
|
||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual bool Update();
|
virtual bool Update();
|
||||||
@@ -43,15 +43,15 @@ public:
|
|||||||
void SetFocus(bool f) { m_Focus = f; }
|
void SetFocus(bool f) { m_Focus = f; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void BindMeasures(CConfigParser& parser, const WCHAR* section);
|
virtual void BindMeasures(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
virtual bool IsFixedSize(bool overwrite = false) { return overwrite; }
|
virtual bool IsFixedSize(bool overwrite = false) { return overwrite; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool HitTest2(int px, int py, bool checkAlpha);
|
bool HitTest2(int px, int py, bool checkAlpha);
|
||||||
|
|
||||||
CTintedImage m_Image;
|
TintedImage m_Image;
|
||||||
std::wstring m_ImageName;
|
std::wstring m_ImageName;
|
||||||
bool m_NeedsReload;
|
bool m_NeedsReload;
|
||||||
|
|
||||||
|
|||||||
@@ -25,17 +25,17 @@
|
|||||||
|
|
||||||
using namespace Gdiplus;
|
using namespace Gdiplus;
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
CTintedImageHelper_DefineOptionArray(CMeterHistogram::c_PrimaryOptionArray, L"Primary");
|
TintedImageHelper_DefineOptionArray(MeterHistogram::c_PrimaryOptionArray, L"Primary");
|
||||||
CTintedImageHelper_DefineOptionArray(CMeterHistogram::c_SecondaryOptionArray, L"Secondary");
|
TintedImageHelper_DefineOptionArray(MeterHistogram::c_SecondaryOptionArray, L"Secondary");
|
||||||
CTintedImageHelper_DefineOptionArray(CMeterHistogram::c_BothOptionArray, L"Both");
|
TintedImageHelper_DefineOptionArray(MeterHistogram::c_BothOptionArray, L"Both");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterHistogram::CMeterHistogram(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name),
|
MeterHistogram::MeterHistogram(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
|
||||||
m_PrimaryColor(Color::Green),
|
m_PrimaryColor(Color::Green),
|
||||||
m_SecondaryColor(Color::Red),
|
m_SecondaryColor(Color::Red),
|
||||||
m_OverlapColor(Color::Yellow),
|
m_OverlapColor(Color::Yellow),
|
||||||
@@ -64,7 +64,7 @@ CMeterHistogram::CMeterHistogram(CMeterWindow* meterWindow, const WCHAR* name) :
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterHistogram::~CMeterHistogram()
|
MeterHistogram::~MeterHistogram()
|
||||||
{
|
{
|
||||||
DisposeBuffer();
|
DisposeBuffer();
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ CMeterHistogram::~CMeterHistogram()
|
|||||||
** Disposes the buffers.
|
** Disposes the buffers.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterHistogram::DisposeBuffer()
|
void MeterHistogram::DisposeBuffer()
|
||||||
{
|
{
|
||||||
// Reset current position
|
// Reset current position
|
||||||
m_MeterPos = 0;
|
m_MeterPos = 0;
|
||||||
@@ -90,7 +90,7 @@ void CMeterHistogram::DisposeBuffer()
|
|||||||
** Creates the buffers.
|
** Creates the buffers.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterHistogram::CreateBuffer()
|
void MeterHistogram::CreateBuffer()
|
||||||
{
|
{
|
||||||
DisposeBuffer();
|
DisposeBuffer();
|
||||||
|
|
||||||
@@ -111,11 +111,11 @@ void CMeterHistogram::CreateBuffer()
|
|||||||
** Or create the brushes if solid color histogram is used.
|
** Or create the brushes if solid color histogram is used.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterHistogram::Initialize()
|
void MeterHistogram::Initialize()
|
||||||
{
|
{
|
||||||
CMeter::Initialize();
|
Meter::Initialize();
|
||||||
|
|
||||||
CMeasure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL;
|
Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL;
|
||||||
|
|
||||||
// A sanity check
|
// A sanity check
|
||||||
if (secondaryMeasure && !m_PrimaryImageName.empty() && (m_OverlapImageName.empty() || m_SecondaryImageName.empty()))
|
if (secondaryMeasure && !m_PrimaryImageName.empty() && (m_OverlapImageName.empty() || m_SecondaryImageName.empty()))
|
||||||
@@ -193,7 +193,7 @@ void CMeterHistogram::Initialize()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeterHistogram::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
// Store the current values so we know if the image needs to be updated
|
// Store the current values so we know if the image needs to be updated
|
||||||
std::wstring oldPrimaryImageName = m_PrimaryImageName;
|
std::wstring oldPrimaryImageName = m_PrimaryImageName;
|
||||||
@@ -203,7 +203,7 @@ void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
int oldH = m_H;
|
int oldH = m_H;
|
||||||
bool oldGraphHorizontalOrientation = m_GraphHorizontalOrientation;
|
bool oldGraphHorizontalOrientation = m_GraphHorizontalOrientation;
|
||||||
|
|
||||||
CMeter::ReadOptions(parser, section);
|
Meter::ReadOptions(parser, section);
|
||||||
|
|
||||||
m_PrimaryColor = parser.ReadColor(section, L"PrimaryColor", Color::Green);
|
m_PrimaryColor = parser.ReadColor(section, L"PrimaryColor", Color::Green);
|
||||||
m_SecondaryColor = parser.ReadColor(section, L"SecondaryColor", Color::Red);
|
m_SecondaryColor = parser.ReadColor(section, L"SecondaryColor", Color::Red);
|
||||||
@@ -323,16 +323,16 @@ void CMeterHistogram::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the value(s) from the measures.
|
** Updates the value(s) from the measures.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterHistogram::Update()
|
bool MeterHistogram::Update()
|
||||||
{
|
{
|
||||||
if (CMeter::Update() && !m_Measures.empty())
|
if (Meter::Update() && !m_Measures.empty())
|
||||||
{
|
{
|
||||||
int maxSize = m_GraphHorizontalOrientation ? m_H : m_W;
|
int maxSize = m_GraphHorizontalOrientation ? m_H : m_W;
|
||||||
|
|
||||||
if (maxSize > 0) // m_PrimaryValues is not NULL
|
if (maxSize > 0) // m_PrimaryValues is not NULL
|
||||||
{
|
{
|
||||||
CMeasure* measure = m_Measures[0];
|
Measure* measure = m_Measures[0];
|
||||||
CMeasure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL;
|
Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL;
|
||||||
|
|
||||||
// Gather values
|
// Gather values
|
||||||
m_PrimaryValues[m_MeterPos] = measure->GetValue();
|
m_PrimaryValues[m_MeterPos] = measure->GetValue();
|
||||||
@@ -411,15 +411,15 @@ bool CMeterHistogram::Update()
|
|||||||
** Draws the meter on the double buffer
|
** Draws the meter on the double buffer
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterHistogram::Draw(Gfx::Canvas& canvas)
|
bool MeterHistogram::Draw(Gfx::Canvas& canvas)
|
||||||
{
|
{
|
||||||
if (!CMeter::Draw(canvas) ||
|
if (!Meter::Draw(canvas) ||
|
||||||
(m_Measures.size() >= 1 && !m_PrimaryValues) ||
|
(m_Measures.size() >= 1 && !m_PrimaryValues) ||
|
||||||
(m_Measures.size() >= 2 && !m_SecondaryValues)) return false;
|
(m_Measures.size() >= 2 && !m_SecondaryValues)) return false;
|
||||||
|
|
||||||
Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext();
|
Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext();
|
||||||
|
|
||||||
CMeasure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL;
|
Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL;
|
||||||
|
|
||||||
GraphicsPath primaryPath;
|
GraphicsPath primaryPath;
|
||||||
GraphicsPath secondaryPath;
|
GraphicsPath secondaryPath;
|
||||||
@@ -645,7 +645,7 @@ bool CMeterHistogram::Draw(Gfx::Canvas& canvas)
|
|||||||
** Overwritten method to handle the secondary measure binding.
|
** Overwritten method to handle the secondary measure binding.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterHistogram::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
void MeterHistogram::BindMeasures(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
if (BindPrimaryMeasure(parser, section, false))
|
if (BindPrimaryMeasure(parser, section, false))
|
||||||
{
|
{
|
||||||
@@ -656,7 +656,7 @@ void CMeterHistogram::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
|||||||
secondaryMeasure = &parser.ReadString(section, L"SecondaryMeasureName", L"");
|
secondaryMeasure = &parser.ReadString(section, L"SecondaryMeasureName", L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
CMeasure* measure = parser.GetMeasure(*secondaryMeasure);
|
Measure* measure = parser.GetMeasure(*secondaryMeasure);
|
||||||
if (measure)
|
if (measure)
|
||||||
{
|
{
|
||||||
m_Measures.push_back(measure);
|
m_Measures.push_back(measure);
|
||||||
|
|||||||
@@ -22,21 +22,21 @@
|
|||||||
#include "Meter.h"
|
#include "Meter.h"
|
||||||
#include "TintedImage.h"
|
#include "TintedImage.h"
|
||||||
|
|
||||||
class CMeterHistogram : public CMeter
|
class MeterHistogram : public Meter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeterHistogram(CMeterWindow* meterWindow, const WCHAR* name);
|
MeterHistogram(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeterHistogram();
|
virtual ~MeterHistogram();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeterHistogram>(); }
|
virtual UINT GetTypeID() { return TypeID<MeterHistogram>(); }
|
||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual bool Update();
|
virtual bool Update();
|
||||||
virtual bool Draw(Gfx::Canvas& canvas);
|
virtual bool Draw(Gfx::Canvas& canvas);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void BindMeasures(CConfigParser& parser, const WCHAR* section);
|
virtual void BindMeasures(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
virtual bool IsFixedSize(bool overwrite = false) { return m_PrimaryImageName.empty(); }
|
virtual bool IsFixedSize(bool overwrite = false) { return m_PrimaryImageName.empty(); }
|
||||||
|
|
||||||
@@ -56,9 +56,9 @@ private:
|
|||||||
std::wstring m_SecondaryImageName;
|
std::wstring m_SecondaryImageName;
|
||||||
std::wstring m_OverlapImageName;
|
std::wstring m_OverlapImageName;
|
||||||
|
|
||||||
CTintedImage m_PrimaryImage;
|
TintedImage m_PrimaryImage;
|
||||||
CTintedImage m_SecondaryImage;
|
TintedImage m_SecondaryImage;
|
||||||
CTintedImage m_OverlapImage;
|
TintedImage m_OverlapImage;
|
||||||
|
|
||||||
bool m_PrimaryNeedsReload;
|
bool m_PrimaryNeedsReload;
|
||||||
bool m_SecondaryNeedsReload;
|
bool m_SecondaryNeedsReload;
|
||||||
@@ -77,9 +77,9 @@ private:
|
|||||||
bool m_GraphStartLeft;
|
bool m_GraphStartLeft;
|
||||||
bool m_GraphHorizontalOrientation;
|
bool m_GraphHorizontalOrientation;
|
||||||
|
|
||||||
static const WCHAR* c_PrimaryOptionArray[CTintedImage::OptionCount];
|
static const WCHAR* c_PrimaryOptionArray[TintedImage::OptionCount];
|
||||||
static const WCHAR* c_SecondaryOptionArray[CTintedImage::OptionCount];
|
static const WCHAR* c_SecondaryOptionArray[TintedImage::OptionCount];
|
||||||
static const WCHAR* c_BothOptionArray[CTintedImage::OptionCount];
|
static const WCHAR* c_BothOptionArray[TintedImage::OptionCount];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "System.h"
|
#include "System.h"
|
||||||
#include "../Common/Gfx/Canvas.h"
|
#include "../Common/Gfx/Canvas.h"
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
using namespace Gdiplus;
|
using namespace Gdiplus;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ using namespace Gdiplus;
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterImage::CMeterImage(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name),
|
MeterImage::MeterImage(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
|
||||||
m_NeedsRedraw(false),
|
m_NeedsRedraw(false),
|
||||||
m_DrawMode(DRAWMODE_NONE),
|
m_DrawMode(DRAWMODE_NONE),
|
||||||
m_ScaleMargins()
|
m_ScaleMargins()
|
||||||
@@ -43,7 +43,7 @@ CMeterImage::CMeterImage(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterImage::~CMeterImage()
|
MeterImage::~MeterImage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,9 +51,9 @@ CMeterImage::~CMeterImage()
|
|||||||
** Load the image and get the dimensions of the meter from it.
|
** Load the image and get the dimensions of the meter from it.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterImage::Initialize()
|
void MeterImage::Initialize()
|
||||||
{
|
{
|
||||||
CMeter::Initialize();
|
Meter::Initialize();
|
||||||
|
|
||||||
if (m_Measures.empty() && !m_DynamicVariables && !m_ImageName.empty())
|
if (m_Measures.empty() && !m_DynamicVariables && !m_ImageName.empty())
|
||||||
{
|
{
|
||||||
@@ -68,7 +68,7 @@ void CMeterImage::Initialize()
|
|||||||
** Loads the image from disk
|
** Loads the image from disk
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
|
void MeterImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
|
||||||
{
|
{
|
||||||
m_Image.LoadImage(imageName, bLoadAlways);
|
m_Image.LoadImage(imageName, bLoadAlways);
|
||||||
|
|
||||||
@@ -106,14 +106,14 @@ void CMeterImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterImage::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeterImage::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
CMeter::ReadOptions(parser, section);
|
Meter::ReadOptions(parser, section);
|
||||||
|
|
||||||
m_Path = parser.ReadString(section, L"Path", L"");
|
m_Path = parser.ReadString(section, L"Path", L"");
|
||||||
if (!m_Path.empty())
|
if (!m_Path.empty())
|
||||||
{
|
{
|
||||||
if (!CSystem::IsPathSeparator(m_Path[m_Path.length() - 1]))
|
if (!System::IsPathSeparator(m_Path[m_Path.length() - 1]))
|
||||||
{
|
{
|
||||||
m_Path += L'\\';
|
m_Path += L'\\';
|
||||||
}
|
}
|
||||||
@@ -161,9 +161,9 @@ void CMeterImage::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the value(s) from the measures.
|
** Updates the value(s) from the measures.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterImage::Update()
|
bool MeterImage::Update()
|
||||||
{
|
{
|
||||||
if (CMeter::Update())
|
if (Meter::Update())
|
||||||
{
|
{
|
||||||
if (!m_Measures.empty() || m_DynamicVariables)
|
if (!m_Measures.empty() || m_DynamicVariables)
|
||||||
{
|
{
|
||||||
@@ -215,9 +215,9 @@ bool CMeterImage::Update()
|
|||||||
** Draws the meter on the double buffer
|
** Draws the meter on the double buffer
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterImage::Draw(Gfx::Canvas& canvas)
|
bool MeterImage::Draw(Gfx::Canvas& canvas)
|
||||||
{
|
{
|
||||||
if (!CMeter::Draw(canvas)) return false;
|
if (!Meter::Draw(canvas)) return false;
|
||||||
|
|
||||||
if (m_Image.IsLoaded())
|
if (m_Image.IsLoaded())
|
||||||
{
|
{
|
||||||
@@ -371,7 +371,7 @@ bool CMeterImage::Draw(Gfx::Canvas& canvas)
|
|||||||
** Overridden method. The Image meters need not to be bound on anything
|
** Overridden method. The Image meters need not to be bound on anything
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterImage::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
void MeterImage::BindMeasures(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
if (BindPrimaryMeasure(parser, section, true))
|
if (BindPrimaryMeasure(parser, section, true))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,21 +22,21 @@
|
|||||||
#include "Meter.h"
|
#include "Meter.h"
|
||||||
#include "TintedImage.h"
|
#include "TintedImage.h"
|
||||||
|
|
||||||
class CMeterImage : public CMeter
|
class MeterImage : public Meter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeterImage(CMeterWindow* meterWindow, const WCHAR* name);
|
MeterImage(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeterImage();
|
virtual ~MeterImage();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeterImage>(); }
|
virtual UINT GetTypeID() { return TypeID<MeterImage>(); }
|
||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual bool Update();
|
virtual bool Update();
|
||||||
virtual bool Draw(Gfx::Canvas& canvas);
|
virtual bool Draw(Gfx::Canvas& canvas);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void BindMeasures(CConfigParser& parser, const WCHAR* section);
|
virtual void BindMeasures(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
virtual bool IsFixedSize(bool overwrite = false) { return overwrite ? true : m_ImageNameResult.empty(); }
|
virtual bool IsFixedSize(bool overwrite = false) { return overwrite ? true : m_ImageNameResult.empty(); }
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ private:
|
|||||||
|
|
||||||
void LoadImage(const std::wstring& imageName, bool bLoadAlways);
|
void LoadImage(const std::wstring& imageName, bool bLoadAlways);
|
||||||
|
|
||||||
CTintedImage m_Image;
|
TintedImage m_Image;
|
||||||
std::wstring m_ImageName;
|
std::wstring m_ImageName;
|
||||||
std::wstring m_ImageNameResult; // Image name as absolute path
|
std::wstring m_ImageNameResult; // Image name as absolute path
|
||||||
std::wstring m_Path;
|
std::wstring m_Path;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ using namespace Gdiplus;
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterLine::CMeterLine(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name),
|
MeterLine::MeterLine(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
|
||||||
m_Autoscale(false),
|
m_Autoscale(false),
|
||||||
m_HorizontalLines(false),
|
m_HorizontalLines(false),
|
||||||
m_Flip(false),
|
m_Flip(false),
|
||||||
@@ -44,7 +44,7 @@ CMeterLine::CMeterLine(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(me
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterLine::~CMeterLine()
|
MeterLine::~MeterLine()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,9 +52,9 @@ CMeterLine::~CMeterLine()
|
|||||||
** create the buffer for the lines
|
** create the buffer for the lines
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterLine::Initialize()
|
void MeterLine::Initialize()
|
||||||
{
|
{
|
||||||
CMeter::Initialize();
|
Meter::Initialize();
|
||||||
|
|
||||||
size_t colorsSize = m_Colors.size();
|
size_t colorsSize = m_Colors.size();
|
||||||
size_t allValuesSize = m_AllValues.size();
|
size_t allValuesSize = m_AllValues.size();
|
||||||
@@ -100,7 +100,7 @@ void CMeterLine::Initialize()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterLine::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeterLine::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
WCHAR tmpName[64];
|
WCHAR tmpName[64];
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ void CMeterLine::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
int oldSize = m_GraphHorizontalOrientation ? m_H : m_W;
|
int oldSize = m_GraphHorizontalOrientation ? m_H : m_W;
|
||||||
bool oldGraphHorizontalOrientation = m_GraphHorizontalOrientation;
|
bool oldGraphHorizontalOrientation = m_GraphHorizontalOrientation;
|
||||||
|
|
||||||
CMeter::ReadOptions(parser, section);
|
Meter::ReadOptions(parser, section);
|
||||||
|
|
||||||
int lineCount = parser.ReadInt(section, L"LineCount", 1);
|
int lineCount = parser.ReadInt(section, L"LineCount", 1);
|
||||||
|
|
||||||
@@ -192,9 +192,9 @@ void CMeterLine::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the value(s) from the measures.
|
** Updates the value(s) from the measures.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterLine::Update()
|
bool MeterLine::Update()
|
||||||
{
|
{
|
||||||
if (CMeter::Update() && !m_Measures.empty())
|
if (Meter::Update() && !m_Measures.empty())
|
||||||
{
|
{
|
||||||
int maxSize = m_GraphHorizontalOrientation ? m_H : m_W;
|
int maxSize = m_GraphHorizontalOrientation ? m_H : m_W;
|
||||||
|
|
||||||
@@ -219,10 +219,10 @@ bool CMeterLine::Update()
|
|||||||
** Draws the meter on the double buffer
|
** Draws the meter on the double buffer
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterLine::Draw(Gfx::Canvas& canvas)
|
bool MeterLine::Draw(Gfx::Canvas& canvas)
|
||||||
{
|
{
|
||||||
int maxSize = m_GraphHorizontalOrientation ? m_H : m_W;
|
int maxSize = m_GraphHorizontalOrientation ? m_H : m_W;
|
||||||
if (!CMeter::Draw(canvas) || maxSize <= 0) return false;
|
if (!Meter::Draw(canvas) || maxSize <= 0) return false;
|
||||||
|
|
||||||
Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext();
|
Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext();
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ bool CMeterLine::Draw(Gfx::Canvas& canvas)
|
|||||||
** Overwritten method to handle the other measure bindings.
|
** Overwritten method to handle the other measure bindings.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterLine::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
void MeterLine::BindMeasures(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
if (BindPrimaryMeasure(parser, section, false))
|
if (BindPrimaryMeasure(parser, section, false))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,21 +21,21 @@
|
|||||||
|
|
||||||
#include "Meter.h"
|
#include "Meter.h"
|
||||||
|
|
||||||
class CMeterLine : public CMeter
|
class MeterLine : public Meter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeterLine(CMeterWindow* meterWindow, const WCHAR* name);
|
MeterLine(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeterLine();
|
virtual ~MeterLine();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeterLine>(); }
|
virtual UINT GetTypeID() { return TypeID<MeterLine>(); }
|
||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual bool Update();
|
virtual bool Update();
|
||||||
virtual bool Draw(Gfx::Canvas& canvas);
|
virtual bool Draw(Gfx::Canvas& canvas);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void BindMeasures(CConfigParser& parser, const WCHAR* section);
|
virtual void BindMeasures(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Gdiplus::Color> m_Colors;
|
std::vector<Gdiplus::Color> m_Colors;
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ using namespace Gdiplus;
|
|||||||
#define PI (3.14159265358979323846)
|
#define PI (3.14159265358979323846)
|
||||||
#define CONVERT_TO_DEGREES(X) ((X) * (180.0 / PI))
|
#define CONVERT_TO_DEGREES(X) ((X) * (180.0 / PI))
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterRotator::CMeterRotator(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name),
|
MeterRotator::MeterRotator(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
|
||||||
m_NeedsReload(false),
|
m_NeedsReload(false),
|
||||||
m_OffsetX(),
|
m_OffsetX(),
|
||||||
m_OffsetY(),
|
m_OffsetY(),
|
||||||
@@ -50,7 +50,7 @@ CMeterRotator::CMeterRotator(CMeterWindow* meterWindow, const WCHAR* name) : CMe
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterRotator::~CMeterRotator()
|
MeterRotator::~MeterRotator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,9 +58,9 @@ CMeterRotator::~CMeterRotator()
|
|||||||
** Load the image.
|
** Load the image.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterRotator::Initialize()
|
void MeterRotator::Initialize()
|
||||||
{
|
{
|
||||||
CMeter::Initialize();
|
Meter::Initialize();
|
||||||
|
|
||||||
// Load the bitmaps if defined
|
// Load the bitmaps if defined
|
||||||
if (!m_ImageName.empty())
|
if (!m_ImageName.empty())
|
||||||
@@ -77,12 +77,12 @@ void CMeterRotator::Initialize()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterRotator::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeterRotator::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
// Store the current values so we know if the image needs to be updated
|
// Store the current values so we know if the image needs to be updated
|
||||||
std::wstring oldImageName = m_ImageName;
|
std::wstring oldImageName = m_ImageName;
|
||||||
|
|
||||||
CMeter::ReadOptions(parser, section);
|
Meter::ReadOptions(parser, section);
|
||||||
|
|
||||||
m_ImageName = parser.ReadString(section, L"ImageName", L"");
|
m_ImageName = parser.ReadString(section, L"ImageName", L"");
|
||||||
if (!m_ImageName.empty())
|
if (!m_ImageName.empty())
|
||||||
@@ -121,11 +121,11 @@ void CMeterRotator::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the value(s) from the measures.
|
** Updates the value(s) from the measures.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterRotator::Update()
|
bool MeterRotator::Update()
|
||||||
{
|
{
|
||||||
if (CMeter::Update() && !m_Measures.empty())
|
if (Meter::Update() && !m_Measures.empty())
|
||||||
{
|
{
|
||||||
CMeasure* measure = m_Measures[0];
|
Measure* measure = m_Measures[0];
|
||||||
if (m_ValueRemainder > 0)
|
if (m_ValueRemainder > 0)
|
||||||
{
|
{
|
||||||
LONGLONG time = (LONGLONG)measure->GetValue();
|
LONGLONG time = (LONGLONG)measure->GetValue();
|
||||||
@@ -146,9 +146,9 @@ bool CMeterRotator::Update()
|
|||||||
** Draws the meter on the double buffer
|
** Draws the meter on the double buffer
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterRotator::Draw(Gfx::Canvas& canvas)
|
bool MeterRotator::Draw(Gfx::Canvas& canvas)
|
||||||
{
|
{
|
||||||
if (!CMeter::Draw(canvas)) return false;
|
if (!Meter::Draw(canvas)) return false;
|
||||||
|
|
||||||
Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext();
|
Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext();
|
||||||
|
|
||||||
|
|||||||
@@ -22,23 +22,23 @@
|
|||||||
#include "Meter.h"
|
#include "Meter.h"
|
||||||
#include "TintedImage.h"
|
#include "TintedImage.h"
|
||||||
|
|
||||||
class CMeterRotator : public CMeter
|
class MeterRotator : public Meter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeterRotator(CMeterWindow* meterWindow, const WCHAR* name);
|
MeterRotator(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeterRotator();
|
virtual ~MeterRotator();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeterRotator>(); }
|
virtual UINT GetTypeID() { return TypeID<MeterRotator>(); }
|
||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual bool Update();
|
virtual bool Update();
|
||||||
virtual bool Draw(Gfx::Canvas& canvas);
|
virtual bool Draw(Gfx::Canvas& canvas);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CTintedImage m_Image;
|
TintedImage m_Image;
|
||||||
std::wstring m_ImageName;
|
std::wstring m_ImageName;
|
||||||
bool m_NeedsReload;
|
bool m_NeedsReload;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ using namespace Gdiplus;
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterRoundLine::CMeterRoundLine(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name),
|
MeterRoundLine::MeterRoundLine(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
|
||||||
m_Solid(false),
|
m_Solid(false),
|
||||||
m_LineWidth(1.0),
|
m_LineWidth(1.0),
|
||||||
m_LineLength(20.0),
|
m_LineLength(20.0),
|
||||||
@@ -53,7 +53,7 @@ CMeterRoundLine::CMeterRoundLine(CMeterWindow* meterWindow, const WCHAR* name) :
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterRoundLine::~CMeterRoundLine()
|
MeterRoundLine::~MeterRoundLine()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,9 +61,9 @@ CMeterRoundLine::~CMeterRoundLine()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterRoundLine::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeterRoundLine::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
CMeter::ReadOptions(parser, section);
|
Meter::ReadOptions(parser, section);
|
||||||
|
|
||||||
m_LineWidth = parser.ReadFloat(section, L"LineWidth", 1.0);
|
m_LineWidth = parser.ReadFloat(section, L"LineWidth", 1.0);
|
||||||
m_LineLength = parser.ReadFloat(section, L"LineLength", 20.0);
|
m_LineLength = parser.ReadFloat(section, L"LineLength", 20.0);
|
||||||
@@ -85,9 +85,9 @@ void CMeterRoundLine::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the value(s) from the measures.
|
** Updates the value(s) from the measures.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterRoundLine::Update()
|
bool MeterRoundLine::Update()
|
||||||
{
|
{
|
||||||
if (CMeter::Update())
|
if (Meter::Update())
|
||||||
{
|
{
|
||||||
if (m_Measures.empty())
|
if (m_Measures.empty())
|
||||||
{
|
{
|
||||||
@@ -95,7 +95,7 @@ bool CMeterRoundLine::Update()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMeasure* measure = m_Measures[0];
|
Measure* measure = m_Measures[0];
|
||||||
if (m_ValueRemainder > 0)
|
if (m_ValueRemainder > 0)
|
||||||
{
|
{
|
||||||
LONGLONG time = (LONGLONG)measure->GetValue();
|
LONGLONG time = (LONGLONG)measure->GetValue();
|
||||||
@@ -117,9 +117,9 @@ bool CMeterRoundLine::Update()
|
|||||||
** Draws the meter on the double buffer
|
** Draws the meter on the double buffer
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterRoundLine::Draw(Gfx::Canvas& canvas)
|
bool MeterRoundLine::Draw(Gfx::Canvas& canvas)
|
||||||
{
|
{
|
||||||
if (!CMeter::Draw(canvas)) return false;
|
if (!Meter::Draw(canvas)) return false;
|
||||||
|
|
||||||
Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext();
|
Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext();
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ bool CMeterRoundLine::Draw(Gfx::Canvas& canvas)
|
|||||||
** Overridden method. The roundline meters need not to be bound on anything
|
** Overridden method. The roundline meters need not to be bound on anything
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterRoundLine::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
void MeterRoundLine::BindMeasures(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
BindPrimaryMeasure(parser, section, true);
|
BindPrimaryMeasure(parser, section, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,20 +21,20 @@
|
|||||||
|
|
||||||
#include "Meter.h"
|
#include "Meter.h"
|
||||||
|
|
||||||
class CMeterRoundLine : public CMeter
|
class MeterRoundLine : public Meter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeterRoundLine(CMeterWindow* meterWindow, const WCHAR* name);
|
MeterRoundLine(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeterRoundLine();
|
virtual ~MeterRoundLine();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeterRoundLine>(); }
|
virtual UINT GetTypeID() { return TypeID<MeterRoundLine>(); }
|
||||||
|
|
||||||
virtual bool Update();
|
virtual bool Update();
|
||||||
virtual bool Draw(Gfx::Canvas& canvas);
|
virtual bool Draw(Gfx::Canvas& canvas);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void BindMeasures(CConfigParser& parser, const WCHAR* section);
|
virtual void BindMeasures(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_Solid;
|
bool m_Solid;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ using namespace Gdiplus;
|
|||||||
#define PI (3.14159265f)
|
#define PI (3.14159265f)
|
||||||
#define CONVERT_TO_DEGREES(X) ((X) * (180.0f / PI))
|
#define CONVERT_TO_DEGREES(X) ((X) * (180.0f / PI))
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
void StringToUpper(std::wstring& str)
|
void StringToUpper(std::wstring& str)
|
||||||
{
|
{
|
||||||
@@ -63,7 +63,7 @@ void StringToProper(std::wstring& str)
|
|||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterString::CMeterString(CMeterWindow* meterWindow, const WCHAR* name) : CMeter(meterWindow, name),
|
MeterString::MeterString(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name),
|
||||||
m_Color(Color::White),
|
m_Color(Color::White),
|
||||||
m_EffectColor(Color::Black),
|
m_EffectColor(Color::Black),
|
||||||
m_AutoScale(AUTOSCALE_OFF),
|
m_AutoScale(AUTOSCALE_OFF),
|
||||||
@@ -88,7 +88,7 @@ CMeterString::CMeterString(CMeterWindow* meterWindow, const WCHAR* name) : CMete
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CMeterString::~CMeterString()
|
MeterString::~MeterString()
|
||||||
{
|
{
|
||||||
delete m_TextFormat;
|
delete m_TextFormat;
|
||||||
m_TextFormat = NULL;
|
m_TextFormat = NULL;
|
||||||
@@ -98,9 +98,9 @@ CMeterString::~CMeterString()
|
|||||||
** Returns the X-coordinate of the meter
|
** Returns the X-coordinate of the meter
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
int CMeterString::GetX(bool abs)
|
int MeterString::GetX(bool abs)
|
||||||
{
|
{
|
||||||
int x = CMeter::GetX();
|
int x = Meter::GetX();
|
||||||
|
|
||||||
if (!abs)
|
if (!abs)
|
||||||
{
|
{
|
||||||
@@ -123,9 +123,9 @@ int CMeterString::GetX(bool abs)
|
|||||||
** Returns the Y-coordinate of the meter
|
** Returns the Y-coordinate of the meter
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
int CMeterString::GetY(bool abs)
|
int MeterString::GetY(bool abs)
|
||||||
{
|
{
|
||||||
int y = CMeter::GetY();
|
int y = Meter::GetY();
|
||||||
|
|
||||||
if (!abs)
|
if (!abs)
|
||||||
{
|
{
|
||||||
@@ -148,9 +148,9 @@ int CMeterString::GetY(bool abs)
|
|||||||
** Create the font that is used to draw the text.
|
** Create the font that is used to draw the text.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterString::Initialize()
|
void MeterString::Initialize()
|
||||||
{
|
{
|
||||||
CMeter::Initialize();
|
Meter::Initialize();
|
||||||
|
|
||||||
m_TextFormat->SetProperties(
|
m_TextFormat->SetProperties(
|
||||||
m_FontFace.c_str(),
|
m_FontFace.c_str(),
|
||||||
@@ -164,14 +164,14 @@ void CMeterString::Initialize()
|
|||||||
** Read the options specified in the ini file.
|
** Read the options specified in the ini file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void MeterString::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
// Store the current font values so we know if the font needs to be updated
|
// Store the current font values so we know if the font needs to be updated
|
||||||
std::wstring oldFontFace = m_FontFace;
|
std::wstring oldFontFace = m_FontFace;
|
||||||
int oldFontSize = m_FontSize;
|
int oldFontSize = m_FontSize;
|
||||||
TEXTSTYLE oldStyle = m_Style;
|
TEXTSTYLE oldStyle = m_Style;
|
||||||
|
|
||||||
CMeter::ReadOptions(parser, section);
|
Meter::ReadOptions(parser, section);
|
||||||
|
|
||||||
m_Color = parser.ReadColor(section, L"FontColor", Color::Black);
|
m_Color = parser.ReadColor(section, L"FontColor", Color::Black);
|
||||||
m_EffectColor = parser.ReadColor(section, L"FontEffectColor", Color::Black);
|
m_EffectColor = parser.ReadColor(section, L"FontEffectColor", Color::Black);
|
||||||
@@ -348,9 +348,9 @@ void CMeterString::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the value(s) from the measures.
|
** Updates the value(s) from the measures.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterString::Update()
|
bool MeterString::Update()
|
||||||
{
|
{
|
||||||
if (CMeter::Update())
|
if (Meter::Update())
|
||||||
{
|
{
|
||||||
int decimals = (m_NumOfDecimals != -1) ? m_NumOfDecimals : (m_NoDecimals && (m_Percentual || m_AutoScale == AUTOSCALE_OFF)) ? 0 : 1;
|
int decimals = (m_NumOfDecimals != -1) ? m_NumOfDecimals : (m_NoDecimals && (m_Percentual || m_AutoScale == AUTOSCALE_OFF)) ? 0 : 1;
|
||||||
|
|
||||||
@@ -414,9 +414,9 @@ bool CMeterString::Update()
|
|||||||
** Draws the meter on the double buffer
|
** Draws the meter on the double buffer
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterString::Draw(Gfx::Canvas& canvas)
|
bool MeterString::Draw(Gfx::Canvas& canvas)
|
||||||
{
|
{
|
||||||
if (!CMeter::Draw(canvas)) return false;
|
if (!Meter::Draw(canvas)) return false;
|
||||||
|
|
||||||
return DrawString(canvas, NULL);
|
return DrawString(canvas, NULL);
|
||||||
}
|
}
|
||||||
@@ -425,7 +425,7 @@ bool CMeterString::Draw(Gfx::Canvas& canvas)
|
|||||||
** Draws the string or calculates it's size
|
** Draws the string or calculates it's size
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CMeterString::DrawString(Gfx::Canvas& canvas, RectF* rect)
|
bool MeterString::DrawString(Gfx::Canvas& canvas, RectF* rect)
|
||||||
{
|
{
|
||||||
if (!m_TextFormat->IsInitialized()) return false;
|
if (!m_TextFormat->IsInitialized()) return false;
|
||||||
|
|
||||||
@@ -585,7 +585,7 @@ bool CMeterString::DrawString(Gfx::Canvas& canvas, RectF* rect)
|
|||||||
** Overridden method. The string meters need not to be bound on anything
|
** Overridden method. The string meters need not to be bound on anything
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterString::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
void MeterString::BindMeasures(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
if (BindPrimaryMeasure(parser, section, true))
|
if (BindPrimaryMeasure(parser, section, true))
|
||||||
{
|
{
|
||||||
@@ -597,7 +597,7 @@ void CMeterString::BindMeasures(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Static helper to log all installed font families.
|
** Static helper to log all installed font families.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterString::EnumerateInstalledFontFamilies()
|
void MeterString::EnumerateInstalledFontFamilies()
|
||||||
{
|
{
|
||||||
INT fontCount;
|
INT fontCount;
|
||||||
InstalledFontCollection fontCollection;
|
InstalledFontCollection fontCollection;
|
||||||
@@ -647,9 +647,9 @@ void CMeterString::EnumerateInstalledFontFamilies()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeterString::InitializeStatic()
|
void MeterString::InitializeStatic()
|
||||||
{
|
{
|
||||||
if (Rainmeter->GetDebug())
|
if (g_Rainmeter->GetDebug())
|
||||||
{
|
{
|
||||||
LogDebug(L"------------------------------");
|
LogDebug(L"------------------------------");
|
||||||
LogDebug(L"* Font families:");
|
LogDebug(L"* Font families:");
|
||||||
@@ -658,6 +658,6 @@ void CMeterString::InitializeStatic()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMeterString::FinalizeStatic()
|
void MeterString::FinalizeStatic()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,13 +23,13 @@
|
|||||||
#include "Measure.h"
|
#include "Measure.h"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
class CMeterString : public CMeter
|
class MeterString : public Meter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeterString(CMeterWindow* meterWindow, const WCHAR* name);
|
MeterString(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
virtual ~CMeterString();
|
virtual ~MeterString();
|
||||||
|
|
||||||
virtual UINT GetTypeID() { return TypeID<CMeterString>(); }
|
virtual UINT GetTypeID() { return TypeID<MeterString>(); }
|
||||||
|
|
||||||
virtual int GetX(bool abs = false);
|
virtual int GetX(bool abs = false);
|
||||||
virtual int GetY(bool abs = false);
|
virtual int GetY(bool abs = false);
|
||||||
@@ -46,8 +46,8 @@ public:
|
|||||||
static void FinalizeStatic();
|
static void FinalizeStatic();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
virtual void BindMeasures(CConfigParser& parser, const WCHAR* section);
|
virtual void BindMeasures(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
virtual bool IsFixedSize(bool overwrite = false) { return overwrite; }
|
virtual bool IsFixedSize(bool overwrite = false) { return overwrite; }
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -99,9 +99,9 @@ enum RESIZEMODE
|
|||||||
RESIZEMODE_RESET
|
RESIZEMODE_RESET
|
||||||
};
|
};
|
||||||
|
|
||||||
class CRainmeter;
|
class Rainmeter;
|
||||||
class CMeasure;
|
class Measure;
|
||||||
class CMeter;
|
class Meter;
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
class Canvas;
|
class Canvas;
|
||||||
@@ -109,11 +109,11 @@ class FontCollection;
|
|||||||
class TextFormat;
|
class TextFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CMeterWindow : public CGroup
|
class MeterWindow : public Group
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMeterWindow(const std::wstring& folderPath, const std::wstring& file);
|
MeterWindow(const std::wstring& folderPath, const std::wstring& file);
|
||||||
~CMeterWindow();
|
~MeterWindow();
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ public:
|
|||||||
Gfx::Canvas& GetCanvas() { return *m_Canvas; }
|
Gfx::Canvas& GetCanvas() { return *m_Canvas; }
|
||||||
HWND GetWindow() { return m_Window; }
|
HWND GetWindow() { return m_Window; }
|
||||||
|
|
||||||
CConfigParser& GetParser() { return m_Parser; }
|
ConfigParser& GetParser() { return m_Parser; }
|
||||||
|
|
||||||
const std::wstring& GetFolderPath() { return m_FolderPath; }
|
const std::wstring& GetFolderPath() { return m_FolderPath; }
|
||||||
const std::wstring& GetFileName() { return m_FileName; }
|
const std::wstring& GetFileName() { return m_FileName; }
|
||||||
@@ -162,8 +162,8 @@ public:
|
|||||||
std::wstring GetRootPath();
|
std::wstring GetRootPath();
|
||||||
std::wstring GetResourcesPath();
|
std::wstring GetResourcesPath();
|
||||||
|
|
||||||
const std::vector<CMeasure*>& GetMeasures() { return m_Measures; }
|
const std::vector<Measure*>& GetMeasures() { return m_Measures; }
|
||||||
const std::vector<CMeter*>& GetMeters() { return m_Meters; }
|
const std::vector<Meter*>& GetMeters() { return m_Meters; }
|
||||||
|
|
||||||
ZPOSITION GetWindowZPosition() { return m_WindowZPosition; }
|
ZPOSITION GetWindowZPosition() { return m_WindowZPosition; }
|
||||||
bool GetXPercentage() { return m_WindowXPercentage; }
|
bool GetXPercentage() { return m_WindowXPercentage; }
|
||||||
@@ -196,16 +196,16 @@ public:
|
|||||||
|
|
||||||
bool IsClosing() { return m_State == STATE_CLOSING; }
|
bool IsClosing() { return m_State == STATE_CLOSING; }
|
||||||
|
|
||||||
const CMouse& GetMouse() { return m_Mouse; }
|
const Mouse& GetMouse() { return m_Mouse; }
|
||||||
|
|
||||||
void MakePathAbsolute(std::wstring& path);
|
void MakePathAbsolute(std::wstring& path);
|
||||||
|
|
||||||
Gfx::FontCollection* GetFontCollection() { return m_FontCollection; }
|
Gfx::FontCollection* GetFontCollection() { return m_FontCollection; }
|
||||||
|
|
||||||
CMeter* GetMeter(const std::wstring& meterName);
|
Meter* GetMeter(const std::wstring& meterName);
|
||||||
CMeasure* GetMeasure(const std::wstring& measureName) { return m_Parser.GetMeasure(measureName); }
|
Measure* GetMeasure(const std::wstring& measureName) { return m_Parser.GetMeasure(measureName); }
|
||||||
|
|
||||||
friend class CDialogManage;
|
friend class DialogManage;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
@@ -277,13 +277,13 @@ private:
|
|||||||
|
|
||||||
bool HitTest(int x, int y);
|
bool HitTest(int x, int y);
|
||||||
|
|
||||||
void SnapToWindow(CMeterWindow* window, LPWINDOWPOS wp);
|
void SnapToWindow(MeterWindow* window, LPWINDOWPOS wp);
|
||||||
void MapCoordsToScreen(int& x, int& y, int w, int h);
|
void MapCoordsToScreen(int& x, int& y, int w, int h);
|
||||||
void WindowToScreen();
|
void WindowToScreen();
|
||||||
void ScreenToWindow();
|
void ScreenToWindow();
|
||||||
void PostUpdate(bool bActiveTransition);
|
void PostUpdate(bool bActiveTransition);
|
||||||
bool UpdateMeasure(CMeasure* measure, bool force);
|
bool UpdateMeasure(Measure* measure, bool force);
|
||||||
bool UpdateMeter(CMeter* meter, bool& bActiveTransition, bool force);
|
bool UpdateMeter(Meter* meter, bool& bActiveTransition, bool force);
|
||||||
void Update(bool refresh);
|
void Update(bool refresh);
|
||||||
void UpdateWindow(int alpha, bool reset, bool canvasBeginDrawCalled = false);
|
void UpdateWindow(int alpha, bool reset, bool canvasBeginDrawCalled = false);
|
||||||
void UpdateWindowTransparency(int alpha);
|
void UpdateWindowTransparency(int alpha);
|
||||||
@@ -321,14 +321,14 @@ private:
|
|||||||
|
|
||||||
Gfx::Canvas* m_Canvas;
|
Gfx::Canvas* m_Canvas;
|
||||||
|
|
||||||
CConfigParser m_Parser;
|
ConfigParser m_Parser;
|
||||||
|
|
||||||
Gdiplus::Bitmap* m_Background;
|
Gdiplus::Bitmap* m_Background;
|
||||||
SIZE m_BackgroundSize;
|
SIZE m_BackgroundSize;
|
||||||
|
|
||||||
HWND m_Window;
|
HWND m_Window;
|
||||||
|
|
||||||
CMouse m_Mouse;
|
Mouse m_Mouse;
|
||||||
bool m_MouseOver;
|
bool m_MouseOver;
|
||||||
bool m_MouseInputRegistered;
|
bool m_MouseInputRegistered;
|
||||||
bool m_HasMouseScrollAction;
|
bool m_HasMouseScrollAction;
|
||||||
@@ -404,8 +404,8 @@ private:
|
|||||||
bool m_Hidden;
|
bool m_Hidden;
|
||||||
RESIZEMODE m_ResizeWindow;
|
RESIZEMODE m_ResizeWindow;
|
||||||
|
|
||||||
std::vector<CMeasure*> m_Measures;
|
std::vector<Measure*> m_Measures;
|
||||||
std::vector<CMeter*> m_Meters;
|
std::vector<Meter*> m_Meters;
|
||||||
|
|
||||||
const std::wstring m_FolderPath;
|
const std::wstring m_FolderPath;
|
||||||
const std::wstring m_FileName;
|
const std::wstring m_FileName;
|
||||||
|
|||||||
@@ -23,19 +23,19 @@
|
|||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "Mouse.h"
|
#include "Mouse.h"
|
||||||
|
|
||||||
CMouse::CMouse(CMeterWindow* meterWindow, CMeter* meter) : m_MeterWindow(meterWindow), m_Meter(meter),
|
Mouse::Mouse(MeterWindow* meterWindow, Meter* meter) : m_MeterWindow(meterWindow), m_Meter(meter),
|
||||||
m_CursorType(MOUSECURSOR_HAND),
|
m_CursorType(MOUSECURSOR_HAND),
|
||||||
m_CustomCursor(),
|
m_CustomCursor(),
|
||||||
m_CursorState(true)
|
m_CursorState(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CMouse::~CMouse()
|
Mouse::~Mouse()
|
||||||
{
|
{
|
||||||
DestroyCustomCursor();
|
DestroyCustomCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMouse::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void Mouse::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
DestroyCustomCursor();
|
DestroyCustomCursor();
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ void CMouse::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HCURSOR CMouse::GetCursor() const
|
HCURSOR Mouse::GetCursor() const
|
||||||
{
|
{
|
||||||
LPCWSTR name = IDC_ARROW;
|
LPCWSTR name = IDC_ARROW;
|
||||||
switch (m_CursorType)
|
switch (m_CursorType)
|
||||||
@@ -177,14 +177,14 @@ HCURSOR CMouse::GetCursor() const
|
|||||||
return LoadCursor(NULL, name);
|
return LoadCursor(NULL, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring CMouse::GetActionCommand(MOUSEACTION action) const
|
std::wstring Mouse::GetActionCommand(MOUSEACTION action) const
|
||||||
{
|
{
|
||||||
std::wstring command = m_MouseActions[action];
|
std::wstring command = m_MouseActions[action];
|
||||||
ReplaceMouseVariables(command);
|
ReplaceMouseVariables(command);
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMouse::DestroyCustomCursor()
|
void Mouse::DestroyCustomCursor()
|
||||||
{
|
{
|
||||||
if (m_CustomCursor)
|
if (m_CustomCursor)
|
||||||
{
|
{
|
||||||
@@ -193,7 +193,7 @@ void CMouse::DestroyCustomCursor()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMouse::ReplaceMouseVariables(std::wstring& result) const
|
void Mouse::ReplaceMouseVariables(std::wstring& result) const
|
||||||
{
|
{
|
||||||
// Check for variables ($VAR$)
|
// Check for variables ($VAR$)
|
||||||
size_t start = 0, end;
|
size_t start = 0, end;
|
||||||
@@ -244,7 +244,7 @@ void CMouse::ReplaceMouseVariables(std::wstring& result) const
|
|||||||
while (loop);
|
while (loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring CMouse::GetMouseVariable(const std::wstring& variable) const
|
std::wstring Mouse::GetMouseVariable(const std::wstring& variable) const
|
||||||
{
|
{
|
||||||
std::wstring result;
|
std::wstring result;
|
||||||
LPCWSTR var = variable.c_str();
|
LPCWSTR var = variable.c_str();
|
||||||
|
|||||||
@@ -60,13 +60,13 @@ enum MOUSECURSOR
|
|||||||
MOUSECURSOR_CUSTOM
|
MOUSECURSOR_CUSTOM
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMouse
|
class Mouse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMouse(CMeterWindow* meterWindow, CMeter* meter = NULL);
|
Mouse(MeterWindow* meterWindow, Meter* meter = NULL);
|
||||||
~CMouse();
|
~Mouse();
|
||||||
|
|
||||||
void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
MOUSECURSOR GetCursorType() const { return m_CursorType; }
|
MOUSECURSOR GetCursorType() const { return m_CursorType; }
|
||||||
HCURSOR GetCursor() const;
|
HCURSOR GetCursor() const;
|
||||||
@@ -142,8 +142,8 @@ private:
|
|||||||
HCURSOR m_CustomCursor;
|
HCURSOR m_CustomCursor;
|
||||||
bool m_CursorState;
|
bool m_CursorState;
|
||||||
|
|
||||||
CMeterWindow* m_MeterWindow;
|
MeterWindow* m_MeterWindow;
|
||||||
CMeter* m_Meter;
|
Meter* m_Meter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -53,10 +53,10 @@ struct GlobalOptions
|
|||||||
double netOutSpeed;
|
double netOutSpeed;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CConfigParser;
|
class ConfigParser;
|
||||||
class CTrayWindow;
|
class TrayWindow;
|
||||||
|
|
||||||
class CRainmeter
|
class Rainmeter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct SkinFolder
|
struct SkinFolder
|
||||||
@@ -90,8 +90,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CRainmeter();
|
Rainmeter();
|
||||||
~CRainmeter();
|
~Rainmeter();
|
||||||
|
|
||||||
int Initialize(LPCWSTR iniPath, LPCWSTR layout);
|
int Initialize(LPCWSTR iniPath, LPCWSTR layout);
|
||||||
bool IsAlreadyRunning();
|
bool IsAlreadyRunning();
|
||||||
@@ -99,22 +99,22 @@ public:
|
|||||||
|
|
||||||
void SetNetworkStatisticsTimer();
|
void SetNetworkStatisticsTimer();
|
||||||
|
|
||||||
CConfigParser* GetCurrentParser() { return m_CurrentParser; }
|
ConfigParser* GetCurrentParser() { return m_CurrentParser; }
|
||||||
void SetCurrentParser(CConfigParser* parser) { m_CurrentParser = parser; }
|
void SetCurrentParser(ConfigParser* parser) { m_CurrentParser = parser; }
|
||||||
|
|
||||||
CTrayWindow* GetTrayWindow() { return m_TrayWindow; }
|
TrayWindow* GetTrayWindow() { return m_TrayWindow; }
|
||||||
|
|
||||||
bool HasMeterWindow(const CMeterWindow* meterWindow) const;
|
bool HasMeterWindow(const MeterWindow* meterWindow) const;
|
||||||
|
|
||||||
CMeterWindow* GetMeterWindow(const std::wstring& folderPath);
|
MeterWindow* GetMeterWindow(const std::wstring& folderPath);
|
||||||
CMeterWindow* GetMeterWindowByINI(const std::wstring& ini_searching);
|
MeterWindow* GetMeterWindowByINI(const std::wstring& ini_searching);
|
||||||
std::pair<int, int> GetMeterWindowIndex(const std::wstring& folderPath, const std::wstring& file);
|
std::pair<int, int> GetMeterWindowIndex(const std::wstring& folderPath, const std::wstring& file);
|
||||||
std::pair<int, int> GetMeterWindowIndex(CMeterWindow* meterWindow) { return GetMeterWindowIndex(meterWindow->GetFolderPath(), meterWindow->GetFileName()); }
|
std::pair<int, int> GetMeterWindowIndex(MeterWindow* meterWindow) { return GetMeterWindowIndex(meterWindow->GetFolderPath(), meterWindow->GetFileName()); }
|
||||||
std::pair<int, int> GetMeterWindowIndex(UINT menuCommand);
|
std::pair<int, int> GetMeterWindowIndex(UINT menuCommand);
|
||||||
|
|
||||||
CMeterWindow* GetMeterWindow(HWND hwnd);
|
MeterWindow* GetMeterWindow(HWND hwnd);
|
||||||
void GetMeterWindowsByLoadOrder(std::multimap<int, CMeterWindow*>& windows, const std::wstring& group = std::wstring());
|
void GetMeterWindowsByLoadOrder(std::multimap<int, MeterWindow*>& windows, const std::wstring& group = std::wstring());
|
||||||
std::map<std::wstring, CMeterWindow*>& GetAllMeterWindows() { return m_MeterWindows; }
|
std::map<std::wstring, MeterWindow*>& GetAllMeterWindows() { return m_MeterWindows; }
|
||||||
|
|
||||||
std::wstring GetFolderPath(int folderIndex);
|
std::wstring GetFolderPath(int folderIndex);
|
||||||
int FindSkinFolderIndex(const std::wstring& folderPath);
|
int FindSkinFolderIndex(const std::wstring& folderPath);
|
||||||
@@ -122,12 +122,12 @@ public:
|
|||||||
const std::vector<SkinFolder>& GetFolders() { return m_SkinFolders; }
|
const std::vector<SkinFolder>& GetFolders() { return m_SkinFolders; }
|
||||||
const std::vector<std::wstring>& GetAllLayouts() { return m_Layouts; }
|
const std::vector<std::wstring>& GetAllLayouts() { return m_Layouts; }
|
||||||
|
|
||||||
void RemoveMeterWindow(CMeterWindow* meterWindow);
|
void RemoveMeterWindow(MeterWindow* meterWindow);
|
||||||
void AddUnmanagedMeterWindow(CMeterWindow* meterWindow);
|
void AddUnmanagedMeterWindow(MeterWindow* meterWindow);
|
||||||
void RemoveUnmanagedMeterWindow(CMeterWindow* meterWindow);
|
void RemoveUnmanagedMeterWindow(MeterWindow* meterWindow);
|
||||||
|
|
||||||
void ActivateSkin(int folderIndex, int fileIndex);
|
void ActivateSkin(int folderIndex, int fileIndex);
|
||||||
void DeactivateSkin(CMeterWindow* meterWindow, int folderIndex, bool save = true);
|
void DeactivateSkin(MeterWindow* meterWindow, int folderIndex, bool save = true);
|
||||||
void ToggleSkin(int folderIndex, int fileIndex);
|
void ToggleSkin(int folderIndex, int fileIndex);
|
||||||
|
|
||||||
const std::wstring& GetPath() { return m_Path; }
|
const std::wstring& GetPath() { return m_Path; }
|
||||||
@@ -196,15 +196,15 @@ public:
|
|||||||
int ShowMessage(HWND parent, const WCHAR* text, UINT type);
|
int ShowMessage(HWND parent, const WCHAR* text, UINT type);
|
||||||
|
|
||||||
bool IsMenuActive() { return m_MenuActive; }
|
bool IsMenuActive() { return m_MenuActive; }
|
||||||
void ShowContextMenu(POINT pos, CMeterWindow* meterWindow);
|
void ShowContextMenu(POINT pos, MeterWindow* meterWindow);
|
||||||
|
|
||||||
const std::wstring& GetTrayExecuteR() { return m_TrayExecuteR; }
|
const std::wstring& GetTrayExecuteR() { return m_TrayExecuteR; }
|
||||||
const std::wstring& GetTrayExecuteM() { return m_TrayExecuteM; }
|
const std::wstring& GetTrayExecuteM() { return m_TrayExecuteM; }
|
||||||
const std::wstring& GetTrayExecuteDR() { return m_TrayExecuteDR; }
|
const std::wstring& GetTrayExecuteDR() { return m_TrayExecuteDR; }
|
||||||
const std::wstring& GetTrayExecuteDM() { return m_TrayExecuteDM; }
|
const std::wstring& GetTrayExecuteDM() { return m_TrayExecuteDM; }
|
||||||
|
|
||||||
void ExecuteBang(const WCHAR* bang, std::vector<std::wstring>& args, CMeterWindow* meterWindow);
|
void ExecuteBang(const WCHAR* bang, std::vector<std::wstring>& args, MeterWindow* meterWindow);
|
||||||
void ExecuteCommand(const WCHAR* command, CMeterWindow* meterWindow, bool multi = true);
|
void ExecuteCommand(const WCHAR* command, MeterWindow* meterWindow, bool multi = true);
|
||||||
void DelayedExecuteCommand(const WCHAR* command);
|
void DelayedExecuteCommand(const WCHAR* command);
|
||||||
|
|
||||||
void RefreshAll();
|
void RefreshAll();
|
||||||
@@ -215,8 +215,8 @@ public:
|
|||||||
static std::wstring ExtractPath(const std::wstring& strFilePath);
|
static std::wstring ExtractPath(const std::wstring& strFilePath);
|
||||||
static void ExpandEnvironmentVariables(std::wstring& strPath);
|
static void ExpandEnvironmentVariables(std::wstring& strPath);
|
||||||
|
|
||||||
friend class CCommandHandler;
|
friend class CommandHandler;
|
||||||
friend class CDialogManage;
|
friend class DialogManage;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static LRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
@@ -232,7 +232,7 @@ private:
|
|||||||
void SetLoadOrder(int folderIndex, int order);
|
void SetLoadOrder(int folderIndex, int order);
|
||||||
int GetLoadOrder(const std::wstring& folderPath);
|
int GetLoadOrder(const std::wstring& folderPath);
|
||||||
void UpdateDesktopWorkArea(bool reset);
|
void UpdateDesktopWorkArea(bool reset);
|
||||||
HMENU CreateSkinMenu(CMeterWindow* meterWindow, int index, HMENU menu);
|
HMENU CreateSkinMenu(MeterWindow* meterWindow, int index, HMENU menu);
|
||||||
void ChangeSkinIndex(HMENU subMenu, int index);
|
void ChangeSkinIndex(HMENU subMenu, int index);
|
||||||
int ScanForSkinsRecursive(const std::wstring& path, std::wstring base, int index, UINT level);
|
int ScanForSkinsRecursive(const std::wstring& path, std::wstring base, int index, UINT level);
|
||||||
|
|
||||||
@@ -240,18 +240,18 @@ private:
|
|||||||
int CreateAllSkinsMenuRecursive(HMENU skinMenu, int index);
|
int CreateAllSkinsMenuRecursive(HMENU skinMenu, int index);
|
||||||
|
|
||||||
void CreateLayoutMenu(HMENU layoutMenu);
|
void CreateLayoutMenu(HMENU layoutMenu);
|
||||||
void CreateMonitorMenu(HMENU monitorMenu, CMeterWindow* meterWindow);
|
void CreateMonitorMenu(HMENU monitorMenu, MeterWindow* meterWindow);
|
||||||
void CreateOptionsFile();
|
void CreateOptionsFile();
|
||||||
void CreateDataFile();
|
void CreateDataFile();
|
||||||
void CreateComponentFolders(bool defaultIniLocation);
|
void CreateComponentFolders(bool defaultIniLocation);
|
||||||
void TestSettingsFile(bool bDefaultIniLocation);
|
void TestSettingsFile(bool bDefaultIniLocation);
|
||||||
|
|
||||||
CTrayWindow* m_TrayWindow;
|
TrayWindow* m_TrayWindow;
|
||||||
|
|
||||||
std::vector<SkinFolder> m_SkinFolders;
|
std::vector<SkinFolder> m_SkinFolders;
|
||||||
std::multimap<int, int> m_SkinOrders;
|
std::multimap<int, int> m_SkinOrders;
|
||||||
std::map<std::wstring, CMeterWindow*> m_MeterWindows;
|
std::map<std::wstring, MeterWindow*> m_MeterWindows;
|
||||||
std::list<CMeterWindow*> m_UnmanagedMeterWindows;
|
std::list<MeterWindow*> m_UnmanagedMeterWindows;
|
||||||
std::vector<std::wstring> m_Layouts;
|
std::vector<std::wstring> m_Layouts;
|
||||||
|
|
||||||
std::wstring m_Path;
|
std::wstring m_Path;
|
||||||
@@ -292,9 +292,9 @@ private:
|
|||||||
|
|
||||||
std::wstring m_SkinEditor;
|
std::wstring m_SkinEditor;
|
||||||
|
|
||||||
CCommandHandler m_CommandHandler;
|
CommandHandler m_CommandHandler;
|
||||||
|
|
||||||
CConfigParser* m_CurrentParser;
|
ConfigParser* m_CurrentParser;
|
||||||
|
|
||||||
HWND m_Window;
|
HWND m_Window;
|
||||||
|
|
||||||
|
|||||||
@@ -21,37 +21,37 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
class CRawString
|
class RawString
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CRawString() :
|
RawString() :
|
||||||
m_String()
|
m_String()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CRawString(const WCHAR* str) :
|
RawString(const WCHAR* str) :
|
||||||
m_String(str_alloc(str))
|
m_String(str_alloc(str))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CRawString(const CRawString& rhs) :
|
RawString(const RawString& rhs) :
|
||||||
m_String(str_alloc(rhs.c_str()))
|
m_String(str_alloc(rhs.c_str()))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~CRawString()
|
~RawString()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
CRawString& operator=(const WCHAR* rhs)
|
RawString& operator=(const WCHAR* rhs)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
m_String = str_alloc(rhs);
|
m_String = str_alloc(rhs);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CRawString& operator=(const CRawString& rhs)
|
RawString& operator=(const RawString& rhs)
|
||||||
{
|
{
|
||||||
if (&rhs != this)
|
if (&rhs != this)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,13 +21,13 @@
|
|||||||
#include "ConfigParser.h"
|
#include "ConfigParser.h"
|
||||||
#include "Rainmeter.h"
|
#include "Rainmeter.h"
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor
|
** The constructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CSection::CSection(CMeterWindow* meterWindow, const WCHAR* name) : m_MeterWindow(meterWindow), m_Name(name),
|
Section::Section(MeterWindow* meterWindow, const WCHAR* name) : m_MeterWindow(meterWindow), m_Name(name),
|
||||||
m_DynamicVariables(false),
|
m_DynamicVariables(false),
|
||||||
m_UpdateDivider(1),
|
m_UpdateDivider(1),
|
||||||
m_UpdateCounter(1)
|
m_UpdateCounter(1)
|
||||||
@@ -38,7 +38,7 @@ CSection::CSection(CMeterWindow* meterWindow, const WCHAR* name) : m_MeterWindow
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CSection::~CSection()
|
Section::~Section()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ CSection::~CSection()
|
|||||||
** call this base implementation if they overwrite this method.
|
** call this base implementation if they overwrite this method.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSection::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void Section::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
int updateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
|
int updateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
|
||||||
if (updateDivider != m_UpdateDivider)
|
if (updateDivider != m_UpdateDivider)
|
||||||
@@ -67,7 +67,7 @@ void CSection::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Updates the counter value
|
** Updates the counter value
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CSection::UpdateCounter()
|
bool Section::UpdateCounter()
|
||||||
{
|
{
|
||||||
++m_UpdateCounter;
|
++m_UpdateCounter;
|
||||||
if (m_UpdateCounter < m_UpdateDivider) return false;
|
if (m_UpdateCounter < m_UpdateDivider) return false;
|
||||||
@@ -80,10 +80,10 @@ bool CSection::UpdateCounter()
|
|||||||
** Execute OnUpdateAction if action is set
|
** Execute OnUpdateAction if action is set
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSection::DoUpdateAction()
|
void Section::DoUpdateAction()
|
||||||
{
|
{
|
||||||
if (!m_OnUpdateAction.empty())
|
if (!m_OnUpdateAction.empty())
|
||||||
{
|
{
|
||||||
Rainmeter->ExecuteCommand(m_OnUpdateAction.c_str(), m_MeterWindow);
|
g_Rainmeter->ExecuteCommand(m_OnUpdateAction.c_str(), m_MeterWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,13 +23,13 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
|
|
||||||
class CMeterWindow;
|
class MeterWindow;
|
||||||
class CConfigParser;
|
class ConfigParser;
|
||||||
|
|
||||||
class __declspec(novtable) CSection : public CGroup
|
class __declspec(novtable) Section : public Group
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~CSection();
|
virtual ~Section();
|
||||||
|
|
||||||
virtual UINT GetTypeID() = 0;
|
virtual UINT GetTypeID() = 0;
|
||||||
|
|
||||||
@@ -46,12 +46,12 @@ public:
|
|||||||
const std::wstring& GetOnUpdateAction() { return m_OnUpdateAction; }
|
const std::wstring& GetOnUpdateAction() { return m_OnUpdateAction; }
|
||||||
void DoUpdateAction();
|
void DoUpdateAction();
|
||||||
|
|
||||||
CMeterWindow* GetMeterWindow() { return m_MeterWindow; }
|
MeterWindow* GetMeterWindow() { return m_MeterWindow; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CSection(CMeterWindow* meterWindow, const WCHAR* name);
|
Section(MeterWindow* meterWindow, const WCHAR* name);
|
||||||
|
|
||||||
virtual void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
virtual void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
bool UpdateCounter();
|
bool UpdateCounter();
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ protected:
|
|||||||
|
|
||||||
std::wstring m_OnUpdateAction;
|
std::wstring m_OnUpdateAction;
|
||||||
|
|
||||||
CMeterWindow* m_MeterWindow;
|
MeterWindow* m_MeterWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -42,26 +42,26 @@ enum INTERVAL
|
|||||||
INTERVAL_RESUME = 1000
|
INTERVAL_RESUME = 1000
|
||||||
};
|
};
|
||||||
|
|
||||||
MultiMonitorInfo CSystem::c_Monitors = { 0 };
|
MultiMonitorInfo System::c_Monitors = { 0 };
|
||||||
|
|
||||||
HWND CSystem::c_Window = NULL;
|
HWND System::c_Window = NULL;
|
||||||
HWND CSystem::c_HelperWindow = NULL;
|
HWND System::c_HelperWindow = NULL;
|
||||||
|
|
||||||
HWINEVENTHOOK CSystem::c_WinEventHook = NULL;
|
HWINEVENTHOOK System::c_WinEventHook = NULL;
|
||||||
|
|
||||||
bool CSystem::c_ShowDesktop = false;
|
bool System::c_ShowDesktop = false;
|
||||||
|
|
||||||
std::wstring CSystem::c_WorkingDirectory;
|
std::wstring System::c_WorkingDirectory;
|
||||||
|
|
||||||
std::vector<std::wstring> CSystem::c_IniFileMappings;
|
std::vector<std::wstring> System::c_IniFileMappings;
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Creates a helper window to detect changes in the system.
|
** Creates a helper window to detect changes in the system.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSystem::Initialize(HINSTANCE instance)
|
void System::Initialize(HINSTANCE instance)
|
||||||
{
|
{
|
||||||
WNDCLASS wc = {0};
|
WNDCLASS wc = {0};
|
||||||
wc.lpfnWndProc = (WNDPROC)WndProc;
|
wc.lpfnWndProc = (WNDPROC)WndProc;
|
||||||
@@ -123,7 +123,7 @@ void CSystem::Initialize(HINSTANCE instance)
|
|||||||
** Destroys a window.
|
** Destroys a window.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSystem::Finalize()
|
void System::Finalize()
|
||||||
{
|
{
|
||||||
KillTimer(c_Window, TIMER_SHOWDESKTOP);
|
KillTimer(c_Window, TIMER_SHOWDESKTOP);
|
||||||
KillTimer(c_Window, TIMER_RESUME);
|
KillTimer(c_Window, TIMER_RESUME);
|
||||||
@@ -159,7 +159,7 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit
|
|||||||
info.cbSize = sizeof(MONITORINFOEX);
|
info.cbSize = sizeof(MONITORINFOEX);
|
||||||
GetMonitorInfo(hMonitor, &info);
|
GetMonitorInfo(hMonitor, &info);
|
||||||
|
|
||||||
if (Rainmeter->GetDebug())
|
if (g_Rainmeter->GetDebug())
|
||||||
{
|
{
|
||||||
LogDebug(info.szDevice);
|
LogDebug(info.szDevice);
|
||||||
LogDebugF(L" Flags : %s(0x%08X)", (info.dwFlags & MONITORINFOF_PRIMARY) ? L"PRIMARY " : L"", info.dwFlags);
|
LogDebugF(L" Flags : %s(0x%08X)", (info.dwFlags & MONITORINFOF_PRIMARY) ? L"PRIMARY " : L"", info.dwFlags);
|
||||||
@@ -225,7 +225,7 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit
|
|||||||
** Returns the number of monitors.
|
** Returns the number of monitors.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
size_t CSystem::GetMonitorCount()
|
size_t System::GetMonitorCount()
|
||||||
{
|
{
|
||||||
if (c_Monitors.monitors.empty())
|
if (c_Monitors.monitors.empty())
|
||||||
{
|
{
|
||||||
@@ -238,10 +238,10 @@ size_t CSystem::GetMonitorCount()
|
|||||||
** Sets the multi-monitor information.
|
** Sets the multi-monitor information.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSystem::SetMultiMonitorInfo()
|
void System::SetMultiMonitorInfo()
|
||||||
{
|
{
|
||||||
std::vector<MonitorInfo>& monitors = c_Monitors.monitors;
|
std::vector<MonitorInfo>& monitors = c_Monitors.monitors;
|
||||||
bool logging = Rainmeter->GetDebug();
|
bool logging = g_Rainmeter->GetDebug();
|
||||||
|
|
||||||
c_Monitors.vsT = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
c_Monitors.vsT = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||||
c_Monitors.vsL = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
c_Monitors.vsL = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||||
@@ -509,7 +509,7 @@ void CSystem::SetMultiMonitorInfo()
|
|||||||
** Updates the workarea information.
|
** Updates the workarea information.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSystem::UpdateWorkareaInfo()
|
void System::UpdateWorkareaInfo()
|
||||||
{
|
{
|
||||||
std::vector<MonitorInfo>& monitors = c_Monitors.monitors;
|
std::vector<MonitorInfo>& monitors = c_Monitors.monitors;
|
||||||
|
|
||||||
@@ -529,7 +529,7 @@ void CSystem::UpdateWorkareaInfo()
|
|||||||
|
|
||||||
(*iter).work = info.rcWork;
|
(*iter).work = info.rcWork;
|
||||||
|
|
||||||
if (Rainmeter->GetDebug())
|
if (g_Rainmeter->GetDebug())
|
||||||
{
|
{
|
||||||
LogDebugF(L"WorkArea@%i : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
|
LogDebugF(L"WorkArea@%i : L=%i, T=%i, R=%i, B=%i (W=%i, H=%i)",
|
||||||
i,
|
i,
|
||||||
@@ -544,7 +544,7 @@ void CSystem::UpdateWorkareaInfo()
|
|||||||
** Finds the Default Shell's window.
|
** Finds the Default Shell's window.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
HWND CSystem::GetDefaultShellWindow()
|
HWND System::GetDefaultShellWindow()
|
||||||
{
|
{
|
||||||
static HWND c_ShellW = NULL; // cache
|
static HWND c_ShellW = NULL; // cache
|
||||||
HWND ShellW = GetShellWindow();
|
HWND ShellW = GetShellWindow();
|
||||||
@@ -576,7 +576,7 @@ HWND CSystem::GetDefaultShellWindow()
|
|||||||
** If the WorkerW window is not active, returns NULL.
|
** If the WorkerW window is not active, returns NULL.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
HWND CSystem::GetWorkerW()
|
HWND System::GetWorkerW()
|
||||||
{
|
{
|
||||||
static HWND c_DefView = NULL; // cache
|
static HWND c_DefView = NULL; // cache
|
||||||
HWND ShellW = GetDefaultShellWindow();
|
HWND ShellW = GetDefaultShellWindow();
|
||||||
@@ -627,14 +627,14 @@ HWND CSystem::GetWorkerW()
|
|||||||
** ZPOSITION_BOTTOM, or ZPOSITION_NORMAL.
|
** ZPOSITION_BOTTOM, or ZPOSITION_NORMAL.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
HWND CSystem::GetBackmostTopWindow()
|
HWND System::GetBackmostTopWindow()
|
||||||
{
|
{
|
||||||
HWND winPos = c_HelperWindow;
|
HWND winPos = c_HelperWindow;
|
||||||
|
|
||||||
// Skip all ZPOSITION_ONDESKTOP, ZPOSITION_BOTTOM, and ZPOSITION_NORMAL windows
|
// Skip all ZPOSITION_ONDESKTOP, ZPOSITION_BOTTOM, and ZPOSITION_NORMAL windows
|
||||||
while (winPos = ::GetNextWindow(winPos, GW_HWNDPREV))
|
while (winPos = ::GetNextWindow(winPos, GW_HWNDPREV))
|
||||||
{
|
{
|
||||||
CMeterWindow* wnd = Rainmeter->GetMeterWindow(winPos);
|
MeterWindow* wnd = g_Rainmeter->GetMeterWindow(winPos);
|
||||||
if (!wnd ||
|
if (!wnd ||
|
||||||
(wnd->GetWindowZPosition() != ZPOSITION_NORMAL &&
|
(wnd->GetWindowZPosition() != ZPOSITION_NORMAL &&
|
||||||
wnd->GetWindowZPosition() != ZPOSITION_ONDESKTOP &&
|
wnd->GetWindowZPosition() != ZPOSITION_ONDESKTOP &&
|
||||||
@@ -651,7 +651,7 @@ HWND CSystem::GetBackmostTopWindow()
|
|||||||
** Checks whether the given windows belong to the same process.
|
** Checks whether the given windows belong to the same process.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CSystem::BelongToSameProcess(HWND hwndA, HWND hwndB)
|
bool System::BelongToSameProcess(HWND hwndA, HWND hwndB)
|
||||||
{
|
{
|
||||||
DWORD procAId = 0, procBId = 0;
|
DWORD procAId = 0, procBId = 0;
|
||||||
|
|
||||||
@@ -667,24 +667,24 @@ bool CSystem::BelongToSameProcess(HWND hwndA, HWND hwndB)
|
|||||||
*/
|
*/
|
||||||
BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
|
BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
|
||||||
{
|
{
|
||||||
bool logging = Rainmeter->GetDebug() && DEBUG_VERBOSE;
|
bool logging = g_Rainmeter->GetDebug() && DEBUG_VERBOSE;
|
||||||
const int classLen = _countof(METERWINDOW_CLASS_NAME) + (DEBUG_VERBOSE ? 32 : 1);
|
const int classLen = _countof(METERWINDOW_CLASS_NAME) + (DEBUG_VERBOSE ? 32 : 1);
|
||||||
WCHAR className[classLen];
|
WCHAR className[classLen];
|
||||||
CMeterWindow* Window;
|
MeterWindow* Window;
|
||||||
WCHAR flag;
|
WCHAR flag;
|
||||||
|
|
||||||
if (GetClassName(hwnd, className, classLen) > 0 &&
|
if (GetClassName(hwnd, className, classLen) > 0 &&
|
||||||
wcscmp(className, METERWINDOW_CLASS_NAME) == 0 &&
|
wcscmp(className, METERWINDOW_CLASS_NAME) == 0 &&
|
||||||
(Window = Rainmeter->GetMeterWindow(hwnd)))
|
(Window = g_Rainmeter->GetMeterWindow(hwnd)))
|
||||||
{
|
{
|
||||||
ZPOSITION zPos = Window->GetWindowZPosition();
|
ZPOSITION zPos = Window->GetWindowZPosition();
|
||||||
if (zPos == ZPOSITION_ONDESKTOP ||
|
if (zPos == ZPOSITION_ONDESKTOP ||
|
||||||
(zPos == ZPOSITION_NORMAL && Rainmeter->IsNormalStayDesktop()) ||
|
(zPos == ZPOSITION_NORMAL && g_Rainmeter->IsNormalStayDesktop()) ||
|
||||||
zPos == ZPOSITION_ONBOTTOM)
|
zPos == ZPOSITION_ONBOTTOM)
|
||||||
{
|
{
|
||||||
if (lParam)
|
if (lParam)
|
||||||
{
|
{
|
||||||
((std::vector<CMeterWindow*>*)lParam)->push_back(Window);
|
((std::vector<MeterWindow*>*)lParam)->push_back(Window);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logging) flag = L'+';
|
if (logging) flag = L'+';
|
||||||
@@ -704,7 +704,7 @@ BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
if (logging)
|
if (logging)
|
||||||
{
|
{
|
||||||
flag = (hwnd == CSystem::GetHelperWindow()) ? L'o' : ' ';
|
flag = (hwnd == System::GetHelperWindow()) ? L'o' : ' ';
|
||||||
LogDebugF(L"%c [%c] 0x%p : %s", flag, IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className);
|
LogDebugF(L"%c [%c] 0x%p : %s", flag, IsWindowVisible(hwnd) ? L'V' : L'H', hwnd, className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -716,10 +716,10 @@ BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
|
|||||||
** Arranges the meter window in Z-order.
|
** Arranges the meter window in Z-order.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSystem::ChangeZPosInOrder()
|
void System::ChangeZPosInOrder()
|
||||||
{
|
{
|
||||||
bool logging = Rainmeter->GetDebug() && DEBUG_VERBOSE;
|
bool logging = g_Rainmeter->GetDebug() && DEBUG_VERBOSE;
|
||||||
std::vector<CMeterWindow*> windowsInZOrder;
|
std::vector<MeterWindow*> windowsInZOrder;
|
||||||
|
|
||||||
if (logging) LogDebug(L"1: ----- BEFORE -----");
|
if (logging) LogDebug(L"1: ----- BEFORE -----");
|
||||||
|
|
||||||
@@ -729,7 +729,7 @@ void CSystem::ChangeZPosInOrder()
|
|||||||
auto resetZPos = [&](ZPOSITION zpos)
|
auto resetZPos = [&](ZPOSITION zpos)
|
||||||
{
|
{
|
||||||
// Reset ZPos in Z-order (Bottom)
|
// Reset ZPos in Z-order (Bottom)
|
||||||
std::vector<CMeterWindow*>::const_iterator iter = windowsInZOrder.begin();
|
std::vector<MeterWindow*>::const_iterator iter = windowsInZOrder.begin();
|
||||||
for ( ; iter != windowsInZOrder.end(); ++iter)
|
for ( ; iter != windowsInZOrder.end(); ++iter)
|
||||||
{
|
{
|
||||||
if ((*iter)->GetWindowZPosition() == zpos)
|
if ((*iter)->GetWindowZPosition() == zpos)
|
||||||
@@ -739,7 +739,7 @@ void CSystem::ChangeZPosInOrder()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Rainmeter->IsNormalStayDesktop())
|
if (g_Rainmeter->IsNormalStayDesktop())
|
||||||
{
|
{
|
||||||
resetZPos(ZPOSITION_NORMAL);
|
resetZPos(ZPOSITION_NORMAL);
|
||||||
}
|
}
|
||||||
@@ -764,9 +764,9 @@ void CSystem::ChangeZPosInOrder()
|
|||||||
** Moves the helper window to the reference position.
|
** Moves the helper window to the reference position.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSystem::PrepareHelperWindow(HWND WorkerW)
|
void System::PrepareHelperWindow(HWND WorkerW)
|
||||||
{
|
{
|
||||||
bool logging = Rainmeter->GetDebug() && DEBUG_VERBOSE;
|
bool logging = g_Rainmeter->GetDebug() && DEBUG_VERBOSE;
|
||||||
|
|
||||||
SetWindowPos(c_Window, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS); // always on bottom
|
SetWindowPos(c_Window, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS); // always on bottom
|
||||||
|
|
||||||
@@ -834,7 +834,7 @@ void CSystem::PrepareHelperWindow(HWND WorkerW)
|
|||||||
** Changes the "Show Desktop" state.
|
** Changes the "Show Desktop" state.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CSystem::CheckDesktopState(HWND WorkerW)
|
bool System::CheckDesktopState(HWND WorkerW)
|
||||||
{
|
{
|
||||||
HWND hwnd = NULL;
|
HWND hwnd = NULL;
|
||||||
|
|
||||||
@@ -849,7 +849,7 @@ bool CSystem::CheckDesktopState(HWND WorkerW)
|
|||||||
{
|
{
|
||||||
c_ShowDesktop = !c_ShowDesktop;
|
c_ShowDesktop = !c_ShowDesktop;
|
||||||
|
|
||||||
if (Rainmeter->GetDebug())
|
if (g_Rainmeter->GetDebug())
|
||||||
{
|
{
|
||||||
LogDebugF(L"System: \"Show %s\" has been detected.",
|
LogDebugF(L"System: \"Show %s\" has been detected.",
|
||||||
c_ShowDesktop ? L"desktop" : L"open windows");
|
c_ShowDesktop ? L"desktop" : L"open windows");
|
||||||
@@ -876,7 +876,7 @@ bool CSystem::CheckDesktopState(HWND WorkerW)
|
|||||||
** The event hook procedure
|
** The event hook procedure
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CALLBACK CSystem::MyWinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime)
|
void CALLBACK System::MyWinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime)
|
||||||
{
|
{
|
||||||
if (event == EVENT_SYSTEM_FOREGROUND)
|
if (event == EVENT_SYSTEM_FOREGROUND)
|
||||||
{
|
{
|
||||||
@@ -914,7 +914,7 @@ void CALLBACK CSystem::MyWinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event,
|
|||||||
** The window procedure
|
** The window procedure
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK System::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (hWnd != c_Window)
|
if (hWnd != c_Window)
|
||||||
{
|
{
|
||||||
@@ -944,10 +944,10 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
|
|
||||||
case TIMER_RESUME:
|
case TIMER_RESUME:
|
||||||
KillTimer(hWnd, TIMER_RESUME);
|
KillTimer(hWnd, TIMER_RESUME);
|
||||||
if (Rainmeter->IsRedrawable())
|
if (g_Rainmeter->IsRedrawable())
|
||||||
{
|
{
|
||||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
|
std::map<std::wstring, MeterWindow*>::const_iterator iter = g_Rainmeter->GetAllMeterWindows().begin();
|
||||||
for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
|
for ( ; iter != g_Rainmeter->GetAllMeterWindows().end(); ++iter)
|
||||||
{
|
{
|
||||||
(*iter).second->RedrawWindow();
|
(*iter).second->RedrawWindow();
|
||||||
}
|
}
|
||||||
@@ -959,7 +959,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
case WM_DISPLAYCHANGE:
|
case WM_DISPLAYCHANGE:
|
||||||
LogNotice(L"System: Display settings changed");
|
LogNotice(L"System: Display settings changed");
|
||||||
ClearMultiMonitorInfo();
|
ClearMultiMonitorInfo();
|
||||||
CConfigParser::ClearMultiMonitorVariables();
|
ConfigParser::ClearMultiMonitorVariables();
|
||||||
case WM_SETTINGCHANGE:
|
case WM_SETTINGCHANGE:
|
||||||
if (uMsg == WM_DISPLAYCHANGE || (/*uMsg == WM_SETTINGCHANGE &&*/ wParam == SPI_SETWORKAREA))
|
if (uMsg == WM_DISPLAYCHANGE || (/*uMsg == WM_SETTINGCHANGE &&*/ wParam == SPI_SETWORKAREA))
|
||||||
{
|
{
|
||||||
@@ -967,12 +967,12 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
{
|
{
|
||||||
LogNotice(L"System: Work area changed");
|
LogNotice(L"System: Work area changed");
|
||||||
UpdateWorkareaInfo();
|
UpdateWorkareaInfo();
|
||||||
CConfigParser::UpdateWorkareaVariables();
|
ConfigParser::UpdateWorkareaVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deliver WM_DISPLAYCHANGE / WM_SETTINGCHANGE message to all meter windows
|
// Deliver WM_DISPLAYCHANGE / WM_SETTINGCHANGE message to all meter windows
|
||||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
|
std::map<std::wstring, MeterWindow*>::const_iterator iter = g_Rainmeter->GetAllMeterWindows().begin();
|
||||||
for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
|
for ( ; iter != g_Rainmeter->GetAllMeterWindows().end(); ++iter)
|
||||||
{
|
{
|
||||||
PostMessage((*iter).second->GetWindow(), WM_METERWINDOW_DELAYED_MOVE, (WPARAM)uMsg, (LPARAM)0);
|
PostMessage((*iter).second->GetWindow(), WM_METERWINDOW_DELAYED_MOVE, (WPARAM)uMsg, (LPARAM)0);
|
||||||
}
|
}
|
||||||
@@ -999,7 +999,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
** In XP, returns the predictive value due to the 32bit limitation.
|
** In XP, returns the predictive value due to the 32bit limitation.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
ULONGLONG CSystem::GetTickCount64()
|
ULONGLONG System::GetTickCount64()
|
||||||
{
|
{
|
||||||
typedef ULONGLONG (WINAPI * FPGETTICKCOUNT64)();
|
typedef ULONGLONG (WINAPI * FPGETTICKCOUNT64)();
|
||||||
static FPGETTICKCOUNT64 c_GetTickCount64 = (FPGETTICKCOUNT64)GetProcAddress(GetModuleHandle(L"kernel32"), "GetTickCount64");
|
static FPGETTICKCOUNT64 c_GetTickCount64 = (FPGETTICKCOUNT64)GetProcAddress(GetModuleHandle(L"kernel32"), "GetTickCount64");
|
||||||
@@ -1022,7 +1022,7 @@ ULONGLONG CSystem::GetTickCount64()
|
|||||||
** Gets the cursor position in last message retrieved by GetMessage().
|
** Gets the cursor position in last message retrieved by GetMessage().
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
POINT CSystem::GetCursorPosition()
|
POINT System::GetCursorPosition()
|
||||||
{
|
{
|
||||||
DWORD pos = GetMessagePos();
|
DWORD pos = GetMessagePos();
|
||||||
POINT pt = { GET_X_LPARAM(pos), GET_Y_LPARAM(pos) };
|
POINT pt = { GET_X_LPARAM(pos), GET_Y_LPARAM(pos) };
|
||||||
@@ -1033,7 +1033,7 @@ POINT CSystem::GetCursorPosition()
|
|||||||
** Checks if file is writable.
|
** Checks if file is writable.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CSystem::IsFileWritable(LPCWSTR file)
|
bool System::IsFileWritable(LPCWSTR file)
|
||||||
{
|
{
|
||||||
HANDLE hFile = CreateFile(file, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
HANDLE hFile = CreateFile(file, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
@@ -1051,7 +1051,7 @@ bool CSystem::IsFileWritable(LPCWSTR file)
|
|||||||
** Avoids loading a DLL from current directory.
|
** Avoids loading a DLL from current directory.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
HMODULE CSystem::RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError)
|
HMODULE System::RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError)
|
||||||
{
|
{
|
||||||
// Remove current directory from DLL search path
|
// Remove current directory from DLL search path
|
||||||
SetDllDirectory(L"");
|
SetDllDirectory(L"");
|
||||||
@@ -1071,7 +1071,7 @@ HMODULE CSystem::RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError)
|
|||||||
** Resets working directory to default.
|
** Resets working directory to default.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSystem::ResetWorkingDirectory()
|
void System::ResetWorkingDirectory()
|
||||||
{
|
{
|
||||||
WCHAR directory[MAX_PATH] = {0};
|
WCHAR directory[MAX_PATH] = {0};
|
||||||
GetCurrentDirectory(MAX_PATH, directory);
|
GetCurrentDirectory(MAX_PATH, directory);
|
||||||
@@ -1088,7 +1088,7 @@ void CSystem::ResetWorkingDirectory()
|
|||||||
** For more details: http://stackoverflow.com/questions/804848/critical-sections-leaking-memory-on-vista-win2008/
|
** For more details: http://stackoverflow.com/questions/804848/critical-sections-leaking-memory-on-vista-win2008/
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSystem::InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
void System::InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||||
{
|
{
|
||||||
typedef BOOL (WINAPI * FPINITCRITEX)(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags);
|
typedef BOOL (WINAPI * FPINITCRITEX)(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags);
|
||||||
static FPINITCRITEX InitializeCriticalSectionEx = Platform::IsAtLeastWinVista() ?
|
static FPINITCRITEX InitializeCriticalSectionEx = Platform::IsAtLeastWinVista() ?
|
||||||
@@ -1109,7 +1109,7 @@ void CSystem::InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
|||||||
** Sets clipboard text to given string.
|
** Sets clipboard text to given string.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSystem::SetClipboardText(const std::wstring& text)
|
void System::SetClipboardText(const std::wstring& text)
|
||||||
{
|
{
|
||||||
if (OpenClipboard(NULL))
|
if (OpenClipboard(NULL))
|
||||||
{
|
{
|
||||||
@@ -1138,7 +1138,7 @@ void CSystem::SetClipboardText(const std::wstring& text)
|
|||||||
** Sets the system wallpapar.
|
** Sets the system wallpapar.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSystem::SetWallpaper(const std::wstring& wallpaper, const std::wstring& style)
|
void System::SetWallpaper(const std::wstring& wallpaper, const std::wstring& style)
|
||||||
{
|
{
|
||||||
if (!wallpaper.empty())
|
if (!wallpaper.empty())
|
||||||
{
|
{
|
||||||
@@ -1151,7 +1151,7 @@ void CSystem::SetWallpaper(const std::wstring& wallpaper, const std::wstring& st
|
|||||||
Bitmap* bitmap = Bitmap::FromFile(wallpaper.c_str());
|
Bitmap* bitmap = Bitmap::FromFile(wallpaper.c_str());
|
||||||
if (bitmap && bitmap->GetLastStatus() == Ok)
|
if (bitmap && bitmap->GetLastStatus() == Ok)
|
||||||
{
|
{
|
||||||
std::wstring file = Rainmeter->GetSettingsPath() + L"Wallpaper.bmp";
|
std::wstring file = g_Rainmeter->GetSettingsPath() + L"Wallpaper.bmp";
|
||||||
|
|
||||||
const CLSID bmpClsid = { 0x557cf400, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } };
|
const CLSID bmpClsid = { 0x557cf400, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } };
|
||||||
if (bitmap->Save(file.c_str(), &bmpClsid) == Ok)
|
if (bitmap->Save(file.c_str(), &bmpClsid) == Ok)
|
||||||
@@ -1214,7 +1214,7 @@ void CSystem::SetWallpaper(const std::wstring& wallpaper, const std::wstring& st
|
|||||||
** Copies files and folders from one location to another.
|
** Copies files and folders from one location to another.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CSystem::CopyFiles(std::wstring from, std::wstring to, bool bMove)
|
bool System::CopyFiles(std::wstring from, std::wstring to, bool bMove)
|
||||||
{
|
{
|
||||||
// If given "from" path ends with path separator, remove it (Workaround for XP: error code 1026)
|
// If given "from" path ends with path separator, remove it (Workaround for XP: error code 1026)
|
||||||
size_t len;
|
size_t len;
|
||||||
@@ -1249,7 +1249,7 @@ bool CSystem::CopyFiles(std::wstring from, std::wstring to, bool bMove)
|
|||||||
** Removes a file even if a file is read-only.
|
** Removes a file even if a file is read-only.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CSystem::RemoveFile(const std::wstring& file)
|
bool System::RemoveFile(const std::wstring& file)
|
||||||
{
|
{
|
||||||
DWORD attr = GetFileAttributes(file.c_str());
|
DWORD attr = GetFileAttributes(file.c_str());
|
||||||
if (attr == -1 || (attr & FILE_ATTRIBUTE_READONLY))
|
if (attr == -1 || (attr & FILE_ATTRIBUTE_READONLY))
|
||||||
@@ -1265,7 +1265,7 @@ bool CSystem::RemoveFile(const std::wstring& file)
|
|||||||
** Recursively removes folder.
|
** Recursively removes folder.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CSystem::RemoveFolder(std::wstring folder)
|
bool System::RemoveFolder(std::wstring folder)
|
||||||
{
|
{
|
||||||
// The strings must end with double nul
|
// The strings must end with double nul
|
||||||
folder.append(1, L'\0');
|
folder.append(1, L'\0');
|
||||||
@@ -1292,7 +1292,7 @@ bool CSystem::RemoveFolder(std::wstring folder)
|
|||||||
** Retrieves the "IniFileMapping" entries from Registry.
|
** Retrieves the "IniFileMapping" entries from Registry.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CSystem::UpdateIniFileMappingList()
|
void System::UpdateIniFileMappingList()
|
||||||
{
|
{
|
||||||
static ULONGLONG s_LastWriteTime = 0;
|
static ULONGLONG s_LastWriteTime = 0;
|
||||||
|
|
||||||
@@ -1358,7 +1358,7 @@ void CSystem::UpdateIniFileMappingList()
|
|||||||
** Note that a temporary file must be deleted by caller.
|
** Note that a temporary file must be deleted by caller.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
std::wstring CSystem::GetTemporaryFile(const std::wstring& iniFile)
|
std::wstring System::GetTemporaryFile(const std::wstring& iniFile)
|
||||||
{
|
{
|
||||||
std::wstring temporary;
|
std::wstring temporary;
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ struct MultiMonitorInfo
|
|||||||
std::vector<MonitorInfo> monitors;
|
std::vector<MonitorInfo> monitors;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSystem
|
class System
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Initialize(HINSTANCE instance);
|
static void Initialize(HINSTANCE instance);
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ std::unordered_map<std::wstring, ImageCachePool::ImageCache*> ImageCachePool::c_
|
|||||||
#define CONVERT_TO_RADIANS(X) ((X) * (PI / 180.0f))
|
#define CONVERT_TO_RADIANS(X) ((X) * (PI / 180.0f))
|
||||||
|
|
||||||
// GrayScale Matrix
|
// GrayScale Matrix
|
||||||
const Gdiplus::ColorMatrix CTintedImage::c_GreyScaleMatrix = {
|
const Gdiplus::ColorMatrix TintedImage::c_GreyScaleMatrix = {
|
||||||
0.299f, 0.299f, 0.299f, 0.0f, 0.0f,
|
0.299f, 0.299f, 0.299f, 0.0f, 0.0f,
|
||||||
0.587f, 0.587f, 0.587f, 0.0f, 0.0f,
|
0.587f, 0.587f, 0.587f, 0.0f, 0.0f,
|
||||||
0.114f, 0.114f, 0.114f, 0.0f, 0.0f,
|
0.114f, 0.114f, 0.114f, 0.0f, 0.0f,
|
||||||
@@ -135,7 +135,7 @@ const Gdiplus::ColorMatrix CTintedImage::c_GreyScaleMatrix = {
|
|||||||
0.0f, 0.0f, 0.0f, 0.0f, 1.0f
|
0.0f, 0.0f, 0.0f, 0.0f, 1.0f
|
||||||
};
|
};
|
||||||
|
|
||||||
const Gdiplus::ColorMatrix CTintedImage::c_IdentityMatrix = {
|
const Gdiplus::ColorMatrix TintedImage::c_IdentityMatrix = {
|
||||||
1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||||
0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
|
0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
|
||||||
0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
|
0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
|
||||||
@@ -143,7 +143,7 @@ const Gdiplus::ColorMatrix CTintedImage::c_IdentityMatrix = {
|
|||||||
0.0f, 0.0f, 0.0f, 0.0f, 1.0f
|
0.0f, 0.0f, 0.0f, 0.0f, 1.0f
|
||||||
};
|
};
|
||||||
|
|
||||||
CTintedImageHelper_DefineOptionArray(CTintedImage::c_DefaultOptionArray, L"");
|
TintedImageHelper_DefineOptionArray(TintedImage::c_DefaultOptionArray, L"");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The constructor.
|
** The constructor.
|
||||||
@@ -151,7 +151,7 @@ CTintedImageHelper_DefineOptionArray(CTintedImage::c_DefaultOptionArray, L"");
|
|||||||
** If disableTransform is true, ImageCrop and ImageRotate are ignored.
|
** If disableTransform is true, ImageCrop and ImageRotate are ignored.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CTintedImage::CTintedImage(const WCHAR* name, const WCHAR** optionArray, bool disableTransform) : m_DisableTransform(disableTransform),
|
TintedImage::TintedImage(const WCHAR* name, const WCHAR** optionArray, bool disableTransform) : m_DisableTransform(disableTransform),
|
||||||
m_Name(name ? name : L"Image"),
|
m_Name(name ? name : L"Image"),
|
||||||
m_OptionArray(optionArray ? optionArray : c_DefaultOptionArray),
|
m_OptionArray(optionArray ? optionArray : c_DefaultOptionArray),
|
||||||
m_Bitmap(),
|
m_Bitmap(),
|
||||||
@@ -173,7 +173,7 @@ CTintedImage::CTintedImage(const WCHAR* name, const WCHAR** optionArray, bool di
|
|||||||
** The destructor
|
** The destructor
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
CTintedImage::~CTintedImage()
|
TintedImage::~TintedImage()
|
||||||
{
|
{
|
||||||
DisposeImage();
|
DisposeImage();
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ CTintedImage::~CTintedImage()
|
|||||||
** Disposes the image buffers.
|
** Disposes the image buffers.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CTintedImage::DisposeImage()
|
void TintedImage::DisposeImage()
|
||||||
{
|
{
|
||||||
delete m_BitmapTint;
|
delete m_BitmapTint;
|
||||||
m_BitmapTint = NULL;
|
m_BitmapTint = NULL;
|
||||||
@@ -202,7 +202,7 @@ void CTintedImage::DisposeImage()
|
|||||||
** Loads the image from file handle
|
** Loads the image from file handle
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
Bitmap* CTintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize, HGLOBAL* phBuffer)
|
Bitmap* TintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize, HGLOBAL* phBuffer)
|
||||||
{
|
{
|
||||||
HGLOBAL hBuffer = ::GlobalAlloc(GMEM_MOVEABLE, fileSize);
|
HGLOBAL hBuffer = ::GlobalAlloc(GMEM_MOVEABLE, fileSize);
|
||||||
if (hBuffer)
|
if (hBuffer)
|
||||||
@@ -310,7 +310,7 @@ Bitmap* CTintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize,
|
|||||||
** Loads the image from disk
|
** Loads the image from disk
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CTintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
|
void TintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
|
||||||
{
|
{
|
||||||
// Load the bitmap if defined
|
// Load the bitmap if defined
|
||||||
if (!imageName.empty())
|
if (!imageName.empty())
|
||||||
@@ -426,7 +426,7 @@ void CTintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways)
|
|||||||
** This will apply the cropping.
|
** This will apply the cropping.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CTintedImage::ApplyCrop()
|
void TintedImage::ApplyCrop()
|
||||||
{
|
{
|
||||||
if (m_Crop.Width >= 0 && m_Crop.Height >= 0)
|
if (m_Crop.Width >= 0 && m_Crop.Height >= 0)
|
||||||
{
|
{
|
||||||
@@ -483,7 +483,7 @@ void CTintedImage::ApplyCrop()
|
|||||||
** This will apply the Greyscale matrix and the color tinting.
|
** This will apply the Greyscale matrix and the color tinting.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CTintedImage::ApplyTint()
|
void TintedImage::ApplyTint()
|
||||||
{
|
{
|
||||||
bool useColorMatrix = !CompareColorMatrix(m_ColorMatrix, &c_IdentityMatrix);
|
bool useColorMatrix = !CompareColorMatrix(m_ColorMatrix, &c_IdentityMatrix);
|
||||||
|
|
||||||
@@ -529,7 +529,7 @@ void CTintedImage::ApplyTint()
|
|||||||
** Note that the returned bitmap image must be freed by caller.
|
** Note that the returned bitmap image must be freed by caller.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
Bitmap* CTintedImage::TurnGreyscale(Bitmap* source)
|
Bitmap* TintedImage::TurnGreyscale(Bitmap* source)
|
||||||
{
|
{
|
||||||
ImageAttributes ImgAttr;
|
ImageAttributes ImgAttr;
|
||||||
ImgAttr.SetColorMatrix(&c_GreyScaleMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
|
ImgAttr.SetColorMatrix(&c_GreyScaleMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
|
||||||
@@ -548,7 +548,7 @@ Bitmap* CTintedImage::TurnGreyscale(Bitmap* source)
|
|||||||
** This will apply the flipping and rotating.
|
** This will apply the flipping and rotating.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CTintedImage::ApplyTransform()
|
void TintedImage::ApplyTransform()
|
||||||
{
|
{
|
||||||
if (m_Rotate != 0.0f)
|
if (m_Rotate != 0.0f)
|
||||||
{
|
{
|
||||||
@@ -615,7 +615,7 @@ void CTintedImage::ApplyTransform()
|
|||||||
** Read the meter-specific options from the ini-file.
|
** Read the meter-specific options from the ini-file.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CTintedImage::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
void TintedImage::ReadOptions(ConfigParser& parser, const WCHAR* section)
|
||||||
{
|
{
|
||||||
// Store the current values so we know if the image needs to be tinted or transformed
|
// Store the current values so we know if the image needs to be tinted or transformed
|
||||||
Rect oldCrop = m_Crop;
|
Rect oldCrop = m_Crop;
|
||||||
@@ -792,7 +792,7 @@ void CTintedImage::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
** Compares the two given color matrices.
|
** Compares the two given color matrices.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CTintedImage::CompareColorMatrix(const Gdiplus::ColorMatrix* a, const Gdiplus::ColorMatrix* b)
|
bool TintedImage::CompareColorMatrix(const Gdiplus::ColorMatrix* a, const Gdiplus::ColorMatrix* b)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 5; ++i)
|
for (int i = 0; i < 5; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
** Helper macro to define an array of option names. A prefix must be given.
|
** Helper macro to define an array of option names. A prefix must be given.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
#define CTintedImageHelper_DefineOptionArray(name, prefix) \
|
#define TintedImageHelper_DefineOptionArray(name, prefix) \
|
||||||
const WCHAR* (name)[CTintedImage::OptionCount] = { \
|
const WCHAR* (name)[TintedImage::OptionCount] = { \
|
||||||
prefix L"ImageCrop", \
|
prefix L"ImageCrop", \
|
||||||
prefix L"Greyscale", \
|
prefix L"Greyscale", \
|
||||||
prefix L"ImageTint", \
|
prefix L"ImageTint", \
|
||||||
@@ -43,9 +43,9 @@
|
|||||||
prefix L"UseExifOrientation" \
|
prefix L"UseExifOrientation" \
|
||||||
};
|
};
|
||||||
|
|
||||||
class CConfigParser;
|
class ConfigParser;
|
||||||
|
|
||||||
class CTintedImage
|
class TintedImage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum OptionIndex
|
enum OptionIndex
|
||||||
@@ -66,10 +66,10 @@ public:
|
|||||||
OptionCount
|
OptionCount
|
||||||
};
|
};
|
||||||
|
|
||||||
CTintedImage(const WCHAR* name = L"Image", const WCHAR** optionArray = c_DefaultOptionArray, bool disableTransform = false);
|
TintedImage(const WCHAR* name = L"Image", const WCHAR** optionArray = c_DefaultOptionArray, bool disableTransform = false);
|
||||||
~CTintedImage();
|
~TintedImage();
|
||||||
|
|
||||||
void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
void ReadOptions(ConfigParser& parser, const WCHAR* section);
|
||||||
|
|
||||||
bool IsLoaded() { return (m_Bitmap != NULL); }
|
bool IsLoaded() { return (m_Bitmap != NULL); }
|
||||||
bool IsTinted() { return (m_BitmapTint != NULL); }
|
bool IsTinted() { return (m_BitmapTint != NULL); }
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ enum INTERVAL
|
|||||||
|
|
||||||
const UINT WM_TASKBARCREATED = ::RegisterWindowMessage(L"TaskbarCreated");
|
const UINT WM_TASKBARCREATED = ::RegisterWindowMessage(L"TaskbarCreated");
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
using namespace Gdiplus;
|
using namespace Gdiplus;
|
||||||
|
|
||||||
CTrayWindow::CTrayWindow() :
|
TrayWindow::TrayWindow() :
|
||||||
m_Icon(),
|
m_Icon(),
|
||||||
m_Measure(),
|
m_Measure(),
|
||||||
m_MeterType(TRAY_METER_TYPE_HISTOGRAM),
|
m_MeterType(TRAY_METER_TYPE_HISTOGRAM),
|
||||||
@@ -67,7 +67,7 @@ CTrayWindow::CTrayWindow() :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CTrayWindow::~CTrayWindow()
|
TrayWindow::~TrayWindow()
|
||||||
{
|
{
|
||||||
KillTimer(m_Window, TIMER_ADDTRAYICON);
|
KillTimer(m_Window, TIMER_ADDTRAYICON);
|
||||||
KillTimer(m_Window, TIMER_TRAYMEASURE);
|
KillTimer(m_Window, TIMER_TRAYMEASURE);
|
||||||
@@ -85,11 +85,11 @@ CTrayWindow::~CTrayWindow()
|
|||||||
if (m_Window) DestroyWindow(m_Window);
|
if (m_Window) DestroyWindow(m_Window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::Initialize()
|
void TrayWindow::Initialize()
|
||||||
{
|
{
|
||||||
WNDCLASS wc = {0};
|
WNDCLASS wc = {0};
|
||||||
wc.lpfnWndProc = (WNDPROC)WndProc;
|
wc.lpfnWndProc = (WNDPROC)WndProc;
|
||||||
wc.hInstance = Rainmeter->GetInstance();
|
wc.hInstance = g_Rainmeter->GetInstance();
|
||||||
wc.lpszClassName = L"RainmeterTrayClass";
|
wc.lpszClassName = L"RainmeterTrayClass";
|
||||||
wc.hIcon = GetIcon(IDI_RAINMETER);
|
wc.hIcon = GetIcon(IDI_RAINMETER);
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ void CTrayWindow::Initialize()
|
|||||||
SetWindowPos(m_Window, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS);
|
SetWindowPos(m_Window, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTrayWindow::AddTrayIcon()
|
bool TrayWindow::AddTrayIcon()
|
||||||
{
|
{
|
||||||
NOTIFYICONDATA tnid = {sizeof(NOTIFYICONDATA)};
|
NOTIFYICONDATA tnid = {sizeof(NOTIFYICONDATA)};
|
||||||
tnid.hWnd = m_Window;
|
tnid.hWnd = m_Window;
|
||||||
@@ -125,7 +125,7 @@ bool CTrayWindow::AddTrayIcon()
|
|||||||
return (Shell_NotifyIcon(NIM_ADD, &tnid) || GetLastError() != ERROR_TIMEOUT);
|
return (Shell_NotifyIcon(NIM_ADD, &tnid) || GetLastError() != ERROR_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTrayWindow::IsTrayIconReady()
|
bool TrayWindow::IsTrayIconReady()
|
||||||
{
|
{
|
||||||
NOTIFYICONDATA tnid = {sizeof(NOTIFYICONDATA)};
|
NOTIFYICONDATA tnid = {sizeof(NOTIFYICONDATA)};
|
||||||
tnid.hWnd = m_Window;
|
tnid.hWnd = m_Window;
|
||||||
@@ -134,7 +134,7 @@ bool CTrayWindow::IsTrayIconReady()
|
|||||||
return Shell_NotifyIcon(NIM_MODIFY, &tnid);
|
return Shell_NotifyIcon(NIM_MODIFY, &tnid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::TryAddTrayIcon()
|
void TrayWindow::TryAddTrayIcon()
|
||||||
{
|
{
|
||||||
if (IsTrayIconReady())
|
if (IsTrayIconReady())
|
||||||
{
|
{
|
||||||
@@ -156,7 +156,7 @@ void CTrayWindow::TryAddTrayIcon()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::CheckTrayIcon()
|
void TrayWindow::CheckTrayIcon()
|
||||||
{
|
{
|
||||||
if (IsTrayIconReady() || AddTrayIcon())
|
if (IsTrayIconReady() || AddTrayIcon())
|
||||||
{
|
{
|
||||||
@@ -164,7 +164,7 @@ void CTrayWindow::CheckTrayIcon()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::RemoveTrayIcon()
|
void TrayWindow::RemoveTrayIcon()
|
||||||
{
|
{
|
||||||
NOTIFYICONDATA tnid = {sizeof(NOTIFYICONDATA)};
|
NOTIFYICONDATA tnid = {sizeof(NOTIFYICONDATA)};
|
||||||
tnid.hWnd = m_Window;
|
tnid.hWnd = m_Window;
|
||||||
@@ -180,7 +180,7 @@ void CTrayWindow::RemoveTrayIcon()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::ModifyTrayIcon(double value)
|
void TrayWindow::ModifyTrayIcon(double value)
|
||||||
{
|
{
|
||||||
if (m_Icon)
|
if (m_Icon)
|
||||||
{
|
{
|
||||||
@@ -199,7 +199,7 @@ void CTrayWindow::ModifyTrayIcon(double value)
|
|||||||
Shell_NotifyIcon(NIM_MODIFY, &tnid);
|
Shell_NotifyIcon(NIM_MODIFY, &tnid);
|
||||||
}
|
}
|
||||||
|
|
||||||
HICON CTrayWindow::CreateTrayIcon(double value)
|
HICON TrayWindow::CreateTrayIcon(double value)
|
||||||
{
|
{
|
||||||
if (m_Measure != NULL)
|
if (m_Measure != NULL)
|
||||||
{
|
{
|
||||||
@@ -296,7 +296,7 @@ HICON CTrayWindow::CreateTrayIcon(double value)
|
|||||||
return GetIcon(IDI_TRAY);
|
return GetIcon(IDI_TRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::ShowNotification(TRAY_NOTIFICATION id, const WCHAR* title, const WCHAR* text)
|
void TrayWindow::ShowNotification(TRAY_NOTIFICATION id, const WCHAR* title, const WCHAR* text)
|
||||||
{
|
{
|
||||||
if (m_Notification == TRAY_NOTIFICATION_NONE)
|
if (m_Notification == TRAY_NOTIFICATION_NONE)
|
||||||
{
|
{
|
||||||
@@ -322,28 +322,28 @@ void CTrayWindow::ShowNotification(TRAY_NOTIFICATION id, const WCHAR* title, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::ShowWelcomeNotification()
|
void TrayWindow::ShowWelcomeNotification()
|
||||||
{
|
{
|
||||||
ShowNotification(TRAY_NOTIFICATION_WELCOME, GetString(ID_STR_WELCOME), GetString(ID_STR_CLICKTOMANAGE));
|
ShowNotification(TRAY_NOTIFICATION_WELCOME, GetString(ID_STR_WELCOME), GetString(ID_STR_CLICKTOMANAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::ShowUpdateNotification(const WCHAR* newVersion)
|
void TrayWindow::ShowUpdateNotification(const WCHAR* newVersion)
|
||||||
{
|
{
|
||||||
std::wstring text = GetFormattedString(ID_STR_CLICKTODOWNLOAD, newVersion);
|
std::wstring text = GetFormattedString(ID_STR_CLICKTODOWNLOAD, newVersion);
|
||||||
ShowNotification(TRAY_NOTIFICATION_UPDATE, GetString(ID_STR_UPDATEAVAILABLE), text.c_str());
|
ShowNotification(TRAY_NOTIFICATION_UPDATE, GetString(ID_STR_UPDATEAVAILABLE), text.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::SetTrayIcon(bool enabled)
|
void TrayWindow::SetTrayIcon(bool enabled)
|
||||||
{
|
{
|
||||||
enabled ? TryAddTrayIcon() : RemoveTrayIcon();
|
enabled ? TryAddTrayIcon() : RemoveTrayIcon();
|
||||||
m_IconEnabled = enabled;
|
m_IconEnabled = enabled;
|
||||||
|
|
||||||
// Save to Rainmeter.ini.
|
// Save to Rainmeter.ini.
|
||||||
const std::wstring& iniFile = Rainmeter->GetIniFile();
|
const std::wstring& iniFile = g_Rainmeter->GetIniFile();
|
||||||
WritePrivateProfileString(L"Rainmeter", L"TrayIcon", enabled ? NULL : L"0", iniFile.c_str());
|
WritePrivateProfileString(L"Rainmeter", L"TrayIcon", enabled ? NULL : L"0", iniFile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::ReadOptions(CConfigParser& parser)
|
void TrayWindow::ReadOptions(ConfigParser& parser)
|
||||||
{
|
{
|
||||||
// Clear old Settings
|
// Clear old Settings
|
||||||
KillTimer(m_Window, TIMER_ADDTRAYICON);
|
KillTimer(m_Window, TIMER_ADDTRAYICON);
|
||||||
@@ -372,16 +372,16 @@ void CTrayWindow::ReadOptions(CConfigParser& parser)
|
|||||||
|
|
||||||
if (!measureName.empty())
|
if (!measureName.empty())
|
||||||
{
|
{
|
||||||
CConfigParser* oldParser = Rainmeter->GetCurrentParser();
|
ConfigParser* oldParser = g_Rainmeter->GetCurrentParser();
|
||||||
Rainmeter->SetCurrentParser(&parser);
|
g_Rainmeter->SetCurrentParser(&parser);
|
||||||
|
|
||||||
m_Measure = CMeasure::Create(measureName.c_str(), NULL, L"TrayMeasure");
|
m_Measure = Measure::Create(measureName.c_str(), NULL, L"TrayMeasure");
|
||||||
if (m_Measure)
|
if (m_Measure)
|
||||||
{
|
{
|
||||||
m_Measure->ReadOptions(parser);
|
m_Measure->ReadOptions(parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rainmeter->SetCurrentParser(oldParser);
|
g_Rainmeter->SetCurrentParser(oldParser);
|
||||||
}
|
}
|
||||||
|
|
||||||
const WCHAR* type = parser.ReadString(L"TrayMeasure", L"TrayMeter", m_Measure ? L"HISTOGRAM" : L"NONE").c_str();
|
const WCHAR* type = parser.ReadString(L"TrayMeasure", L"TrayMeter", m_Measure ? L"HISTOGRAM" : L"NONE").c_str();
|
||||||
@@ -404,7 +404,7 @@ void CTrayWindow::ReadOptions(CConfigParser& parser)
|
|||||||
// Load the bitmaps if defined
|
// Load the bitmaps if defined
|
||||||
if (!imageName.empty())
|
if (!imageName.empty())
|
||||||
{
|
{
|
||||||
imageName.insert(0, Rainmeter->GetSkinPath());
|
imageName.insert(0, g_Rainmeter->GetSkinPath());
|
||||||
const WCHAR* imagePath = imageName.c_str();
|
const WCHAR* imagePath = imageName.c_str();
|
||||||
if (_wcsicmp(imagePath + (imageName.size() - 4), L".ico") == 0)
|
if (_wcsicmp(imagePath + (imageName.size() - 4), L".ico") == 0)
|
||||||
{
|
{
|
||||||
@@ -457,9 +457,9 @@ void CTrayWindow::ReadOptions(CConfigParser& parser)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK TrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
CTrayWindow* tray = Rainmeter->GetTrayWindow();
|
TrayWindow* tray = g_Rainmeter->GetTrayWindow();
|
||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
@@ -467,51 +467,51 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
switch (wParam)
|
switch (wParam)
|
||||||
{
|
{
|
||||||
case IDM_MANAGE:
|
case IDM_MANAGE:
|
||||||
CDialogManage::Open();
|
DialogManage::Open();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_ABOUT:
|
case IDM_ABOUT:
|
||||||
CDialogAbout::Open();
|
DialogAbout::Open();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_SHOW_HELP:
|
case IDM_SHOW_HELP:
|
||||||
CCommandHandler::RunFile(RAINMETER_HELP);
|
CommandHandler::RunFile(RAINMETER_HELP);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_NEW_VERSION:
|
case IDM_NEW_VERSION:
|
||||||
CCommandHandler::RunFile(RAINMETER_OFFICIAL);
|
CommandHandler::RunFile(RAINMETER_OFFICIAL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_REFRESH:
|
case IDM_REFRESH:
|
||||||
PostMessage(Rainmeter->GetWindow(), WM_RAINMETER_DELAYED_REFRESH_ALL, (WPARAM)NULL, (LPARAM)NULL);
|
PostMessage(g_Rainmeter->GetWindow(), WM_RAINMETER_DELAYED_REFRESH_ALL, (WPARAM)NULL, (LPARAM)NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_SHOWLOGFILE:
|
case IDM_SHOWLOGFILE:
|
||||||
Rainmeter->ShowLogFile();
|
g_Rainmeter->ShowLogFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_STARTLOG:
|
case IDM_STARTLOG:
|
||||||
CLogger::GetInstance().StartLogFile();
|
Logger::GetInstance().StartLogFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_STOPLOG:
|
case IDM_STOPLOG:
|
||||||
CLogger::GetInstance().StopLogFile();
|
Logger::GetInstance().StopLogFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_DELETELOGFILE:
|
case IDM_DELETELOGFILE:
|
||||||
CLogger::GetInstance().DeleteLogFile();
|
Logger::GetInstance().DeleteLogFile();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_DEBUGLOG:
|
case IDM_DEBUGLOG:
|
||||||
Rainmeter->SetDebug(!Rainmeter->GetDebug());
|
g_Rainmeter->SetDebug(!g_Rainmeter->GetDebug());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_DISABLEDRAG:
|
case IDM_DISABLEDRAG:
|
||||||
Rainmeter->SetDisableDragging(!Rainmeter->GetDisableDragging());
|
g_Rainmeter->SetDisableDragging(!g_Rainmeter->GetDisableDragging());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_EDITCONFIG:
|
case IDM_EDITCONFIG:
|
||||||
Rainmeter->EditSettings();
|
g_Rainmeter->EditSettings();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_QUIT:
|
case IDM_QUIT:
|
||||||
@@ -519,7 +519,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_OPENSKINSFOLDER:
|
case IDM_OPENSKINSFOLDER:
|
||||||
Rainmeter->OpenSkinFolder();
|
g_Rainmeter->OpenSkinFolder();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -530,35 +530,35 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
{
|
{
|
||||||
int pos = mID - ID_THEME_FIRST;
|
int pos = mID - ID_THEME_FIRST;
|
||||||
|
|
||||||
const std::vector<std::wstring>& layouts = Rainmeter->GetAllLayouts();
|
const std::vector<std::wstring>& layouts = g_Rainmeter->GetAllLayouts();
|
||||||
if (pos >= 0 && pos < (int)layouts.size())
|
if (pos >= 0 && pos < (int)layouts.size())
|
||||||
{
|
{
|
||||||
Rainmeter->LoadLayout(layouts[pos]);
|
g_Rainmeter->LoadLayout(layouts[pos]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mID >= ID_CONFIG_FIRST && mID <= ID_CONFIG_LAST)
|
else if (mID >= ID_CONFIG_FIRST && mID <= ID_CONFIG_LAST)
|
||||||
{
|
{
|
||||||
std::pair<int, int> indexes = Rainmeter->GetMeterWindowIndex(mID);
|
std::pair<int, int> indexes = g_Rainmeter->GetMeterWindowIndex(mID);
|
||||||
if (indexes.first != -1 && indexes.second != -1)
|
if (indexes.first != -1 && indexes.second != -1)
|
||||||
{
|
{
|
||||||
Rainmeter->ToggleSkin(indexes.first, indexes.second);
|
g_Rainmeter->ToggleSkin(indexes.first, indexes.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Forward the message to correct window
|
// Forward the message to correct window
|
||||||
int index = (int)(wParam >> 16);
|
int index = (int)(wParam >> 16);
|
||||||
const std::map<std::wstring, CMeterWindow*>& windows = Rainmeter->GetAllMeterWindows();
|
const std::map<std::wstring, MeterWindow*>& windows = g_Rainmeter->GetAllMeterWindows();
|
||||||
|
|
||||||
if (index < (int)windows.size())
|
if (index < (int)windows.size())
|
||||||
{
|
{
|
||||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = windows.begin();
|
std::map<std::wstring, MeterWindow*>::const_iterator iter = windows.begin();
|
||||||
for ( ; iter != windows.end(); ++iter)
|
for ( ; iter != windows.end(); ++iter)
|
||||||
{
|
{
|
||||||
--index;
|
--index;
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
{
|
||||||
CMeterWindow* meterWindow = (*iter).second;
|
MeterWindow* meterWindow = (*iter).second;
|
||||||
SendMessage(meterWindow->GetWindow(), WM_COMMAND, mID, NULL);
|
SendMessage(meterWindow->GetWindow(), WM_COMMAND, mID, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -579,19 +579,19 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
switch (uMouseMsg)
|
switch (uMouseMsg)
|
||||||
{
|
{
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN:
|
||||||
bang = Rainmeter->GetTrayExecuteM().c_str();
|
bang = g_Rainmeter->GetTrayExecuteM().c_str();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
bang = Rainmeter->GetTrayExecuteR().c_str();
|
bang = g_Rainmeter->GetTrayExecuteR().c_str();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_MBUTTONDBLCLK:
|
case WM_MBUTTONDBLCLK:
|
||||||
bang = Rainmeter->GetTrayExecuteDM().c_str();
|
bang = g_Rainmeter->GetTrayExecuteDM().c_str();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_RBUTTONDBLCLK:
|
case WM_RBUTTONDBLCLK:
|
||||||
bang = Rainmeter->GetTrayExecuteDR().c_str();
|
bang = g_Rainmeter->GetTrayExecuteDR().c_str();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -602,7 +602,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
if (*bang &&
|
if (*bang &&
|
||||||
!IsCtrlKeyDown()) // Ctrl is pressed, so only run default action
|
!IsCtrlKeyDown()) // Ctrl is pressed, so only run default action
|
||||||
{
|
{
|
||||||
Rainmeter->ExecuteCommand(bang, NULL);
|
g_Rainmeter->ExecuteCommand(bang, NULL);
|
||||||
tray->m_TrayContextMenuEnabled = (uMouseMsg != WM_RBUTTONDOWN);
|
tray->m_TrayContextMenuEnabled = (uMouseMsg != WM_RBUTTONDOWN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -617,24 +617,24 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
if (tray->m_TrayContextMenuEnabled)
|
if (tray->m_TrayContextMenuEnabled)
|
||||||
{
|
{
|
||||||
POINT pos = CSystem::GetCursorPosition();
|
POINT pos = System::GetCursorPosition();
|
||||||
Rainmeter->ShowContextMenu(pos, NULL);
|
g_Rainmeter->ShowContextMenu(pos, NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
CDialogManage::Open();
|
DialogManage::Open();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NIN_BALLOONUSERCLICK:
|
case NIN_BALLOONUSERCLICK:
|
||||||
if (tray->m_Notification == TRAY_NOTIFICATION_WELCOME)
|
if (tray->m_Notification == TRAY_NOTIFICATION_WELCOME)
|
||||||
{
|
{
|
||||||
CDialogManage::Open();
|
DialogManage::Open();
|
||||||
}
|
}
|
||||||
else if (tray->m_Notification == TRAY_NOTIFICATION_UPDATE)
|
else if (tray->m_Notification == TRAY_NOTIFICATION_UPDATE)
|
||||||
{
|
{
|
||||||
CCommandHandler::RunFile(RAINMETER_OFFICIAL);
|
CommandHandler::RunFile(RAINMETER_OFFICIAL);
|
||||||
}
|
}
|
||||||
tray->m_Notification = TRAY_NOTIFICATION_NONE;
|
tray->m_Notification = TRAY_NOTIFICATION_NONE;
|
||||||
break;
|
break;
|
||||||
@@ -662,32 +662,32 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
switch (wParam)
|
switch (wParam)
|
||||||
{
|
{
|
||||||
case RAINMETER_QUERY_ID_SKINS_PATH:
|
case RAINMETER_QUERY_ID_SKINS_PATH:
|
||||||
sendCopyData(Rainmeter->GetSkinPath());
|
sendCopyData(g_Rainmeter->GetSkinPath());
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case RAINMETER_QUERY_ID_SETTINGS_PATH:
|
case RAINMETER_QUERY_ID_SETTINGS_PATH:
|
||||||
sendCopyData(Rainmeter->GetSettingsPath());
|
sendCopyData(g_Rainmeter->GetSettingsPath());
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case RAINMETER_QUERY_ID_PLUGINS_PATH:
|
case RAINMETER_QUERY_ID_PLUGINS_PATH:
|
||||||
sendCopyData(Rainmeter->GetPluginPath());
|
sendCopyData(g_Rainmeter->GetPluginPath());
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case RAINMETER_QUERY_ID_PROGRAM_PATH:
|
case RAINMETER_QUERY_ID_PROGRAM_PATH:
|
||||||
sendCopyData(Rainmeter->GetPath());
|
sendCopyData(g_Rainmeter->GetPath());
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case RAINMETER_QUERY_ID_LOG_PATH:
|
case RAINMETER_QUERY_ID_LOG_PATH:
|
||||||
sendCopyData(CLogger::GetInstance().GetLogFilePath());
|
sendCopyData(Logger::GetInstance().GetLogFilePath());
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case RAINMETER_QUERY_ID_CONFIG_EDITOR:
|
case RAINMETER_QUERY_ID_CONFIG_EDITOR:
|
||||||
sendCopyData(Rainmeter->GetSkinEditor());
|
sendCopyData(g_Rainmeter->GetSkinEditor());
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case RAINMETER_QUERY_ID_IS_DEBUGGING:
|
case RAINMETER_QUERY_ID_IS_DEBUGGING:
|
||||||
{
|
{
|
||||||
BOOL debug = Rainmeter->GetDebug();
|
BOOL debug = g_Rainmeter->GetDebug();
|
||||||
SendMessage((HWND)lParam, WM_QUERY_RAINMETER_RETURN, (WPARAM)hWnd, (LPARAM)debug);
|
SendMessage((HWND)lParam, WM_QUERY_RAINMETER_RETURN, (WPARAM)hWnd, (LPARAM)debug);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -701,7 +701,7 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||||||
if (cds->dwData == RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE)
|
if (cds->dwData == RAINMETER_QUERY_ID_SKIN_WINDOWHANDLE)
|
||||||
{
|
{
|
||||||
LPCWSTR folderPath = (LPCWSTR)cds->lpData;
|
LPCWSTR folderPath = (LPCWSTR)cds->lpData;
|
||||||
CMeterWindow* mw = Rainmeter->GetMeterWindow(folderPath);
|
MeterWindow* mw = g_Rainmeter->GetMeterWindow(folderPath);
|
||||||
return (mw) ? (LRESULT)mw->GetWindow() : NULL;
|
return (mw) ? (LRESULT)mw->GetWindow() : NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,18 +33,18 @@ enum TRAY_METER_TYPE
|
|||||||
TRAY_METER_TYPE_BITMAP
|
TRAY_METER_TYPE_BITMAP
|
||||||
};
|
};
|
||||||
|
|
||||||
class CConfigParser;
|
class ConfigParser;
|
||||||
class CMeasure;
|
class Measure;
|
||||||
|
|
||||||
class CTrayWindow
|
class TrayWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CTrayWindow();
|
TrayWindow();
|
||||||
~CTrayWindow();
|
~TrayWindow();
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
void ReadOptions(CConfigParser& parser);
|
void ReadOptions(ConfigParser& parser);
|
||||||
HWND GetWindow() { return m_Window; }
|
HWND GetWindow() { return m_Window; }
|
||||||
bool IsTrayIconEnabled() { return m_IconEnabled; }
|
bool IsTrayIconEnabled() { return m_IconEnabled; }
|
||||||
void SetTrayIcon(bool enabled);
|
void SetTrayIcon(bool enabled);
|
||||||
@@ -75,7 +75,7 @@ private:
|
|||||||
|
|
||||||
HICON m_Icon;
|
HICON m_Icon;
|
||||||
HWND m_Window;
|
HWND m_Window;
|
||||||
CMeasure* m_Measure;
|
Measure* m_Measure;
|
||||||
|
|
||||||
TRAY_METER_TYPE m_MeterType;
|
TRAY_METER_TYPE m_MeterType;
|
||||||
Gdiplus::Color m_Color1;
|
Gdiplus::Color m_Color1;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#include "TrayWindow.h"
|
#include "TrayWindow.h"
|
||||||
#include "../Version.h"
|
#include "../Version.h"
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
void CheckVersion(void* dummy)
|
void CheckVersion(void* dummy)
|
||||||
{
|
{
|
||||||
@@ -71,17 +71,17 @@ void CheckVersion(void* dummy)
|
|||||||
if (availableVersion > RAINMETER_VERSION ||
|
if (availableVersion > RAINMETER_VERSION ||
|
||||||
(revision_beta && availableVersion == RAINMETER_VERSION))
|
(revision_beta && availableVersion == RAINMETER_VERSION))
|
||||||
{
|
{
|
||||||
Rainmeter->SetNewVersion();
|
g_Rainmeter->SetNewVersion();
|
||||||
|
|
||||||
WCHAR buffer[32];
|
WCHAR buffer[32];
|
||||||
const WCHAR* dataFile = Rainmeter->GetDataFile().c_str();
|
const WCHAR* dataFile = g_Rainmeter->GetDataFile().c_str();
|
||||||
GetPrivateProfileString(L"Rainmeter", L"LastCheck", L"0", buffer, _countof(buffer), dataFile);
|
GetPrivateProfileString(L"Rainmeter", L"LastCheck", L"0", buffer, _countof(buffer), dataFile);
|
||||||
|
|
||||||
// Show tray notification only once per new version
|
// Show tray notification only once per new version
|
||||||
int lastVersion = parseVersion(buffer);
|
int lastVersion = parseVersion(buffer);
|
||||||
if (availableVersion > lastVersion)
|
if (availableVersion > lastVersion)
|
||||||
{
|
{
|
||||||
Rainmeter->GetTrayWindow()->ShowUpdateNotification(version);
|
g_Rainmeter->GetTrayWindow()->ShowUpdateNotification(version);
|
||||||
WritePrivateProfileString(L"Rainmeter", L"LastCheck", version, dataFile);
|
WritePrivateProfileString(L"Rainmeter", L"LastCheck", version, dataFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#define DECLARE_SELF(L) \
|
#define DECLARE_SELF(L) \
|
||||||
void* selfData = lua_touserdata(L, 1); \
|
void* selfData = lua_touserdata(L, 1); \
|
||||||
if (!selfData) return 0; \
|
if (!selfData) return 0; \
|
||||||
CMeasure* self = *(CMeasure**)selfData;
|
Measure* self = *(Measure**)selfData;
|
||||||
|
|
||||||
static int GetName(lua_State* L)
|
static int GetName(lua_State* L)
|
||||||
{
|
{
|
||||||
@@ -37,8 +37,8 @@ static int GetName(lua_State* L)
|
|||||||
static int GetOption(lua_State* L)
|
static int GetOption(lua_State* L)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(L)
|
DECLARE_SELF(L)
|
||||||
CMeterWindow* meterWindow = self->GetMeterWindow();
|
MeterWindow* meterWindow = self->GetMeterWindow();
|
||||||
CConfigParser& parser = meterWindow->GetParser();
|
ConfigParser& parser = meterWindow->GetParser();
|
||||||
|
|
||||||
std::wstring strTmp = LuaManager::ToWide(L, 2);
|
std::wstring strTmp = LuaManager::ToWide(L, 2);
|
||||||
strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), LuaManager::ToWide(L, 3).c_str());
|
strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), LuaManager::ToWide(L, 3).c_str());
|
||||||
@@ -50,8 +50,8 @@ static int GetOption(lua_State* L)
|
|||||||
static int GetNumberOption(lua_State* L)
|
static int GetNumberOption(lua_State* L)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(L)
|
DECLARE_SELF(L)
|
||||||
CMeterWindow* meterWindow = self->GetMeterWindow();
|
MeterWindow* meterWindow = self->GetMeterWindow();
|
||||||
CConfigParser& parser = meterWindow->GetParser();
|
ConfigParser& parser = meterWindow->GetParser();
|
||||||
|
|
||||||
std::wstring strTmp = LuaManager::ToWide(L, 2);
|
std::wstring strTmp = LuaManager::ToWide(L, 2);
|
||||||
double value = parser.ReadFloat(self->GetName(), strTmp.c_str(), lua_tonumber(L, 3));
|
double value = parser.ReadFloat(self->GetName(), strTmp.c_str(), lua_tonumber(L, 3));
|
||||||
@@ -150,7 +150,7 @@ void LuaManager::RegisterMeasure(lua_State* L)
|
|||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
luaL_register(L, "CMeasure", functions);
|
luaL_register(L, "Measure", functions);
|
||||||
lua_pushvalue(L, -1);
|
lua_pushvalue(L, -1);
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#define DECLARE_SELF(L) \
|
#define DECLARE_SELF(L) \
|
||||||
void* selfData = lua_touserdata(L, 1); \
|
void* selfData = lua_touserdata(L, 1); \
|
||||||
if (!selfData) return 0; \
|
if (!selfData) return 0; \
|
||||||
CMeter* self = *(CMeter**)selfData;
|
Meter* self = *(Meter**)selfData;
|
||||||
|
|
||||||
static int GetName(lua_State* L)
|
static int GetName(lua_State* L)
|
||||||
{
|
{
|
||||||
@@ -37,8 +37,8 @@ static int GetName(lua_State* L)
|
|||||||
static int GetOption(lua_State* L)
|
static int GetOption(lua_State* L)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(L)
|
DECLARE_SELF(L)
|
||||||
CMeterWindow* meterWindow = self->GetMeterWindow();
|
MeterWindow* meterWindow = self->GetMeterWindow();
|
||||||
CConfigParser& parser = meterWindow->GetParser();
|
ConfigParser& parser = meterWindow->GetParser();
|
||||||
|
|
||||||
std::wstring strTmp = LuaManager::ToWide(L, 2);
|
std::wstring strTmp = LuaManager::ToWide(L, 2);
|
||||||
strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), L"");
|
strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), L"");
|
||||||
@@ -137,9 +137,9 @@ static int Show(lua_State* L)
|
|||||||
static int SetText(lua_State* L)
|
static int SetText(lua_State* L)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(L)
|
DECLARE_SELF(L)
|
||||||
if (self->GetTypeID() == TypeID<CMeterString>())
|
if (self->GetTypeID() == TypeID<MeterString>())
|
||||||
{
|
{
|
||||||
CMeterString* string = (CMeterString*)self;
|
MeterString* string = (MeterString*)self;
|
||||||
std::wstring str = LuaManager::ToWide(L, 2);
|
std::wstring str = LuaManager::ToWide(L, 2);
|
||||||
string->SetText(str.c_str());
|
string->SetText(str.c_str());
|
||||||
}
|
}
|
||||||
@@ -167,7 +167,7 @@ void LuaManager::RegisterMeter(lua_State* L)
|
|||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
luaL_register(L, "CMeter", functions);
|
luaL_register(L, "Meter", functions);
|
||||||
lua_pushvalue(L, -1);
|
lua_pushvalue(L, -1);
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|||||||
@@ -22,17 +22,17 @@
|
|||||||
#include "../../MeterWindow.h"
|
#include "../../MeterWindow.h"
|
||||||
#include "../../MeterString.h"
|
#include "../../MeterString.h"
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern Rainmeter* g_Rainmeter;
|
||||||
|
|
||||||
#define DECLARE_SELF(L) \
|
#define DECLARE_SELF(L) \
|
||||||
void* selfData = lua_touserdata(L, 1); \
|
void* selfData = lua_touserdata(L, 1); \
|
||||||
if (!selfData) return 0; \
|
if (!selfData) return 0; \
|
||||||
CMeterWindow* self = *(CMeterWindow**)selfData;
|
MeterWindow* self = *(MeterWindow**)selfData;
|
||||||
|
|
||||||
static int Bang(lua_State* L)
|
static int Bang(lua_State* L)
|
||||||
{
|
{
|
||||||
DECLARE_SELF(L)
|
DECLARE_SELF(L)
|
||||||
CConfigParser& parser = self->GetParser();
|
ConfigParser& parser = self->GetParser();
|
||||||
|
|
||||||
std::wstring bang = LuaManager::ToWide(L, 2);
|
std::wstring bang = LuaManager::ToWide(L, 2);
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ static int Bang(lua_State* L)
|
|||||||
if (top == 2) // 1 argument
|
if (top == 2) // 1 argument
|
||||||
{
|
{
|
||||||
parser.ReplaceVariables(bang);
|
parser.ReplaceVariables(bang);
|
||||||
Rainmeter->ExecuteCommand(bang.c_str(), self);
|
g_Rainmeter->ExecuteCommand(bang.c_str(), self);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -56,7 +56,7 @@ static int Bang(lua_State* L)
|
|||||||
args.push_back(tmpSz);
|
args.push_back(tmpSz);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rainmeter->ExecuteBang(bangSz, args, self);
|
g_Rainmeter->ExecuteBang(bangSz, args, self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,11 +68,11 @@ static int GetMeter(lua_State* L)
|
|||||||
DECLARE_SELF(L)
|
DECLARE_SELF(L)
|
||||||
const std::wstring meterName = LuaManager::ToWide(L, 2);
|
const std::wstring meterName = LuaManager::ToWide(L, 2);
|
||||||
|
|
||||||
CMeter* meter = self->GetMeter(meterName);
|
Meter* meter = self->GetMeter(meterName);
|
||||||
if (meter)
|
if (meter)
|
||||||
{
|
{
|
||||||
*(CMeter**)lua_newuserdata(L, sizeof(CMeter*)) = meter;
|
*(Meter**)lua_newuserdata(L, sizeof(Meter*)) = meter;
|
||||||
lua_getglobal(L, "CMeter");
|
lua_getglobal(L, "Meter");
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -88,11 +88,11 @@ static int GetMeasure(lua_State* L)
|
|||||||
DECLARE_SELF(L)
|
DECLARE_SELF(L)
|
||||||
const std::wstring measureName = LuaManager::ToWide(L, 2);
|
const std::wstring measureName = LuaManager::ToWide(L, 2);
|
||||||
|
|
||||||
CMeasure* measure = self->GetMeasure(measureName);
|
Measure* measure = self->GetMeasure(measureName);
|
||||||
if (measure)
|
if (measure)
|
||||||
{
|
{
|
||||||
*(CMeasure**)lua_newuserdata(L, sizeof(CMeasure*)) = measure;
|
*(Measure**)lua_newuserdata(L, sizeof(Measure*)) = measure;
|
||||||
lua_getglobal(L, "CMeasure");
|
lua_getglobal(L, "Measure");
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -231,7 +231,7 @@ void LuaManager::RegisterMeterWindow(lua_State* L)
|
|||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
luaL_register(L, "CMeterWindow", functions);
|
luaL_register(L, "MeterWindow", functions);
|
||||||
lua_pushvalue(L, -1);
|
lua_pushvalue(L, -1);
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|||||||
@@ -30,12 +30,12 @@
|
|||||||
|
|
||||||
struct MeasureData
|
struct MeasureData
|
||||||
{
|
{
|
||||||
std::vector<CRawString> includes;
|
std::vector<RawString> includes;
|
||||||
std::vector<CRawString> excludes;
|
std::vector<RawString> excludes;
|
||||||
CRawString includesCache;
|
RawString includesCache;
|
||||||
CRawString excludesCache;
|
RawString excludesCache;
|
||||||
int topProcess;
|
int topProcess;
|
||||||
CRawString topProcessName;
|
RawString topProcessName;
|
||||||
LONGLONG topProcessValue;
|
LONGLONG topProcessValue;
|
||||||
|
|
||||||
MeasureData() :
|
MeasureData() :
|
||||||
@@ -47,7 +47,7 @@ struct MeasureData
|
|||||||
|
|
||||||
struct ProcessValues
|
struct ProcessValues
|
||||||
{
|
{
|
||||||
CRawString name;
|
RawString name;
|
||||||
LONGLONG oldValue;
|
LONGLONG oldValue;
|
||||||
LONGLONG newValue;
|
LONGLONG newValue;
|
||||||
bool found;
|
bool found;
|
||||||
@@ -58,7 +58,7 @@ std::vector<ProcessValues> g_Processes;
|
|||||||
|
|
||||||
void UpdateProcesses();
|
void UpdateProcesses();
|
||||||
|
|
||||||
void SplitName(WCHAR* names, std::vector<CRawString>& splittedNames)
|
void SplitName(WCHAR* names, std::vector<RawString>& splittedNames)
|
||||||
{
|
{
|
||||||
WCHAR* token = wcstok(names, L";");
|
WCHAR* token = wcstok(names, L";");
|
||||||
while (token != NULL)
|
while (token != NULL)
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void CFolderInfo::Update()
|
|||||||
|
|
||||||
void CFolderInfo::CalculateSize()
|
void CFolderInfo::CalculateSize()
|
||||||
{
|
{
|
||||||
std::list<CRawString> folderQueue;
|
std::list<RawString> folderQueue;
|
||||||
folderQueue.push_back(m_Path.c_str());
|
folderQueue.push_back(m_Path.c_str());
|
||||||
|
|
||||||
WCHAR searchPattern[MAX_PATH + 10];
|
WCHAR searchPattern[MAX_PATH + 10];
|
||||||
@@ -100,7 +100,7 @@ void CFolderInfo::CalculateSize()
|
|||||||
HANDLE findHandle;
|
HANDLE findHandle;
|
||||||
while (!folderQueue.empty())
|
while (!folderQueue.empty())
|
||||||
{
|
{
|
||||||
const CRawString& ref = folderQueue.front();
|
const RawString& ref = folderQueue.front();
|
||||||
wsprintf(searchPattern, L"%s%s", ref.c_str(), L"\\*.*");
|
wsprintf(searchPattern, L"%s%s", ref.c_str(), L"\\*.*");
|
||||||
|
|
||||||
findHandle = FindFirstFile(searchPattern, &findData);
|
findHandle = FindFirstFile(searchPattern, &findData);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ private:
|
|||||||
UINT m_InstanceCount;
|
UINT m_InstanceCount;
|
||||||
void* m_Skin;
|
void* m_Skin;
|
||||||
|
|
||||||
CRawString m_Path;
|
RawString m_Path;
|
||||||
bool m_IncludeSubFolders;
|
bool m_IncludeSubFolders;
|
||||||
bool m_IncludeHiddenFiles;
|
bool m_IncludeHiddenFiles;
|
||||||
bool m_IncludeSystemFiles;
|
bool m_IncludeSystemFiles;
|
||||||
|
|||||||
@@ -19,13 +19,13 @@
|
|||||||
#include "StdAfx.h"
|
#include "StdAfx.h"
|
||||||
#include "Internet.h"
|
#include "Internet.h"
|
||||||
|
|
||||||
HINTERNET CInternet::c_NetHandle = NULL;
|
HINTERNET Internet::c_NetHandle = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Initialize internet handle and crtical section.
|
** Initialize internet handle and crtical section.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CInternet::Initialize()
|
void Internet::Initialize()
|
||||||
{
|
{
|
||||||
c_NetHandle = InternetOpen(L"Rainmeter NowPlaying.dll",
|
c_NetHandle = InternetOpen(L"Rainmeter NowPlaying.dll",
|
||||||
INTERNET_OPEN_TYPE_PRECONFIG,
|
INTERNET_OPEN_TYPE_PRECONFIG,
|
||||||
@@ -43,7 +43,7 @@ void CInternet::Initialize()
|
|||||||
** Close handles and delete critical section.
|
** Close handles and delete critical section.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CInternet::Finalize()
|
void Internet::Finalize()
|
||||||
{
|
{
|
||||||
if (c_NetHandle) InternetCloseHandle(c_NetHandle);
|
if (c_NetHandle) InternetCloseHandle(c_NetHandle);
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ void CInternet::Finalize()
|
|||||||
** Downloads given url and returns it as a string.
|
** Downloads given url and returns it as a string.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
std::wstring CInternet::DownloadUrl(const std::wstring& url, int codepage)
|
std::wstring Internet::DownloadUrl(const std::wstring& url, int codepage)
|
||||||
{
|
{
|
||||||
// From WebParser.cpp
|
// From WebParser.cpp
|
||||||
std::wstring result;
|
std::wstring result;
|
||||||
@@ -148,7 +148,7 @@ std::wstring CInternet::DownloadUrl(const std::wstring& url, int codepage)
|
|||||||
** Encode reserved characters.
|
** Encode reserved characters.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
std::wstring CInternet::EncodeUrl(const std::wstring& url)
|
std::wstring Internet::EncodeUrl(const std::wstring& url)
|
||||||
{
|
{
|
||||||
// Based on http://www.zedwood.com/article/111/cpp-urlencode-function
|
// Based on http://www.zedwood.com/article/111/cpp-urlencode-function
|
||||||
const WCHAR* urlChars = L" !*'();:@&=+$,/?#[]";
|
const WCHAR* urlChars = L" !*'();:@&=+$,/?#[]";
|
||||||
@@ -176,7 +176,7 @@ std::wstring CInternet::EncodeUrl(const std::wstring& url)
|
|||||||
** Decodes numeric references.
|
** Decodes numeric references.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
void CInternet::DecodeReferences(std::wstring& str)
|
void Internet::DecodeReferences(std::wstring& str)
|
||||||
{
|
{
|
||||||
// From WebParser.cpp
|
// From WebParser.cpp
|
||||||
std::wstring::size_type start = 0;
|
std::wstring::size_type start = 0;
|
||||||
@@ -246,7 +246,7 @@ void CInternet::DecodeReferences(std::wstring& str)
|
|||||||
** Convert multibyte string to wide string.
|
** Convert multibyte string to wide string.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
std::wstring CInternet::ConvertToWide(LPCSTR str, int codepage)
|
std::wstring Internet::ConvertToWide(LPCSTR str, int codepage)
|
||||||
{
|
{
|
||||||
std::wstring szWide;
|
std::wstring szWide;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef __INTERNET_H__
|
#ifndef __INTERNET_H__
|
||||||
#define __INTERNET_H__
|
#define __INTERNET_H__
|
||||||
|
|
||||||
class CInternet
|
class Internet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
|
|||||||
@@ -25,10 +25,10 @@
|
|||||||
** Download lyrics from various serivces.
|
** Download lyrics from various serivces.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CLyrics::GetFromInternet(const std::wstring& artist, const std::wstring& title, std::wstring& out)
|
bool Lyrics::GetFromInternet(const std::wstring& artist, const std::wstring& title, std::wstring& out)
|
||||||
{
|
{
|
||||||
std::wstring encArtist = CInternet::EncodeUrl(artist);
|
std::wstring encArtist = Internet::EncodeUrl(artist);
|
||||||
std::wstring encTitle = CInternet::EncodeUrl(title);
|
std::wstring encTitle = Internet::EncodeUrl(title);
|
||||||
|
|
||||||
bool found = GetFromWikia(encArtist, encTitle, out) ||
|
bool found = GetFromWikia(encArtist, encTitle, out) ||
|
||||||
GetFromLYRDB(encArtist, encTitle, out) ||
|
GetFromLYRDB(encArtist, encTitle, out) ||
|
||||||
@@ -41,7 +41,7 @@ bool CLyrics::GetFromInternet(const std::wstring& artist, const std::wstring& ti
|
|||||||
** Download lyrics from LyricWiki.
|
** Download lyrics from LyricWiki.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CLyrics::GetFromWikia(const std::wstring& artist, const std::wstring& title, std::wstring& data)
|
bool Lyrics::GetFromWikia(const std::wstring& artist, const std::wstring& title, std::wstring& data)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ bool CLyrics::GetFromWikia(const std::wstring& artist, const std::wstring& title
|
|||||||
url += L"&song=";
|
url += L"&song=";
|
||||||
url += title;
|
url += title;
|
||||||
|
|
||||||
data = CInternet::DownloadUrl(url, CP_UTF8);
|
data = Internet::DownloadUrl(url, CP_UTF8);
|
||||||
if (!data.empty())
|
if (!data.empty())
|
||||||
{
|
{
|
||||||
// First we get the URL to the actual wiki page
|
// First we get the URL to the actual wiki page
|
||||||
@@ -61,7 +61,7 @@ bool CLyrics::GetFromWikia(const std::wstring& artist, const std::wstring& title
|
|||||||
url.assign(data, 0, pos);
|
url.assign(data, 0, pos);
|
||||||
|
|
||||||
// Fetch the wiki page
|
// Fetch the wiki page
|
||||||
data = CInternet::DownloadUrl(url, CP_UTF8);
|
data = Internet::DownloadUrl(url, CP_UTF8);
|
||||||
if (!data.empty())
|
if (!data.empty())
|
||||||
{
|
{
|
||||||
pos = data.find(L"'lyricbox'");
|
pos = data.find(L"'lyricbox'");
|
||||||
@@ -72,7 +72,7 @@ bool CLyrics::GetFromWikia(const std::wstring& artist, const std::wstring& title
|
|||||||
data.erase(0, pos);
|
data.erase(0, pos);
|
||||||
pos = data.find(L"<!");
|
pos = data.find(L"<!");
|
||||||
data.resize(pos);
|
data.resize(pos);
|
||||||
CInternet::DecodeReferences(data);
|
Internet::DecodeReferences(data);
|
||||||
|
|
||||||
pos = data.find(L"[...]");
|
pos = data.find(L"[...]");
|
||||||
if (pos != std::wstring::npos)
|
if (pos != std::wstring::npos)
|
||||||
@@ -115,7 +115,7 @@ bool CLyrics::GetFromWikia(const std::wstring& artist, const std::wstring& title
|
|||||||
** Download lyrics from LYRDB.
|
** Download lyrics from LYRDB.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CLyrics::GetFromLYRDB(const std::wstring& artist, const std::wstring& title, std::wstring& data)
|
bool Lyrics::GetFromLYRDB(const std::wstring& artist, const std::wstring& title, std::wstring& data)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ bool CLyrics::GetFromLYRDB(const std::wstring& artist, const std::wstring& title
|
|||||||
std::wstring url = L"http://webservices.lyrdb.com/lookup.php?q=" + query;
|
std::wstring url = L"http://webservices.lyrdb.com/lookup.php?q=" + query;
|
||||||
url += L"&for=match&agent=RainmeterNowPlaying";
|
url += L"&for=match&agent=RainmeterNowPlaying";
|
||||||
|
|
||||||
data = CInternet::DownloadUrl(url, CP_ACP);
|
data = Internet::DownloadUrl(url, CP_ACP);
|
||||||
if (!data.empty())
|
if (!data.empty())
|
||||||
{
|
{
|
||||||
pos = data.find(L"\\");
|
pos = data.find(L"\\");
|
||||||
@@ -142,7 +142,7 @@ bool CLyrics::GetFromLYRDB(const std::wstring& artist, const std::wstring& title
|
|||||||
url.assign(data, 0, pos);
|
url.assign(data, 0, pos);
|
||||||
url.insert(0, L"http://webservices.lyrdb.com/getlyr.php?q=");
|
url.insert(0, L"http://webservices.lyrdb.com/getlyr.php?q=");
|
||||||
|
|
||||||
data = CInternet::DownloadUrl(url, CP_ACP);
|
data = Internet::DownloadUrl(url, CP_ACP);
|
||||||
if (!data.empty())
|
if (!data.empty())
|
||||||
{
|
{
|
||||||
ret = true;
|
ret = true;
|
||||||
@@ -157,14 +157,14 @@ bool CLyrics::GetFromLYRDB(const std::wstring& artist, const std::wstring& title
|
|||||||
** Download lyrics from Letras.
|
** Download lyrics from Letras.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
bool CLyrics::GetFromLetras(const std::wstring& artist, const std::wstring& title, std::wstring& data)
|
bool Lyrics::GetFromLetras(const std::wstring& artist, const std::wstring& title, std::wstring& data)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
std::wstring url = L"http://letras.terra.com.br/winamp.php?musica=" + title;
|
std::wstring url = L"http://letras.terra.com.br/winamp.php?musica=" + title;
|
||||||
url += L"&artista=";
|
url += L"&artista=";
|
||||||
url += artist;
|
url += artist;
|
||||||
data = CInternet::DownloadUrl(url, CP_ACP);
|
data = Internet::DownloadUrl(url, CP_ACP);
|
||||||
if (!data.empty())
|
if (!data.empty())
|
||||||
{
|
{
|
||||||
std::wstring::size_type pos = data.find(L"\"letra\"");
|
std::wstring::size_type pos = data.find(L"\"letra\"");
|
||||||
@@ -177,7 +177,7 @@ bool CLyrics::GetFromLetras(const std::wstring& artist, const std::wstring& titl
|
|||||||
pos = data.find(L"</p>");
|
pos = data.find(L"</p>");
|
||||||
data.resize(pos);
|
data.resize(pos);
|
||||||
|
|
||||||
CInternet::DecodeReferences(data);
|
Internet::DecodeReferences(data);
|
||||||
|
|
||||||
while ((pos = data.find(L"<br/>"), pos) != std::wstring::npos)
|
while ((pos = data.find(L"<br/>"), pos) != std::wstring::npos)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef __LYRICS_H__
|
#ifndef __LYRICS_H__
|
||||||
#define __LYRICS_H__
|
#define __LYRICS_H__
|
||||||
|
|
||||||
class CLyrics
|
class Lyrics
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static bool GetFromInternet(const std::wstring& artist, const std::wstring& title, std::wstring& out);
|
static bool GetFromInternet(const std::wstring& artist, const std::wstring& title, std::wstring& out);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ PLUGIN_EXPORT void Initialize(void** data, void* rm)
|
|||||||
|
|
||||||
if (!g_Initialized)
|
if (!g_Initialized)
|
||||||
{
|
{
|
||||||
CInternet::Initialize();
|
Internet::Initialize();
|
||||||
g_Initialized = true;
|
g_Initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
|
|||||||
{
|
{
|
||||||
// ParentMeasure is created when PlayerName is an actual player (and not a reference)
|
// ParentMeasure is created when PlayerName is an actual player (and not a reference)
|
||||||
ParentMeasure* parent = measure->parent;
|
ParentMeasure* parent = measure->parent;
|
||||||
CPlayer* oldPlayer = NULL;
|
Player* oldPlayer = NULL;
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
if (parent->data != data)
|
if (parent->data != data)
|
||||||
@@ -139,11 +139,11 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
|
|||||||
|
|
||||||
if (_wcsicmp(L"AIMP", str) == 0)
|
if (_wcsicmp(L"AIMP", str) == 0)
|
||||||
{
|
{
|
||||||
parent->player = CPlayerAIMP::Create();
|
parent->player = PlayerAIMP::Create();
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"CAD", str) == 0)
|
else if (_wcsicmp(L"CAD", str) == 0)
|
||||||
{
|
{
|
||||||
parent->player = CPlayerCAD::Create();
|
parent->player = PlayerCAD::Create();
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"foobar2000", str) == 0)
|
else if (_wcsicmp(L"foobar2000", str) == 0)
|
||||||
{
|
{
|
||||||
@@ -157,32 +157,32 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parent->player = CPlayerCAD::Create();
|
parent->player = PlayerCAD::Create();
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"iTunes", str) == 0)
|
else if (_wcsicmp(L"iTunes", str) == 0)
|
||||||
{
|
{
|
||||||
parent->player = CPlayerITunes::Create();
|
parent->player = PlayerITunes::Create();
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"MediaMonkey", str) == 0)
|
else if (_wcsicmp(L"MediaMonkey", str) == 0)
|
||||||
{
|
{
|
||||||
parent->player = CPlayerWinamp::Create(WA_MEDIAMONKEY);
|
parent->player = PlayerWinamp::Create(WA_MEDIAMONKEY);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"Spotify", str) == 0)
|
else if (_wcsicmp(L"Spotify", str) == 0)
|
||||||
{
|
{
|
||||||
parent->player = CPlayerSpotify::Create();
|
parent->player = PlayerSpotify::Create();
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"WinAmp", str) == 0)
|
else if (_wcsicmp(L"WinAmp", str) == 0)
|
||||||
{
|
{
|
||||||
parent->player = CPlayerWinamp::Create(WA_WINAMP);
|
parent->player = PlayerWinamp::Create(WA_WINAMP);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(L"WMP", str) == 0)
|
else if (_wcsicmp(L"WMP", str) == 0)
|
||||||
{
|
{
|
||||||
parent->player = CPlayerWMP::Create();
|
parent->player = PlayerWMP::Create();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Default to WLM
|
// Default to WLM
|
||||||
parent->player = CPlayerWLM::Create();
|
parent->player = PlayerWLM::Create();
|
||||||
|
|
||||||
if (_wcsicmp(L"WLM", str) != 0)
|
if (_wcsicmp(L"WLM", str) != 0)
|
||||||
{
|
{
|
||||||
@@ -302,7 +302,7 @@ PLUGIN_EXPORT double Update(void* data)
|
|||||||
ParentMeasure* parent = measure->parent;
|
ParentMeasure* parent = measure->parent;
|
||||||
if (!parent) return 0.0;
|
if (!parent) return 0.0;
|
||||||
|
|
||||||
CPlayer* player = parent->player;
|
Player* player = parent->player;
|
||||||
|
|
||||||
// Only allow parent measure to update
|
// Only allow parent measure to update
|
||||||
if (parent->data == data)
|
if (parent->data == data)
|
||||||
@@ -367,7 +367,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data)
|
|||||||
ParentMeasure* parent = measure->parent;
|
ParentMeasure* parent = measure->parent;
|
||||||
if (!parent) return NULL;
|
if (!parent) return NULL;
|
||||||
|
|
||||||
const CPlayer* player = parent->player;
|
const Player* player = parent->player;
|
||||||
static WCHAR buffer[32];
|
static WCHAR buffer[32];
|
||||||
|
|
||||||
switch (measure->type)
|
switch (measure->type)
|
||||||
@@ -444,7 +444,7 @@ PLUGIN_EXPORT void Finalize(void* data)
|
|||||||
ParentMeasure* parent = measure->parent;
|
ParentMeasure* parent = measure->parent;
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
CPlayer* player = parent->player;
|
Player* player = parent->player;
|
||||||
if (--parent->measureCount == 0)
|
if (--parent->measureCount == 0)
|
||||||
{
|
{
|
||||||
player->RemoveInstance();
|
player->RemoveInstance();
|
||||||
@@ -455,7 +455,7 @@ PLUGIN_EXPORT void Finalize(void* data)
|
|||||||
|
|
||||||
if (g_ParentMeasures.empty())
|
if (g_ParentMeasures.empty())
|
||||||
{
|
{
|
||||||
CInternet::Finalize();
|
Internet::Finalize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -469,7 +469,7 @@ PLUGIN_EXPORT void ExecuteBang(void* data, LPCWSTR args)
|
|||||||
ParentMeasure* parent = measure->parent;
|
ParentMeasure* parent = measure->parent;
|
||||||
if (!parent) return;
|
if (!parent) return;
|
||||||
|
|
||||||
CPlayer* player = parent->player;
|
Player* player = parent->player;
|
||||||
|
|
||||||
if (!player->IsInitialized())
|
if (!player->IsInitialized())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ struct ParentMeasure
|
|||||||
disableLeadingZero(false)
|
disableLeadingZero(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CPlayer* player;
|
Player* player;
|
||||||
void* data;
|
void* data;
|
||||||
void* skin;
|
void* skin;
|
||||||
LPCWSTR ownerName;
|
LPCWSTR ownerName;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user