mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Cosmetics
This commit is contained in:
parent
fadd1596f8
commit
3cf1f43846
@ -136,7 +136,7 @@ CMeterWindow::CMeterWindow(const std::wstring& config, const std::wstring& iniFi
|
|||||||
m_TransparencyValue(),
|
m_TransparencyValue(),
|
||||||
m_Refreshing(false),
|
m_Refreshing(false),
|
||||||
m_Hidden(false),
|
m_Hidden(false),
|
||||||
m_ResetRegion(false),
|
m_ResizeWindow(false),
|
||||||
m_UpdateCounter(),
|
m_UpdateCounter(),
|
||||||
m_MouseMoveCounter(),
|
m_MouseMoveCounter(),
|
||||||
m_FontCollection(),
|
m_FontCollection(),
|
||||||
@ -409,7 +409,7 @@ void CMeterWindow::Refresh(bool init, bool all)
|
|||||||
m_Hidden = m_WindowStartHidden;
|
m_Hidden = m_WindowStartHidden;
|
||||||
|
|
||||||
// Set the window region
|
// Set the window region
|
||||||
UpdateTransparency(m_AlphaValue, true); // Add/Remove layered flag
|
UpdateWindow(m_AlphaValue, true); // Add/Remove layered flag
|
||||||
Update(false);
|
Update(false);
|
||||||
|
|
||||||
if (m_BlurMode == BLURMODE_NONE)
|
if (m_BlurMode == BLURMODE_NONE)
|
||||||
@ -800,7 +800,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const std::vector<std::wstring>& ar
|
|||||||
case BANG_SHOW:
|
case BANG_SHOW:
|
||||||
m_Hidden = false;
|
m_Hidden = false;
|
||||||
ShowWindow(m_Window, SW_SHOWNOACTIVATE);
|
ShowWindow(m_Window, SW_SHOWNOACTIVATE);
|
||||||
UpdateTransparency((m_WindowHide == HIDEMODE_FADEOUT) ? 255 : m_AlphaValue, false);
|
UpdateWindow((m_WindowHide == HIDEMODE_FADEOUT) ? 255 : m_AlphaValue, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BANG_HIDE:
|
case BANG_HIDE:
|
||||||
@ -870,7 +870,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const std::vector<std::wstring>& ar
|
|||||||
m_AlphaValue = CConfigParser::ParseInt(arg.c_str(), 255);
|
m_AlphaValue = CConfigParser::ParseInt(arg.c_str(), 255);
|
||||||
m_AlphaValue = max(m_AlphaValue, 0);
|
m_AlphaValue = max(m_AlphaValue, 0);
|
||||||
m_AlphaValue = min(m_AlphaValue, 255);
|
m_AlphaValue = min(m_AlphaValue, 255);
|
||||||
UpdateTransparency(m_AlphaValue, false);
|
UpdateWindow(m_AlphaValue, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1104,7 +1104,7 @@ void CMeterWindow::ShowMeter(const std::wstring& name, bool group)
|
|||||||
if (CompareName((*j), meter, group))
|
if (CompareName((*j), meter, group))
|
||||||
{
|
{
|
||||||
(*j)->Show();
|
(*j)->Show();
|
||||||
m_ResetRegion = true; // Need to recalculate the window region
|
m_ResizeWindow = true; // Need to recalculate the window region
|
||||||
if (!group) return;
|
if (!group) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1126,7 +1126,7 @@ void CMeterWindow::HideMeter(const std::wstring& name, bool group)
|
|||||||
if (CompareName((*j), meter, group))
|
if (CompareName((*j), meter, group))
|
||||||
{
|
{
|
||||||
(*j)->Hide();
|
(*j)->Hide();
|
||||||
m_ResetRegion = true; // Need to recalculate the windowregion
|
m_ResizeWindow = true; // Need to recalculate the windowregion
|
||||||
if (!group) return;
|
if (!group) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1155,7 +1155,7 @@ void CMeterWindow::ToggleMeter(const std::wstring& name, bool group)
|
|||||||
{
|
{
|
||||||
(*j)->Hide();
|
(*j)->Hide();
|
||||||
}
|
}
|
||||||
m_ResetRegion = true; // Need to recalculate the window region
|
m_ResizeWindow = true; // Need to recalculate the window region
|
||||||
if (!group) return;
|
if (!group) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1178,7 +1178,7 @@ void CMeterWindow::MoveMeter(const std::wstring& name, int x, int y)
|
|||||||
{
|
{
|
||||||
(*j)->SetX(x);
|
(*j)->SetX(x);
|
||||||
(*j)->SetY(y);
|
(*j)->SetY(y);
|
||||||
m_ResetRegion = true; // Need to recalculate the window region
|
m_ResizeWindow = true; // Need to recalculate the window region
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1202,7 +1202,7 @@ void CMeterWindow::UpdateMeter(const std::wstring& name, bool group)
|
|||||||
if (bContinue && CompareName((*j), meter, group))
|
if (bContinue && CompareName((*j), meter, group))
|
||||||
{
|
{
|
||||||
UpdateMeter((*j), bActiveTransition, true);
|
UpdateMeter((*j), bActiveTransition, true);
|
||||||
m_ResetRegion = true; // Need to recalculate the windowregion
|
m_ResizeWindow = true; // Need to recalculate the window region
|
||||||
if (!group)
|
if (!group)
|
||||||
{
|
{
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
@ -2487,9 +2487,10 @@ void CMeterWindow::CreateDoubleBuffer(int cx, int cy)
|
|||||||
*/
|
*/
|
||||||
void CMeterWindow::Redraw()
|
void CMeterWindow::Redraw()
|
||||||
{
|
{
|
||||||
if (m_ResetRegion)
|
if (m_ResizeWindow)
|
||||||
{
|
{
|
||||||
ResizeWindow(false);
|
ResizeWindow(false);
|
||||||
|
m_ResizeWindow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create or clear the doublebuffer
|
// Create or clear the doublebuffer
|
||||||
@ -2586,12 +2587,7 @@ void CMeterWindow::Redraw()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ResetRegion || !m_BackgroundName.empty())
|
UpdateWindow(m_TransparencyValue, false);
|
||||||
{
|
|
||||||
m_ResetRegion = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateTransparency(m_TransparencyValue, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2751,12 +2747,12 @@ void CMeterWindow::Update(bool nodraw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Redraw all meters
|
// Redraw all meters
|
||||||
if (!nodraw && (bUpdate || m_ResetRegion || m_Refreshing))
|
if (!nodraw && (bUpdate || m_ResizeWindow || m_Refreshing))
|
||||||
{
|
{
|
||||||
if (m_DynamicWindowSize)
|
if (m_DynamicWindowSize)
|
||||||
{
|
{
|
||||||
// Resize the window
|
// Resize the window
|
||||||
m_ResetRegion = true;
|
m_ResizeWindow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If our option is to disable when in an RDP session, then check if in an RDP session.
|
// If our option is to disable when in an RDP session, then check if in an RDP session.
|
||||||
@ -2772,9 +2768,10 @@ void CMeterWindow::Update(bool nodraw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Updates the native Windows transparency
|
** Updates the window contents
|
||||||
|
**
|
||||||
*/
|
*/
|
||||||
void CMeterWindow::UpdateTransparency(int alpha, bool reset)
|
void CMeterWindow::UpdateWindow(int alpha, bool reset)
|
||||||
{
|
{
|
||||||
if (reset)
|
if (reset)
|
||||||
{
|
{
|
||||||
@ -2805,23 +2802,6 @@ void CMeterWindow::UpdateTransparency(int alpha, bool reset)
|
|||||||
m_TransparencyValue = alpha;
|
m_TransparencyValue = alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
** Repaints the window. This does not cause update of the measures.
|
|
||||||
** This handler is called if NativeTransparency is false.
|
|
||||||
**
|
|
||||||
*/
|
|
||||||
LRESULT CMeterWindow::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
PAINTSTRUCT ps;
|
|
||||||
HDC winDC = BeginPaint(m_Window, &ps);
|
|
||||||
|
|
||||||
Graphics graphics(winDC);
|
|
||||||
graphics.DrawImage(m_DoubleBuffer, 0, 0);
|
|
||||||
|
|
||||||
EndPaint(m_Window, &ps);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Handles the timers. The METERTIMER updates all the measures
|
** Handles the timers. The METERTIMER updates all the measures
|
||||||
** MOUSETIMER is used to hide/show the window.
|
** MOUSETIMER is used to hide/show the window.
|
||||||
@ -2917,7 +2897,7 @@ LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateTransparency(m_FadeEndValue, false);
|
UpdateWindow(m_FadeEndValue, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2929,7 +2909,7 @@ LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
value = min(value, 255);
|
value = min(value, 255);
|
||||||
value = max(value, 0);
|
value = max(value, 0);
|
||||||
|
|
||||||
UpdateTransparency((int)value, false);
|
UpdateWindow((int)value, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wParam == TIMER_DEACTIVATE)
|
else if (wParam == TIMER_DEACTIVATE)
|
||||||
@ -2956,7 +2936,7 @@ void CMeterWindow::FadeWindow(int from, int to)
|
|||||||
{
|
{
|
||||||
if (m_FadeDuration == 0)
|
if (m_FadeDuration == 0)
|
||||||
{
|
{
|
||||||
UpdateTransparency(to, false);
|
UpdateWindow(to, false);
|
||||||
}
|
}
|
||||||
if (from == 0)
|
if (from == 0)
|
||||||
{
|
{
|
||||||
@ -2971,7 +2951,7 @@ void CMeterWindow::FadeWindow(int from, int to)
|
|||||||
{
|
{
|
||||||
m_FadeStartValue = from;
|
m_FadeStartValue = from;
|
||||||
m_FadeEndValue = to;
|
m_FadeEndValue = to;
|
||||||
UpdateTransparency(from, false);
|
UpdateWindow(from, false);
|
||||||
if (from == 0)
|
if (from == 0)
|
||||||
{
|
{
|
||||||
if (!m_Hidden)
|
if (!m_Hidden)
|
||||||
@ -3379,7 +3359,7 @@ LRESULT CMeterWindow::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
else if (wParam >= IDM_SKIN_TRANSPARENCY_0 && wParam <= IDM_SKIN_TRANSPARENCY_90)
|
else if (wParam >= IDM_SKIN_TRANSPARENCY_0 && wParam <= IDM_SKIN_TRANSPARENCY_90)
|
||||||
{
|
{
|
||||||
m_AlphaValue = (int)(255.0 - (wParam - IDM_SKIN_TRANSPARENCY_0) * (230.0 / (IDM_SKIN_TRANSPARENCY_90 - IDM_SKIN_TRANSPARENCY_0)));
|
m_AlphaValue = (int)(255.0 - (wParam - IDM_SKIN_TRANSPARENCY_0) * (230.0 / (IDM_SKIN_TRANSPARENCY_90 - IDM_SKIN_TRANSPARENCY_0)));
|
||||||
UpdateTransparency(m_AlphaValue, false);
|
UpdateWindow(m_AlphaValue, false);
|
||||||
WriteConfig(SETTING_ALPHAVALUE);
|
WriteConfig(SETTING_ALPHAVALUE);
|
||||||
}
|
}
|
||||||
else if (wParam == IDM_CLOSESKIN)
|
else if (wParam == IDM_CLOSESKIN)
|
||||||
@ -3556,7 +3536,7 @@ void CMeterWindow::SetSnapEdges(bool b)
|
|||||||
void CMeterWindow::SetWindowHide(HIDEMODE hide)
|
void CMeterWindow::SetWindowHide(HIDEMODE hide)
|
||||||
{
|
{
|
||||||
m_WindowHide = hide;
|
m_WindowHide = hide;
|
||||||
UpdateTransparency(m_AlphaValue, false);
|
UpdateWindow(m_AlphaValue, false);
|
||||||
WriteConfig(SETTING_HIDEONMOUSEOVER);
|
WriteConfig(SETTING_HIDEONMOUSEOVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3608,7 +3588,7 @@ LRESULT CMeterWindow::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
HandleButtons(pos, BUTTONPROC_UP, false); // redraw only
|
HandleButtons(pos, BUTTONPROC_UP, false); // redraw only
|
||||||
|
|
||||||
// Workaround for the system that the window size is changed incorrectly when the window is dragged over the upper side of the virtual screen
|
// Workaround for the system that the window size is changed incorrectly when the window is dragged over the upper side of the virtual screen
|
||||||
UpdateTransparency(m_TransparencyValue, false);
|
UpdateWindow(m_TransparencyValue, false);
|
||||||
}
|
}
|
||||||
else // not dragged
|
else // not dragged
|
||||||
{
|
{
|
||||||
@ -4498,7 +4478,6 @@ LRESULT CALLBACK CMeterWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
CMeterWindow* window = (CMeterWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
CMeterWindow* window = (CMeterWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
|
||||||
|
|
||||||
BEGIN_MESSAGEPROC
|
BEGIN_MESSAGEPROC
|
||||||
MESSAGE(OnPaint, WM_PAINT)
|
|
||||||
MESSAGE(OnMove, WM_MOVE)
|
MESSAGE(OnMove, WM_MOVE)
|
||||||
MESSAGE(OnTimer, WM_TIMER)
|
MESSAGE(OnTimer, WM_TIMER)
|
||||||
MESSAGE(OnCommand, WM_COMMAND)
|
MESSAGE(OnCommand, WM_COMMAND)
|
||||||
|
@ -179,7 +179,7 @@ public:
|
|||||||
void Deactivate();
|
void Deactivate();
|
||||||
void Refresh(bool init, bool all = false);
|
void Refresh(bool init, bool all = false);
|
||||||
void Redraw();
|
void Redraw();
|
||||||
void RedrawWindow() { UpdateTransparency(m_TransparencyValue, false); }
|
void RedrawWindow() { UpdateWindow(m_TransparencyValue, false); }
|
||||||
void SetVariable(const std::wstring& variable, const std::wstring& value);
|
void SetVariable(const std::wstring& variable, const std::wstring& value);
|
||||||
void SetOption(const std::wstring& section, const std::wstring& option, const std::wstring& value, bool group);
|
void SetOption(const std::wstring& section, const std::wstring& option, const std::wstring& value, bool group);
|
||||||
|
|
||||||
@ -251,7 +251,6 @@ 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);
|
||||||
static LRESULT CALLBACK InitialWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK InitialWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
||||||
LRESULT OnMove(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
LRESULT OnMove(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
@ -311,7 +310,7 @@ private:
|
|||||||
bool UpdateMeasure(CMeasure* measure, bool force);
|
bool UpdateMeasure(CMeasure* measure, bool force);
|
||||||
bool UpdateMeter(CMeter* meter, bool& bActiveTransition, bool force);
|
bool UpdateMeter(CMeter* meter, bool& bActiveTransition, bool force);
|
||||||
void Update(bool nodraw);
|
void Update(bool nodraw);
|
||||||
void UpdateTransparency(int alpha, bool reset);
|
void UpdateWindow(int alpha, bool reset);
|
||||||
void ReadConfig();
|
void ReadConfig();
|
||||||
void WriteConfig(INT setting = SETTING_ALL);
|
void WriteConfig(INT setting = SETTING_ALL);
|
||||||
bool ReadSkin();
|
bool ReadSkin();
|
||||||
@ -434,7 +433,7 @@ private:
|
|||||||
bool m_Refreshing; // This is true, when the meter is refreshing
|
bool m_Refreshing; // This is true, when the meter is refreshing
|
||||||
|
|
||||||
bool m_Hidden; // True, if Rainmeter is hidden
|
bool m_Hidden; // True, if Rainmeter is hidden
|
||||||
bool m_ResetRegion; // If true, the window region is recalculated during the next update
|
bool m_ResizeWindow; // If true, the window size is recalculated during the next update
|
||||||
|
|
||||||
std::list<CMeasure*> m_Measures; // All the measures
|
std::list<CMeasure*> m_Measures; // All the measures
|
||||||
std::list<CMeter*> m_Meters; // All the meters
|
std::list<CMeter*> m_Meters; // All the meters
|
||||||
|
Loading…
x
Reference in New Issue
Block a user