Code cleanup.

This commit is contained in:
spx 2011-10-31 07:42:18 +00:00
parent 747f03ef5b
commit 6644b81909
3 changed files with 63 additions and 117 deletions

View File

@ -258,14 +258,11 @@ bool CMeterImage::Draw(Graphics& graphics)
int drawW = m_W; int drawW = m_W;
int drawH = m_H; int drawH = m_H;
GUID guid;
if (drawW == imageW && drawH == imageH && if (drawW == imageW && drawH == imageH &&
m_ScaleMargins.left == 0 && m_ScaleMargins.top == 0 && m_ScaleMargins.right == 0 && m_ScaleMargins.bottom == 0 && m_ScaleMargins.left == 0 && m_ScaleMargins.top == 0 && m_ScaleMargins.right == 0 && m_ScaleMargins.bottom == 0)
GetTransformationMatrix().IsIdentity() &&
Ok == drawBitmap->GetRawFormat(&guid) && guid != ImageFormatMemoryBMP)
{ {
CachedBitmap cache(drawBitmap, &graphics); Rect r(x, y, drawW, drawH);
graphics.DrawCachedBitmap(&cache, x, y); graphics.DrawImage(drawBitmap, r, 0, 0, imageW, imageH, UnitPixel);
} }
else if (m_Tile) else if (m_Tile)
{ {

View File

@ -71,7 +71,6 @@ CMeterWindow::CMeterWindow(const std::wstring& path, const std::wstring& config,
m_Background(), m_Background(),
m_BackgroundSize(), m_BackgroundSize(),
m_Window(), m_Window(),
m_ChildWindow(false),
m_MouseOver(false), m_MouseOver(false),
m_BackgroundMargins(), m_BackgroundMargins(),
m_DragMargins(), m_DragMargins(),
@ -108,7 +107,6 @@ CMeterWindow::CMeterWindow(const std::wstring& path, const std::wstring& config,
m_NativeTransparency(true), m_NativeTransparency(true),
m_AlphaValue(255), m_AlphaValue(255),
m_FadeDuration(250), m_FadeDuration(250),
// m_MeasuresToVariables(false),
m_WindowZPosition(ZPOSITION_NORMAL), m_WindowZPosition(ZPOSITION_NORMAL),
m_DynamicWindowSize(false), m_DynamicWindowSize(false),
m_ClickThrough(false), m_ClickThrough(false),
@ -581,8 +579,6 @@ void CMeterWindow::ChangeZPos(ZPOSITION zPos, bool all)
{ {
#define ZPOS_FLAGS (SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING) #define ZPOS_FLAGS (SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING)
if (!m_ChildWindow)
{
HWND winPos = HWND_NOTOPMOST; HWND winPos = HWND_NOTOPMOST;
m_WindowZPosition = zPos; m_WindowZPosition = zPos;
@ -659,7 +655,6 @@ void CMeterWindow::ChangeZPos(ZPOSITION zPos, bool all)
SetWindowPos(m_Window, winPos, 0, 0, 0, 0, ZPOS_FLAGS); SetWindowPos(m_Window, winPos, 0, 0, 0, 0, ZPOS_FLAGS);
} }
}
/* /*
** RunBang ** RunBang
@ -1867,7 +1862,6 @@ void CMeterWindow::ReadConfig()
m_WindowStartHidden = false; m_WindowStartHidden = false;
m_SavePosition = true; m_SavePosition = true;
m_SnapEdges = true; m_SnapEdges = true;
// m_MeasuresToVariables = false;
m_NativeTransparency = true; m_NativeTransparency = true;
m_ClickThrough = false; m_ClickThrough = false;
m_KeepOnScreen = true; m_KeepOnScreen = true;
@ -1917,7 +1911,6 @@ void CMeterWindow::ReadConfig()
m_WindowStartHidden = 0!=parser.ReadInt(section, L"StartHidden", m_WindowStartHidden); m_WindowStartHidden = 0!=parser.ReadInt(section, L"StartHidden", m_WindowStartHidden);
m_SavePosition = 0!=parser.ReadInt(section, L"SavePosition", m_SavePosition); m_SavePosition = 0!=parser.ReadInt(section, L"SavePosition", m_SavePosition);
m_SnapEdges = 0!=parser.ReadInt(section, L"SnapEdges", m_SnapEdges); m_SnapEdges = 0!=parser.ReadInt(section, L"SnapEdges", m_SnapEdges);
// m_MeasuresToVariables = 0!=parser.ReadInt(section, L"MeasuresToVariables", m_MeasuresToVariables);
m_NativeTransparency = 0!=parser.ReadInt(section, L"NativeTransparency", m_NativeTransparency); m_NativeTransparency = 0!=parser.ReadInt(section, L"NativeTransparency", m_NativeTransparency);
m_ClickThrough = 0!=parser.ReadInt(section, L"ClickThrough", m_ClickThrough); m_ClickThrough = 0!=parser.ReadInt(section, L"ClickThrough", m_ClickThrough);
m_KeepOnScreen = 0!=parser.ReadInt(section, L"KeepOnScreen", m_KeepOnScreen); m_KeepOnScreen = 0!=parser.ReadInt(section, L"KeepOnScreen", m_KeepOnScreen);
@ -2966,23 +2959,6 @@ void CMeterWindow::Update(bool nodraw)
// Post-updates // Post-updates
PostUpdate(bActiveTransition); PostUpdate(bActiveTransition);
// if (m_MeasuresToVariables) // BUG: LSSetVariable doens't seem to work for some reason.
// {
// std::list<CMeasure*>::iterator i = m_Measures.begin();
// for ( ; i != m_Measures.end(); i++)
// {
// const char* sz = (*i)->GetStringValue(AUTOSCALE_ON, 1, 1, false);
// if (sz && wcslen(sz) > 0)
// {
// WCHAR* wideSz = CMeter::ConvertToWide(sz);
// WCHAR* wideName = CMeter::ConvertToWide((*i)->GetName());
// LSSetVariable(wideName, wideSz);
// delete [] wideSz;
// delete [] wideName;
// }
// }
// }
} }
/* /*
@ -3060,17 +3036,6 @@ LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
Update(false); Update(false);
CDialogAbout::UpdateMeasures(m_SkinName.c_str()); CDialogAbout::UpdateMeasures(m_SkinName.c_str());
//if (m_KeepOnScreen)
//{
// int x = m_ScreenX;
// int y = m_ScreenY;
// MapCoordsToScreen(x, y, m_WindowW, m_WindowH);
// if (x != m_ScreenX || y != m_ScreenY)
// {
// MoveWindow(x, y);
// }
//}
} }
else if (wParam == TRANSITIONTIMER) else if (wParam == TRANSITIONTIMER)
{ {
@ -3172,20 +3137,6 @@ LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
} }
// // TEST
// if (!m_ChildWindow)
// {
// RECT rect;
// GetWindowRect(m_Window, &rect);
// if (rect.left != m_WindowX && rect.top != m_WindowY)
// {
// LogWithArgs(LOG_DEBUG, L"Window position has been changed. Moving it back to the place it belongs.");
// SetWindowPos(m_Window, NULL, m_WindowX, m_WindowY, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
// }
// }
// ~TEST
return 0; return 0;
} }

View File

@ -356,7 +356,6 @@ private:
SIZE m_BackgroundSize; SIZE m_BackgroundSize;
HWND m_Window; // Handle to the Rainmeter window HWND m_Window; // Handle to the Rainmeter window
bool m_ChildWindow;
std::wstring m_RightMouseDownAction; // Action to run when right mouse is pressed std::wstring m_RightMouseDownAction; // Action to run when right mouse is pressed
std::wstring m_LeftMouseDownAction; // Action to run when left mouse is pressed std::wstring m_LeftMouseDownAction; // Action to run when left mouse is pressed
@ -413,7 +412,6 @@ private:
bool m_NativeTransparency; // If true, use the W2k/XP native transparency bool m_NativeTransparency; // If true, use the W2k/XP native transparency
int m_AlphaValue; // The 'from' transparency value 0 - 255 int m_AlphaValue; // The 'from' transparency value 0 - 255
int m_FadeDuration; // Time it takes to fade the window int m_FadeDuration; // Time it takes to fade the window
// bool m_MeasuresToVariables; // If true, Measured values are transformed to Litestep's eVars
ZPOSITION m_WindowZPosition; // Window's Z-position ZPOSITION m_WindowZPosition; // Window's Z-position
bool m_DynamicWindowSize; // bool m_DynamicWindowSize; //
bool m_ClickThrough; // bool m_ClickThrough; //