Enabled @include to use variables.

Fixed the issue that the window becomes invalid when both window width and height are 0.
This commit is contained in:
spx 2010-05-27 22:03:09 +00:00
parent 3640c60810
commit 56f1c6a38d
2 changed files with 32 additions and 15 deletions

View File

@ -934,6 +934,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, int depth)
if (wcsnicmp(strKey.c_str(), L"@include", 8) == 0) if (wcsnicmp(strKey.c_str(), L"@include", 8) == 0)
{ {
std::wstring strIncludeFile = buffer; std::wstring strIncludeFile = buffer;
ReadVariables();
ReplaceVariables(strIncludeFile); ReplaceVariables(strIncludeFile);
if (strIncludeFile.find(L':') == std::wstring::npos && if (strIncludeFile.find(L':') == std::wstring::npos &&
(strIncludeFile.length() < 2 || (strIncludeFile[0] != L'\\' && strIncludeFile[0] != L'/') || (strIncludeFile[1] != L'\\' && strIncludeFile[1] != L'/'))) (strIncludeFile.length() < 2 || (strIncludeFile[0] != L'\\' && strIncludeFile[0] != L'/') || (strIncludeFile[1] != L'\\' && strIncludeFile[1] != L'/')))

View File

@ -2100,7 +2100,15 @@ void CMeterWindow::Redraw()
} }
if (m_DoubleBuffer) delete m_DoubleBuffer; if (m_DoubleBuffer) delete m_DoubleBuffer;
if (m_WindowW == 0 && m_WindowH == 0)
{
// Create a dummy bitmap to avoid invalid state
m_DoubleBuffer = new Bitmap(1, 1, PixelFormat32bppARGB);
}
else
{
m_DoubleBuffer = new Bitmap(m_WindowW, m_WindowH, PixelFormat32bppARGB); m_DoubleBuffer = new Bitmap(m_WindowW, m_WindowH, PixelFormat32bppARGB);
}
Graphics graphics(GetDoubleBuffer()); Graphics graphics(GetDoubleBuffer());
@ -2270,6 +2278,13 @@ void CMeterWindow::UpdateTransparency(int alpha, bool reset)
typedef BOOL (WINAPI * FPUPDATELAYEREDWINDOW)(HWND hWnd, HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags); typedef BOOL (WINAPI * FPUPDATELAYEREDWINDOW)(HWND hWnd, HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags);
FPUPDATELAYEREDWINDOW UpdateLayeredWindow = (FPUPDATELAYEREDWINDOW)GetProcAddress(m_User32Library, "UpdateLayeredWindow"); FPUPDATELAYEREDWINDOW UpdateLayeredWindow = (FPUPDATELAYEREDWINDOW)GetProcAddress(m_User32Library, "UpdateLayeredWindow");
if (m_WindowW == 0 && m_WindowH == 0)
{
// Reset window to avoid invalid state
UpdateLayeredWindow(m_Window, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0);
}
else
{
BLENDFUNCTION blendPixelFunction= {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA}; BLENDFUNCTION blendPixelFunction= {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA};
POINT ptWindowScreenPosition = {m_ScreenX, m_ScreenY}; POINT ptWindowScreenPosition = {m_ScreenX, m_ScreenY};
POINT ptSrc = {0, 0}; POINT ptSrc = {0, 0};
@ -2286,6 +2301,7 @@ void CMeterWindow::UpdateTransparency(int alpha, bool reset)
SelectObject(dcMemory, oldBitmap); SelectObject(dcMemory, oldBitmap);
DeleteDC(dcMemory); DeleteDC(dcMemory);
DeleteObject(dbBitmap); DeleteObject(dbBitmap);
}
m_TransparencyValue = alpha; m_TransparencyValue = alpha;
} }