mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Code cleanup
This commit is contained in:
parent
9da869363d
commit
9375b5013c
@ -53,6 +53,7 @@ CMeter::CMeter(CMeterWindow* meterWindow, const WCHAR* name) : CSection(meterWin
|
||||
m_ToolTipType(false),
|
||||
m_ToolTipHidden(meterWindow->GetMeterToolTipHidden()),
|
||||
m_ToolTipHandle(),
|
||||
m_Mouse(meterWindow, this),
|
||||
m_HasMouseAction(false),
|
||||
m_MouseOver(false),
|
||||
m_RelativeX(POSITION_ABSOLUTE),
|
||||
@ -322,19 +323,8 @@ void CMeter::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
||||
|
||||
m_OnUpdateAction = parser.ReadString(section, L"OnUpdateAction", L"", false);
|
||||
|
||||
m_Mouse.ReadOptions(parser, section, m_MeterWindow);
|
||||
|
||||
m_HasMouseAction =
|
||||
!(m_Mouse.GetLeftUpAction().empty() && m_Mouse.GetLeftDownAction().empty() &&
|
||||
m_Mouse.GetLeftDoubleClickAction().empty() && m_Mouse.GetMiddleUpAction().empty() &&
|
||||
m_Mouse.GetMiddleDownAction().empty() && m_Mouse.GetMiddleDoubleClickAction().empty() &&
|
||||
m_Mouse.GetRightUpAction().empty() && m_Mouse.GetRightDownAction().empty() &&
|
||||
m_Mouse.GetRightDoubleClickAction().empty() && m_Mouse.GetX1UpAction().empty() &&
|
||||
m_Mouse.GetX1DownAction().empty() && m_Mouse.GetX1DoubleClickAction().empty() &&
|
||||
m_Mouse.GetX2UpAction().empty() && m_Mouse.GetX2DownAction().empty() &&
|
||||
m_Mouse.GetX2DoubleClickAction().empty() && m_Mouse.GetMouseScrollDownAction().empty() &&
|
||||
m_Mouse.GetMouseScrollLeftAction().empty() && m_Mouse.GetMouseScrollRightAction().empty() &&
|
||||
m_Mouse.GetMouseScrollUpAction().empty());
|
||||
m_Mouse.ReadOptions(parser, section);
|
||||
m_HasMouseAction = m_Mouse.HasButtonAction() || m_Mouse.HasScrollAction();
|
||||
|
||||
m_ToolTipText = parser.ReadString(section, L"ToolTipText", L"");
|
||||
m_ToolTipTitle = parser.ReadString(section, L"ToolTipTitle", L"");
|
||||
|
@ -82,6 +82,7 @@ CMeterWindow::CMeterWindow(const std::wstring& folderPath, const std::wstring& f
|
||||
m_Background(),
|
||||
m_BackgroundSize(),
|
||||
m_Window(),
|
||||
m_Mouse(this),
|
||||
m_MouseOver(false),
|
||||
m_MouseInputRegistered(false),
|
||||
m_HasMouseScrollAction(false),
|
||||
@ -215,6 +216,7 @@ void CMeterWindow::Dispose(bool refresh)
|
||||
KillTimer(m_Window, TIMER_TRANSITION);
|
||||
|
||||
UnregisterMouseInput();
|
||||
m_HasMouseScrollAction = false;
|
||||
|
||||
m_ActiveTransition = false;
|
||||
|
||||
@ -2043,7 +2045,7 @@ bool CMeterWindow::ReadSkin()
|
||||
}
|
||||
}
|
||||
|
||||
m_Mouse.ReadOptions(m_Parser, L"Rainmeter", this);
|
||||
m_Mouse.ReadOptions(m_Parser, L"Rainmeter");
|
||||
|
||||
m_OnRefreshAction = m_Parser.ReadString(L"Rainmeter", L"OnRefreshAction", L"", false);
|
||||
m_OnCloseAction = m_Parser.ReadString(L"Rainmeter", L"OnCloseAction", L"", false);
|
||||
@ -4300,7 +4302,7 @@ LRESULT CMeterWindow::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
*/
|
||||
bool CMeterWindow::DoAction(int x, int y, MOUSEACTION action, bool test)
|
||||
{
|
||||
std::wstring command = L"";
|
||||
std::wstring command;
|
||||
|
||||
// Check if the hitpoint was over some meter
|
||||
std::vector<CMeter*>::const_reverse_iterator j = m_Meters.rbegin();
|
||||
@ -4309,17 +4311,20 @@ bool CMeterWindow::DoAction(int x, int y, MOUSEACTION action, bool test)
|
||||
// Hidden meters are ignored
|
||||
if ((*j)->IsHidden()) continue;
|
||||
|
||||
std::wstring meterCommand = (*j)->GetMouse().GetActionCommand(action);
|
||||
if (!meterCommand.empty() && (*j)->HitTest(x, y))
|
||||
const CMouse& mouse = (*j)->GetMouse();
|
||||
if (mouse.HasActionCommand(action) && (*j)->HitTest(x, y))
|
||||
{
|
||||
command = meterCommand;
|
||||
command = mouse.GetActionCommand(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (command.empty() && HitTest(x, y))
|
||||
if (command.empty())
|
||||
{
|
||||
command = m_Mouse.GetActionCommand(action).c_str();
|
||||
if (m_Mouse.HasActionCommand(action) && HitTest(x, y))
|
||||
{
|
||||
command = m_Mouse.GetActionCommand(action);
|
||||
}
|
||||
}
|
||||
|
||||
if (!command.empty())
|
||||
@ -4388,17 +4393,18 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSEACTION action)
|
||||
|
||||
if (!(*j)->IsMouseOver())
|
||||
{
|
||||
if (!((*j)->GetMouse().GetOverAction().empty()) ||
|
||||
!((*j)->GetMouse().GetLeaveAction().empty()) ||
|
||||
const CMouse& mouse = (*j)->GetMouse();
|
||||
if (!mouse.GetOverAction().empty() ||
|
||||
!mouse.GetLeaveAction().empty() ||
|
||||
button)
|
||||
{
|
||||
//LogWithArgs(LOG_DEBUG, L"MeterEnter: %s - [%s]", m_FolderPath.c_str(), (*j)->GetName());
|
||||
(*j)->SetMouseOver(true);
|
||||
|
||||
if (!((*j)->GetMouse().GetOverAction().empty()))
|
||||
if (!mouse.GetOverAction().empty())
|
||||
{
|
||||
UINT currCounter = m_MouseMoveCounter;
|
||||
Rainmeter->ExecuteCommand((*j)->GetMouse().GetOverAction().c_str(), this);
|
||||
Rainmeter->ExecuteCommand(mouse.GetOverAction().c_str(), this);
|
||||
return (currCounter == m_MouseMoveCounter);
|
||||
}
|
||||
}
|
||||
@ -4421,9 +4427,10 @@ bool CMeterWindow::DoMoveAction(int x, int y, MOUSEACTION action)
|
||||
//LogWithArgs(LOG_DEBUG, L"MeterLeave: %s - [%s]", m_FolderPath.c_str(), (*j)->GetName());
|
||||
(*j)->SetMouseOver(false);
|
||||
|
||||
if (!((*j)->GetMouse().GetLeaveAction().empty()))
|
||||
const CMouse& mouse = (*j)->GetMouse();
|
||||
if (!mouse.GetLeaveAction().empty())
|
||||
{
|
||||
Rainmeter->ExecuteCommand((*j)->GetMouse().GetLeaveAction().c_str(), this);
|
||||
Rainmeter->ExecuteCommand(mouse.GetLeaveAction().c_str(), this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -23,11 +23,10 @@
|
||||
#include "Litestep.h"
|
||||
#include "Mouse.h"
|
||||
|
||||
CMouse::CMouse() :
|
||||
CMouse::CMouse(CMeterWindow* meterWindow, CMeter* meter) : m_MeterWindow(meterWindow), m_Meter(meter),
|
||||
m_CursorType(MOUSECURSOR_HAND),
|
||||
m_CustomCursor(),
|
||||
m_CursorState(true),
|
||||
m_MeterWindow()
|
||||
m_CursorState(true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -36,43 +35,36 @@ CMouse::~CMouse()
|
||||
DestroyCustomCursor();
|
||||
}
|
||||
|
||||
void CMouse::ReadOptions(CConfigParser& parser, const WCHAR* section, CMeterWindow* meterWindow)
|
||||
void CMouse::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
||||
{
|
||||
m_MeterWindow = meterWindow;
|
||||
m_MeterName = section;
|
||||
|
||||
DestroyCustomCursor();
|
||||
|
||||
m_LeftDownAction = parser.ReadString(section, L"LeftMouseDownAction", L"", false);
|
||||
m_RightDownAction = parser.ReadString(section, L"RightMouseDownAction", L"", false);
|
||||
m_MiddleDownAction = parser.ReadString(section, L"MiddleMouseDownAction", L"", false);
|
||||
m_X1DownAction = parser.ReadString(section, L"X1MouseDownAction", L"", false);
|
||||
m_X2DownAction = parser.ReadString(section, L"X2MouseDownAction", L"", false);
|
||||
m_LeftUpAction = parser.ReadString(section, L"LeftMouseUpAction", L"", false);
|
||||
m_RightUpAction = parser.ReadString(section, L"RightMouseUpAction", L"", false);
|
||||
m_MiddleUpAction = parser.ReadString(section, L"MiddleMouseUpAction", L"", false);
|
||||
m_X1UpAction = parser.ReadString(section, L"X1MouseUpAction", L"", false);
|
||||
m_X2UpAction = parser.ReadString(section, L"X2MouseUpAction", L"", false);
|
||||
m_LeftDoubleClickAction = parser.ReadString(section, L"LeftMouseDoubleClickAction", L"", false);
|
||||
m_RightDoubleClickAction = parser.ReadString(section, L"RightMouseDoubleClickAction", L"", false);
|
||||
m_MiddleDoubleClickAction = parser.ReadString(section, L"MiddleMouseDoubleClickAction", L"", false);
|
||||
m_X1DoubleClickAction = parser.ReadString(section, L"X1MouseDoubleClickAction", L"", false);
|
||||
m_X2DoubleClickAction = parser.ReadString(section, L"X2MouseDoubleClickAction", L"", false);
|
||||
m_MouseActions[MOUSE_LMB_UP] = parser.ReadString(section, L"LeftMouseUpAction", L"", false);
|
||||
m_MouseActions[MOUSE_LMB_DOWN] = parser.ReadString(section, L"LeftMouseDownAction", L"", false);
|
||||
m_MouseActions[MOUSE_LMB_DBLCLK] = parser.ReadString(section, L"LeftMouseDoubleClickAction", L"", false);
|
||||
m_MouseActions[MOUSE_MMB_UP] = parser.ReadString(section, L"MiddleMouseUpAction", L"", false);
|
||||
m_MouseActions[MOUSE_MMB_DOWN] = parser.ReadString(section, L"MiddleMouseDownAction", L"", false);
|
||||
m_MouseActions[MOUSE_MMB_DBLCLK] = parser.ReadString(section, L"MiddleMouseDoubleClickAction", L"", false);
|
||||
m_MouseActions[MOUSE_RMB_UP] = parser.ReadString(section, L"RightMouseUpAction", L"", false);
|
||||
m_MouseActions[MOUSE_RMB_DOWN] = parser.ReadString(section, L"RightMouseDownAction", L"", false);
|
||||
m_MouseActions[MOUSE_RMB_DBLCLK] = parser.ReadString(section, L"RightMouseDoubleClickAction", L"", false);
|
||||
m_MouseActions[MOUSE_X1MB_UP] = parser.ReadString(section, L"X1MouseUpAction", L"", false);
|
||||
m_MouseActions[MOUSE_X1MB_DOWN] = parser.ReadString(section, L"X1MouseDownAction", L"", false);
|
||||
m_MouseActions[MOUSE_X1MB_DBLCLK] = parser.ReadString(section, L"X1MouseDoubleClickAction", L"", false);
|
||||
m_MouseActions[MOUSE_X2MB_UP] = parser.ReadString(section, L"X2MouseUpAction", L"", false);
|
||||
m_MouseActions[MOUSE_X2MB_DOWN] = parser.ReadString(section, L"X2MouseDownAction", L"", false);
|
||||
m_MouseActions[MOUSE_X2MB_DBLCLK] = parser.ReadString(section, L"X2MouseDoubleClickAction", L"", false);
|
||||
|
||||
m_OverAction = parser.ReadString(section, L"MouseOverAction", L"", false);
|
||||
m_LeaveAction = parser.ReadString(section, L"MouseLeaveAction", L"", false);
|
||||
m_MouseActions[MOUSE_MW_UP] = parser.ReadString(section, L"MouseScrollUpAction", L"", false);
|
||||
m_MouseActions[MOUSE_MW_DOWN] = parser.ReadString(section, L"MouseScrollDownAction", L"", false);
|
||||
m_MouseActions[MOUSE_MW_LEFT] = parser.ReadString(section, L"MouseScrollLeftAction", L"", false);
|
||||
m_MouseActions[MOUSE_MW_RIGHT] = parser.ReadString(section, L"MouseScrollRightAction", L"", false);
|
||||
|
||||
m_MouseScrollDownAction = parser.ReadString(section, L"MouseScrollDownAction", L"", false);
|
||||
m_MouseScrollUpAction = parser.ReadString(section, L"MouseScrollUpAction", L"", false);
|
||||
m_MouseScrollLeftAction = parser.ReadString(section, L"MouseScrollLeftAction", L"", false);
|
||||
m_MouseScrollRightAction = parser.ReadString(section, L"MouseScrollRightAction", L"", false);
|
||||
if (!m_MouseScrollDownAction.empty() || !m_MouseScrollUpAction.empty() ||
|
||||
!m_MouseScrollLeftAction.empty() || !m_MouseScrollRightAction.empty())
|
||||
{
|
||||
meterWindow->SetHasMouseScrollAction();
|
||||
}
|
||||
m_MouseActions[MOUSE_OVER] = parser.ReadString(section, L"MouseOverAction", L"", false);
|
||||
m_MouseActions[MOUSE_LEAVE] = parser.ReadString(section, L"MouseLeaveAction", L"", false);
|
||||
|
||||
const bool defaultState = (section == L"Rainmeter") ? true : meterWindow->GetMouse().GetCursorState();
|
||||
if (HasScrollAction())
{
m_MeterWindow->SetHasMouseScrollAction();
}
|
||||
const bool defaultState = (section == L"Rainmeter") ? true : m_MeterWindow->GetMouse().GetCursorState();
|
||||
m_CursorState = 0!=parser.ReadInt(section, L"MouseActionCursor", defaultState);
|
||||
|
||||
const WCHAR* defaultMouseCursor = (section == L"Rainmeter") ? L"HAND" : L"";
|
||||
@ -108,16 +100,16 @@ void CMouse::ReadOptions(CConfigParser& parser, const WCHAR* section, CMeterWind
|
||||
else
|
||||
{
|
||||
// Inherit from [Rainmeter].
|
||||
m_CursorType = meterWindow->GetMouse().GetCursorType();
|
||||
m_CursorType = m_MeterWindow->GetMouse().GetCursorType();
|
||||
if (m_CursorType == MOUSECURSOR_CUSTOM)
|
||||
{
|
||||
mouseCursor = meterWindow->GetParser().ReadString(L"Rainmeter", L"MouseActionCursorName", L"").c_str();
|
||||
mouseCursor = m_MeterWindow->GetParser().ReadString(L"Rainmeter", L"MouseActionCursorName", L"").c_str();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_CursorType == MOUSECURSOR_CUSTOM)
|
||||
{
|
||||
std::wstring cursorPath = meterWindow->GetResourcesPath();
|
||||
std::wstring cursorPath = m_MeterWindow->GetResourcesPath();
|
||||
cursorPath += L"Cursors\\";
|
||||
cursorPath += mouseCursor;
|
||||
m_CustomCursor = LoadCursorFromFile(cursorPath.c_str());
|
||||
@ -173,89 +165,8 @@ HCURSOR CMouse::GetCursor() const
|
||||
|
||||
std::wstring CMouse::GetActionCommand(MOUSEACTION action) const
|
||||
{
|
||||
std::wstring command = L"";
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case MOUSE_LMB_DOWN:
|
||||
command = m_LeftDownAction;
|
||||
break;
|
||||
|
||||
case MOUSE_LMB_UP:
|
||||
command = m_LeftUpAction;
|
||||
break;
|
||||
|
||||
case MOUSE_LMB_DBLCLK:
|
||||
command = m_LeftDoubleClickAction;
|
||||
break;
|
||||
|
||||
case MOUSE_RMB_DOWN:
|
||||
command = m_RightDownAction;
|
||||
break;
|
||||
|
||||
case MOUSE_RMB_UP:
|
||||
command = m_RightUpAction;
|
||||
break;
|
||||
|
||||
case MOUSE_RMB_DBLCLK:
|
||||
command = m_RightDoubleClickAction;
|
||||
break;
|
||||
|
||||
case MOUSE_MMB_DOWN:
|
||||
command = m_MiddleDownAction;
|
||||
break;
|
||||
|
||||
case MOUSE_MMB_UP:
|
||||
command = m_MiddleUpAction;
|
||||
break;
|
||||
|
||||
case MOUSE_MMB_DBLCLK:
|
||||
command = m_MiddleDoubleClickAction;
|
||||
break;
|
||||
|
||||
case MOUSE_MW_DOWN:
|
||||
command = m_MouseScrollDownAction;
|
||||
break;
|
||||
|
||||
case MOUSE_MW_UP:
|
||||
command = m_MouseScrollUpAction;
|
||||
break;
|
||||
|
||||
case MOUSE_MW_LEFT:
|
||||
command = m_MouseScrollLeftAction;
|
||||
break;
|
||||
|
||||
case MOUSE_MW_RIGHT:
|
||||
command = m_MouseScrollRightAction;
|
||||
break;
|
||||
|
||||
case MOUSE_X1MB_DOWN:
|
||||
command = m_X1DownAction;
|
||||
break;
|
||||
|
||||
case MOUSE_X1MB_UP:
|
||||
command = m_X1UpAction;
|
||||
break;
|
||||
|
||||
case MOUSE_X1MB_DBLCLK:
|
||||
command = m_X1DoubleClickAction;
|
||||
break;
|
||||
|
||||
case MOUSE_X2MB_DOWN:
|
||||
command = m_X2DownAction;
|
||||
break;
|
||||
|
||||
case MOUSE_X2MB_UP:
|
||||
command = m_X2UpAction;
|
||||
break;
|
||||
|
||||
case MOUSE_X2MB_DBLCLK:
|
||||
command = m_X2DoubleClickAction;
|
||||
break;
|
||||
}
|
||||
|
||||
std::wstring command = m_MouseActions[action];
|
||||
ReplaceMouseVariables(command);
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
@ -319,21 +230,19 @@ void CMouse::ReplaceMouseVariables(std::wstring& result) const
|
||||
while (loop);
|
||||
}
|
||||
|
||||
std::wstring CMouse::GetMouseVariable(std::wstring variable) const
|
||||
std::wstring CMouse::GetMouseVariable(const std::wstring& variable) const
|
||||
{
|
||||
std::wstring result = L"";
|
||||
std::wstring result;
|
||||
|
||||
POINT pt;
|
||||
GetCursorPos(&pt);
|
||||
|
||||
CMeter* meter = m_MeterWindow->GetMeter(m_MeterName);
|
||||
|
||||
if (_wcsnicmp(variable.c_str(), L"MOUSEX", 6) == 0)
|
||||
{
|
||||
double xOffset = (double)(m_MeterWindow->GetX() + (meter ? meter->GetX() : 0) - 1);
|
||||
double xOffset = (double)(m_MeterWindow->GetX() + (m_Meter ? m_Meter->GetX() : 0) - 1);
|
||||
if (_wcsicmp(variable.c_str(), L"MOUSEX:%") == 0)
|
||||
{
|
||||
xOffset = ((pt.x - xOffset) / (meter ? meter->GetW() : m_MeterWindow->GetW())) * 100;
|
||||
xOffset = ((pt.x - xOffset) / (m_Meter ? m_Meter->GetW() : m_MeterWindow->GetW())) * 100;
|
||||
result = std::to_wstring((int)xOffset);
|
||||
}
|
||||
else
|
||||
@ -343,10 +252,10 @@ std::wstring CMouse::GetMouseVariable(std::wstring variable) const
|
||||
}
|
||||
else if (_wcsnicmp(variable.c_str(), L"MOUSEY", 6) == 0)
|
||||
{
|
||||
double yOffset = (double)(m_MeterWindow->GetY() + (meter ? meter->GetY() : 0) - 1);
|
||||
double yOffset = (double)(m_MeterWindow->GetY() + (m_Meter ? m_Meter->GetY() : 0) - 1);
|
||||
if (_wcsicmp(variable.c_str(), L"MOUSEY:%") == 0)
|
||||
{
|
||||
yOffset = ((pt.y - yOffset) / (meter ? meter->GetH() : m_MeterWindow->GetH())) * 100;
|
||||
yOffset = ((pt.y - yOffset) / (m_Meter ? m_Meter->GetH() : m_MeterWindow->GetH())) * 100;
|
||||
result = std::to_wstring((int)yOffset);
|
||||
}
|
||||
else
|
||||
|
138
Library/Mouse.h
138
Library/Mouse.h
@ -21,27 +21,31 @@
|
||||
|
||||
enum MOUSEACTION
|
||||
{
|
||||
MOUSE_LMB_UP = 0,
|
||||
MOUSE_LMB_DOWN,
|
||||
MOUSE_LMB_UP,
|
||||
MOUSE_LMB_DBLCLK,
|
||||
MOUSE_RMB_DOWN,
|
||||
MOUSE_RMB_UP,
|
||||
MOUSE_RMB_DBLCLK,
|
||||
MOUSE_MMB_DOWN,
|
||||
MOUSE_MMB_UP,
|
||||
MOUSE_MMB_DOWN,
|
||||
MOUSE_MMB_DBLCLK,
|
||||
MOUSE_OVER,
|
||||
MOUSE_LEAVE,
|
||||
MOUSE_MW_DOWN,
|
||||
MOUSE_RMB_UP,
|
||||
MOUSE_RMB_DOWN,
|
||||
MOUSE_RMB_DBLCLK,
|
||||
MOUSE_X1MB_UP,
|
||||
MOUSE_X1MB_DOWN,
|
||||
MOUSE_X1MB_DBLCLK,
|
||||
MOUSE_X2MB_UP,
|
||||
MOUSE_X2MB_DOWN,
|
||||
MOUSE_X2MB_DBLCLK,
|
||||
|
||||
MOUSE_MW_UP,
|
||||
MOUSE_MW_DOWN,
|
||||
MOUSE_MW_LEFT,
|
||||
MOUSE_MW_RIGHT,
|
||||
MOUSE_X1MB_DOWN,
|
||||
MOUSE_X1MB_UP,
|
||||
MOUSE_X1MB_DBLCLK,
|
||||
MOUSE_X2MB_DOWN,
|
||||
MOUSE_X2MB_UP,
|
||||
MOUSE_X2MB_DBLCLK
|
||||
|
||||
MOUSE_OVER,
|
||||
MOUSE_LEAVE,
|
||||
|
||||
MOUSEACTION_COUNT
|
||||
};
|
||||
|
||||
enum MOUSECURSOR
|
||||
@ -59,10 +63,10 @@ enum MOUSECURSOR
|
||||
class CMouse
|
||||
{
|
||||
public:
|
||||
CMouse();
|
||||
CMouse(CMeterWindow* meterWindow, CMeter* meter = NULL);
|
||||
~CMouse();
|
||||
|
||||
void ReadOptions(CConfigParser& parser, const WCHAR* section, CMeterWindow* meterWindow);
|
||||
void ReadOptions(CConfigParser& parser, const WCHAR* section);
|
||||
|
||||
MOUSECURSOR GetCursorType() const { return m_CursorType; }
|
||||
HCURSOR GetCursor() const;
|
||||
@ -70,62 +74,76 @@ public:
|
||||
|
||||
void DestroyCustomCursor();
|
||||
|
||||
bool HasActionCommand(MOUSEACTION action) const { return !m_MouseActions[action].empty(); }
|
||||
std::wstring GetActionCommand(MOUSEACTION action) const;
|
||||
|
||||
const std::wstring& GetRightDownAction() const { return m_RightDownAction; }
|
||||
const std::wstring& GetRightUpAction() const { return m_RightUpAction; }
|
||||
const std::wstring& GetRightDoubleClickAction() const { return m_RightDoubleClickAction; }
|
||||
const std::wstring& GetLeftDownAction() const { return m_LeftDownAction; }
|
||||
const std::wstring& GetLeftUpAction() const { return m_LeftUpAction; }
|
||||
const std::wstring& GetLeftDoubleClickAction() const { return m_LeftDoubleClickAction; }
|
||||
const std::wstring& GetMiddleDownAction() const { return m_MiddleDownAction; }
|
||||
const std::wstring& GetMiddleUpAction() const { return m_MiddleUpAction; }
|
||||
const std::wstring& GetMiddleDoubleClickAction() const { return m_MiddleDoubleClickAction; }
|
||||
const std::wstring& GetOverAction() const { return m_OverAction; }
|
||||
const std::wstring& GetLeaveAction() const { return m_LeaveAction; }
|
||||
const std::wstring& GetMouseScrollUpAction() const { return m_MouseScrollUpAction; }
|
||||
const std::wstring& GetMouseScrollDownAction() const { return m_MouseScrollDownAction; }
|
||||
const std::wstring& GetMouseScrollLeftAction() const { return m_MouseScrollLeftAction; }
|
||||
const std::wstring& GetMouseScrollRightAction() const { return m_MouseScrollRightAction; }
|
||||
const std::wstring& GetX1DownAction() const { return m_X1DownAction; }
|
||||
const std::wstring& GetX1UpAction() const { return m_X1UpAction; }
|
||||
const std::wstring& GetX1DoubleClickAction() const { return m_X1DoubleClickAction; }
|
||||
const std::wstring& GetX2DownAction() const { return m_X2DownAction; }
|
||||
const std::wstring& GetX2UpAction() const { return m_X2UpAction; }
|
||||
const std::wstring& GetX2DoubleClickAction() const { return m_X2DoubleClickAction; }
|
||||
bool HasButtonAction() const
|
||||
{
|
||||
return !(
|
||||
GetLeftUpAction().empty() &&
|
||||
GetLeftDownAction().empty() &&
|
||||
GetLeftDoubleClickAction().empty() &&
|
||||
GetMiddleUpAction().empty() &&
|
||||
GetMiddleDownAction().empty() &&
|
||||
GetMiddleDoubleClickAction().empty() &&
|
||||
GetRightUpAction().empty() &&
|
||||
GetRightDownAction().empty() &&
|
||||
GetRightDoubleClickAction().empty() &&
|
||||
GetX1UpAction().empty() &&
|
||||
GetX1DownAction().empty() &&
|
||||
GetX1DoubleClickAction().empty() &&
|
||||
GetX2UpAction().empty() &&
|
||||
GetX2DownAction().empty() &&
|
||||
GetX2DoubleClickAction().empty()
|
||||
);
|
||||
}
|
||||
|
||||
bool HasScrollAction() const
|
||||
{
|
||||
return !(
|
||||
GetMouseScrollUpAction().empty() &&
|
||||
GetMouseScrollDownAction().empty() &&
|
||||
GetMouseScrollLeftAction().empty() &&
|
||||
GetMouseScrollRightAction().empty()
|
||||
);
|
||||
}
|
||||
|
||||
const std::wstring& GetLeftUpAction() const { return m_MouseActions[MOUSE_LMB_UP]; }
|
||||
const std::wstring& GetLeftDownAction() const { return m_MouseActions[MOUSE_LMB_DOWN]; }
|
||||
const std::wstring& GetLeftDoubleClickAction() const { return m_MouseActions[MOUSE_LMB_DBLCLK]; }
|
||||
const std::wstring& GetMiddleUpAction() const { return m_MouseActions[MOUSE_MMB_UP]; }
|
||||
const std::wstring& GetMiddleDownAction() const { return m_MouseActions[MOUSE_MMB_DOWN]; }
|
||||
const std::wstring& GetMiddleDoubleClickAction() const { return m_MouseActions[MOUSE_MMB_DBLCLK]; }
|
||||
const std::wstring& GetRightUpAction() const { return m_MouseActions[MOUSE_RMB_UP]; }
|
||||
const std::wstring& GetRightDownAction() const { return m_MouseActions[MOUSE_RMB_DOWN]; }
|
||||
const std::wstring& GetRightDoubleClickAction() const { return m_MouseActions[MOUSE_RMB_DBLCLK]; }
|
||||
const std::wstring& GetX1UpAction() const { return m_MouseActions[MOUSE_X1MB_UP]; }
|
||||
const std::wstring& GetX1DownAction() const { return m_MouseActions[MOUSE_X1MB_DOWN]; }
|
||||
const std::wstring& GetX1DoubleClickAction() const { return m_MouseActions[MOUSE_X1MB_DBLCLK]; }
|
||||
const std::wstring& GetX2UpAction() const { return m_MouseActions[MOUSE_X2MB_UP]; }
|
||||
const std::wstring& GetX2DownAction() const { return m_MouseActions[MOUSE_X2MB_DOWN]; }
|
||||
const std::wstring& GetX2DoubleClickAction() const { return m_MouseActions[MOUSE_X2MB_DBLCLK]; }
|
||||
|
||||
const std::wstring& GetMouseScrollUpAction() const { return m_MouseActions[MOUSE_MW_UP]; }
|
||||
const std::wstring& GetMouseScrollDownAction() const { return m_MouseActions[MOUSE_MW_DOWN]; }
|
||||
const std::wstring& GetMouseScrollLeftAction() const { return m_MouseActions[MOUSE_MW_LEFT]; }
|
||||
const std::wstring& GetMouseScrollRightAction() const { return m_MouseActions[MOUSE_MW_RIGHT]; }
|
||||
|
||||
const std::wstring& GetOverAction() const { return m_MouseActions[MOUSE_OVER]; }
|
||||
const std::wstring& GetLeaveAction() const { return m_MouseActions[MOUSE_LEAVE]; }
|
||||
|
||||
private:
|
||||
void ReplaceMouseVariables(std::wstring& result) const;
|
||||
std::wstring GetMouseVariable(std::wstring variable) const;
|
||||
std::wstring GetMouseVariable(const std::wstring& variable) const;
|
||||
|
||||
std::wstring m_LeftDownAction;
|
||||
std::wstring m_RightDownAction;
|
||||
std::wstring m_MiddleDownAction;
|
||||
std::wstring m_LeftUpAction;
|
||||
std::wstring m_RightUpAction;
|
||||
std::wstring m_MiddleUpAction;
|
||||
std::wstring m_LeftDoubleClickAction;
|
||||
std::wstring m_RightDoubleClickAction;
|
||||
std::wstring m_MiddleDoubleClickAction;
|
||||
std::wstring m_OverAction;
|
||||
std::wstring m_LeaveAction;
|
||||
std::wstring m_MouseScrollDownAction;
|
||||
std::wstring m_MouseScrollUpAction;
|
||||
std::wstring m_MouseScrollLeftAction;
|
||||
std::wstring m_MouseScrollRightAction;
|
||||
std::wstring m_X1DownAction;
|
||||
std::wstring m_X1UpAction;
|
||||
std::wstring m_X1DoubleClickAction;
|
||||
std::wstring m_X2DownAction;
|
||||
std::wstring m_X2UpAction;
|
||||
std::wstring m_X2DoubleClickAction;
|
||||
std::wstring m_MouseActions[MOUSEACTION_COUNT];
|
||||
|
||||
MOUSECURSOR m_CursorType;
|
||||
HCURSOR m_CustomCursor;
|
||||
bool m_CursorState;
|
||||
|
||||
CMeterWindow* m_MeterWindow;
|
||||
std::wstring m_MeterName;
|
||||
CMeter* m_Meter;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user