From d4eaaec055bbdc940f5758cc1fd7b22b2cb105d8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 4 Mar 2013 16:05:07 +0000 Subject: further code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@3883 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/themes.cpp | 485 +++++++++++------------------------------ 1 file changed, 132 insertions(+), 353 deletions(-) (limited to 'plugins/TabSRMM/src/themes.cpp') diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 9afa313492..a40902dc0d 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -1406,227 +1406,6 @@ void CSkin::ReadImageItem(const TCHAR *itemname) delete szImageFileName; } -/* DISABLED code - -void CSkin::ReadButtonItem(const TCHAR *itemName) const -{ - ButtonItem tmpItem, *newItem; - TCHAR szBuffer[1024]; - char szBufferA[1024]; - CImageItem *imgItem = m_ImageItems; - HICON *phIcon; - - ZeroMemory(&tmpItem, sizeof(tmpItem)); - mir_snprintf(tmpItem.szName, safe_sizeof(tmpItem.szName), "%s", &szItemNameA[1]); - tmpItem.width = GetPrivateProfileInt(itemName, _T("Width"), 16, m_tszFileName); - tmpItem.height = GetPrivateProfileInt(itemName,_T( "Height"), 16, m_tszFileName); - tmpItem.xOff = GetPrivateProfileInt(itemName, _T("xoff"), 0, m_tszFileName); - tmpItem.yOff = GetPrivateProfileInt(itemName, _T("yoff"), 0, m_tszFileName); - - tmpItem.dwFlags |= GetPrivateProfileInt(itemName, _T("toggle"), 0, m_tszFileName) ? BUTTON_ISTOGGLE : 0; - - GetPrivateProfileString(itemName, _T("Pressed"), _T("None"), szBuffer, 1000, m_tszFileName); - if (!_tcsicmp(szBuffer, _T("default"))) - tmpItem.imgPressed = SkinItems[ID_EXTBKBUTTONSPRESSED].imageItem; - else { - while (imgItem) { - if (!_tcsicmp(imgItem->getName(), szBuffer)) { - tmpItem.imgPressed = imgItem; - break; - } - imgItem = imgItem->getNextItem(); - } - } - - imgItem = m_ImageItems; - GetPrivateProfileString(itemName, _T("Normal"), _T("None"), szBuffer, 1000, m_tszFileName); - if (!_tcsicmp(szBuffer, _T("default"))) - tmpItem.imgNormal = SkinItems[ID_EXTBKBUTTONSNPRESSED].imageItem; - else { - while (imgItem) { - if (!_tcsicmp(imgItem->getName(), szBuffer)) { - tmpItem.imgNormal = imgItem; - break; - } - imgItem = imgItem->getNextItem(); - } - } - - imgItem = m_ImageItems; - GetPrivateProfileString(itemName, _T("Hover"), _T("None"), szBuffer, 1000, m_tszFileName); - if (!_tcsicmp(szBuffer, _T("default"))) - tmpItem.imgHover = SkinItems[ID_EXTBKBUTTONSMOUSEOVER].imageItem; - else { - while (imgItem) { - if (!_tcsicmp(imgItem->getName(), szBuffer)) { - tmpItem.imgHover = imgItem; - break; - } - imgItem = imgItem->getNextItem(); - } - } - - tmpItem.uId = IDC_TBFIRSTUID - 1; - tmpItem.pfnAction = tmpItem.pfnCallback = NULL; - - GetPrivateProfileString(itemName, _T("Action"), _T("Custom"), szBuffer, 1000, m_tszFileName); - if (!_tcsicmp(szBuffer, _T("service"))) { - tmpItem.szService[0] = 0; - GetPrivateProfileStringA(szItemNameA, "Service", "None", szBufferA, 1000, szFileNameA); - if (_stricmp(szBufferA, "None")) { - mir_snprintf(tmpItem.szService, 256, "%s", szBufferA); - tmpItem.dwFlags |= BUTTON_ISSERVICE; - tmpItem.uId = nextButtonID++; - } - } else if (!_tcsicmp(szBuffer, _T("protoservice"))) { - tmpItem.szService[0] = 0; - GetPrivateProfileStringA(szItemNameA, "Service", "None", szBufferA, 1000, szFileNameA); - if (_stricmp(szBufferA, "None")) { - mir_snprintf(tmpItem.szService, 256, "%s", szBufferA); - tmpItem.dwFlags |= BUTTON_ISPROTOSERVICE; - tmpItem.uId = nextButtonID++; - } - } else if (!_tcsicmp(szBuffer, _T("database"))) { - int n; - - GetPrivateProfileStringA(szItemNameA, "Module", "None", szBufferA, 1000, szFileNameA); - if (_stricmp(szBufferA, "None")) - mir_snprintf(tmpItem.szModule, 256, "%s", szBufferA); - GetPrivateProfileStringA(szItemNameA, "Setting", "None", szBufferA, 1000, szFileNameA); - if (_stricmp(szBufferA, "None")) - mir_snprintf(tmpItem.szSetting, 256, "%s", szBufferA); - if (GetPrivateProfileIntA(szItemNameA, "contact", 0, szFileNameA) != 0) - tmpItem.dwFlags |= BUTTON_DBACTIONONCONTACT; - - for (n = 0; n <= 1; n++) { - char szKey[20]; - BYTE *pValue; - - strcpy(szKey, n == 0 ? "dbonpush" : "dbonrelease"); - pValue = (n == 0 ? tmpItem.bValuePush : tmpItem.bValueRelease); - - GetPrivateProfileStringA(szItemNameA, szKey, "None", szBufferA, 1000, szFileNameA); - switch (szBufferA[0]) { - case 'b': { - BYTE value = (BYTE)atol(&szBufferA[1]); - pValue[0] = value; - tmpItem.type = DBVT_BYTE; - break; - } - case 'w': { - WORD value = (WORD)atol(&szBufferA[1]); - *((WORD *)&pValue[0]) = value; - tmpItem.type = DBVT_WORD; - break; - } - case 'd': { - DWORD value = (DWORD)atol(&szBufferA[1]); - *((DWORD *)&pValue[0]) = value; - tmpItem.type = DBVT_DWORD; - break; - } - case 's': { - mir_snprintf((char *)pValue, 256, &szBufferA[1]); - tmpItem.type = DBVT_ASCIIZ; - break; - } - } - } - if (tmpItem.szModule[0] && tmpItem.szSetting[0]) { - tmpItem.dwFlags |= BUTTON_ISDBACTION; - if (tmpItem.szModule[0] == '$' && (tmpItem.szModule[1] == 'c' || tmpItem.szModule[1] == 'C')) - tmpItem.dwFlags |= BUTTON_ISCONTACTDBACTION; - tmpItem.uId = nextButtonID++; - } - } else if (_tcsicmp(szBuffer, _T("Custom"))) { - if (BTN_GetStockItem(&tmpItem, szBuffer)) - goto create_it; - } - GetPrivateProfileString(itemName, _T("PassContact"), _T("None"), szBuffer, 1000, m_tszFileName); - if (_tcsicmp(szBuffer, _T("None"))) { - if (szBuffer[0] == 'w' || szBuffer[0] == 'W') - tmpItem.dwFlags |= BUTTON_PASSHCONTACTW; - else if (szBuffer[0] == 'l' || szBuffer[0] == 'L') - tmpItem.dwFlags |= BUTTON_PASSHCONTACTL; - } - - GetPrivateProfileString(itemName, _T("Tip"), _T("None"), szBuffer, 1000, m_tszFileName); - if (_tcsicmp(szBuffer, _T("None"))) { - mir_sntprintf(tmpItem.szTip, 256, _T("%s"), szBuffer); - } else - tmpItem.szTip[0] = 0; - -create_it: - - GetPrivateProfileString(itemName, _T("Label"), _T("None"), szBuffer, 40, m_tszFileName); - if (_tcsicmp(szBuffer, _T("None"))) { - mir_sntprintf(tmpItem.tszLabel, 40, _T("%s"), szBuffer); - tmpItem.dwFlags |= BUTTON_HASLABEL; - } else - tmpItem.tszLabel[0] = 0; - - GetPrivateProfileString(itemName, _T("NormalGlyph"), _T("0, 0, 0, 0"), szBuffer, 1000, m_tszFileName); - if (_tcsicmp(szBuffer, _T("default"))) { - tmpItem.dwFlags &= ~BUTTON_NORMALGLYPHISICON; - if ((phIcon = BTN_GetIcon(szBuffer)) != 0) { - tmpItem.dwFlags |= BUTTON_NORMALGLYPHISICON; - tmpItem.normalGlyphMetrics[0] = (LONG_PTR)phIcon; - } else { - _tscanf(szBuffer, _T("%d,%d,%d,%d"), &tmpItem.normalGlyphMetrics[0], &tmpItem.normalGlyphMetrics[1], - &tmpItem.normalGlyphMetrics[2], &tmpItem.normalGlyphMetrics[3]); - tmpItem.normalGlyphMetrics[2] = (tmpItem.normalGlyphMetrics[2] - tmpItem.normalGlyphMetrics[0]) + 1; - tmpItem.normalGlyphMetrics[3] = (tmpItem.normalGlyphMetrics[3] - tmpItem.normalGlyphMetrics[1]) + 1; - } - } - - GetPrivateProfileString(itemName, _T("PressedGlyph"), _T("0, 0, 0, 0"), szBuffer, 1000, m_tszFileName); - if (_tcsicmp(szBuffer, _T("default"))) { - tmpItem.dwFlags &= ~BUTTON_PRESSEDGLYPHISICON; - if ((phIcon = BTN_GetIcon(szBuffer)) != 0) { - tmpItem.pressedGlyphMetrics[0] = (LONG_PTR)phIcon; - tmpItem.dwFlags |= BUTTON_PRESSEDGLYPHISICON; - } else { - _tscanf(szBuffer, _T("%d,%d,%d,%d"), &tmpItem.pressedGlyphMetrics[0], &tmpItem.pressedGlyphMetrics[1], - &tmpItem.pressedGlyphMetrics[2], &tmpItem.pressedGlyphMetrics[3]); - tmpItem.pressedGlyphMetrics[2] = (tmpItem.pressedGlyphMetrics[2] - tmpItem.pressedGlyphMetrics[0]) + 1; - tmpItem.pressedGlyphMetrics[3] = (tmpItem.pressedGlyphMetrics[3] - tmpItem.pressedGlyphMetrics[1]) + 1; - } - } - - GetPrivateProfileString(itemName, _T("HoverGlyph"), _T("0, 0, 0, 0"), szBuffer, 1000, m_tszFileName); - if (_tcsicmp(szBuffer, _T("default"))) { - tmpItem.dwFlags &= ~BUTTON_HOVERGLYPHISICON; - if ((phIcon = BTN_GetIcon(szBuffer)) != 0) { - tmpItem.hoverGlyphMetrics[0] = (LONG_PTR)phIcon; - tmpItem.dwFlags |= BUTTON_HOVERGLYPHISICON; - } else { - _tscanf(szBuffer, _T("%d,%d,%d,%d"), &tmpItem.hoverGlyphMetrics[0], &tmpItem.hoverGlyphMetrics[1], - &tmpItem.hoverGlyphMetrics[2], &tmpItem.hoverGlyphMetrics[3]); - tmpItem.hoverGlyphMetrics[2] = (tmpItem.hoverGlyphMetrics[2] - tmpItem.hoverGlyphMetrics[0]) + 1; - tmpItem.hoverGlyphMetrics[3] = (tmpItem.hoverGlyphMetrics[3] - tmpItem.hoverGlyphMetrics[1]) + 1; - } - } - - newItem = (ButtonItem *)malloc(sizeof(ButtonItem)); - ZeroMemory(newItem, sizeof(ButtonItem)); - if (g_ButtonSet.items == NULL) { - g_ButtonSet.items = newItem; - *newItem = tmpItem; - newItem->nextItem = 0; - } else { - ButtonItem *curItem = g_ButtonSet.items; - while (curItem->nextItem) - curItem = curItem->nextItem; - *newItem = tmpItem; - newItem->nextItem = 0; - curItem->nextItem = newItem; - } - mir_free((void*)szItemNameA); - return; -} - -*/ - /** * Load the skin from the .tsk file * It reads and initializes all static values for the skin. Afterwards @@ -1645,158 +1424,156 @@ void CSkin::Load(void) m_fHaveGlyph = false; - if (m_tszFileName[0]) { - if (::PathFileExists(m_tszFileName)) { - TCHAR *p; - TCHAR *szSections = (TCHAR *)malloc(6004); - int i = 1, j = 0; - UINT data; - TCHAR buffer[500]; + if ( !m_tszFileName[0] || !::PathFileExists(m_tszFileName)) + return; - if (!(GetPrivateProfileInt(_T("Global"), _T("Version"), 0, m_tszFileName) >= 1 && - GetPrivateProfileInt(_T("Global"), _T("Signature"), 0, m_tszFileName) == 101)) - return; + TCHAR *p; + TCHAR *szSections = (TCHAR *)malloc(6004); + int i = 1, j = 0; + UINT data; + TCHAR buffer[500]; - i = 0; - while (_tagSettings[i].szIniKey != NULL) { - data = 0; - data = GetPrivateProfileInt(_tagSettings[i].szIniKey, _tagSettings[i].szIniName, - _tagSettings[i].defaultval, m_tszFileName); - switch (_tagSettings[i].size) { - case 1: - M->WriteByte(SRMSGMOD_T, _tagSettings[i].szSetting, (BYTE)data); - break; - case 4: - M->WriteDword(SRMSGMOD_T, _tagSettings[i].szSetting, data); - break; - case 2: - DBWriteContactSettingWord(NULL, SRMSGMOD_T, _tagSettings[i].szSetting, (WORD)data); - break; - case 5: - GetPrivateProfileString(_tagSettings[i].szIniKey, _tagSettings[i].szIniName, _T("000000"), - buffer, 10, m_tszFileName); - M->WriteDword(SRMSGMOD_T, _tagSettings[i].szSetting, HexStringToLong(buffer)); - break; - } - i++; - } + if (!(GetPrivateProfileInt(_T("Global"), _T("Version"), 0, m_tszFileName) >= 1 && GetPrivateProfileInt(_T("Global"), _T("Signature"), 0, m_tszFileName) == 101)) + return; - m_DisableScrollbars = M->GetByte("disableVScroll", 0) ? true : false; - - ZeroMemory(szSections, 6000); - p = szSections; - GetPrivateProfileSectionNames(szSections, 3000, m_tszFileName); - szSections[3001] = szSections[3000] = 0; - p = szSections; - while (lstrlen(p) > 1) { - if (p[0] != '%') { - p += (lstrlen(p) + 1); - continue; - } - for (i=0; i <= ID_EXTBK_LAST; i++) { - if (!_tcsicmp(&p[1], SkinItems[i].szName[0] == '{' ? &SkinItems[i].szName[3] : SkinItems[i].szName)) { - ReadItem(i, p); - break; - } - } - p += (lstrlen(p) + 1); - j++; - } + i = 0; + while (_tagSettings[i].szIniKey != NULL) { + data = 0; + data = GetPrivateProfileInt(_tagSettings[i].szIniKey, _tagSettings[i].szIniName, + _tagSettings[i].defaultval, m_tszFileName); + switch (_tagSettings[i].size) { + case 1: + M->WriteByte(SRMSGMOD_T, _tagSettings[i].szSetting, (BYTE)data); + break; + case 4: + M->WriteDword(SRMSGMOD_T, _tagSettings[i].szSetting, data); + break; + case 2: + DBWriteContactSettingWord(NULL, SRMSGMOD_T, _tagSettings[i].szSetting, (WORD)data); + break; + case 5: + GetPrivateProfileString(_tagSettings[i].szIniKey, _tagSettings[i].szIniName, _T("000000"), + buffer, 10, m_tszFileName); + M->WriteDword(SRMSGMOD_T, _tagSettings[i].szSetting, HexStringToLong(buffer)); + break; + } + i++; + } + + m_DisableScrollbars = M->GetByte("disableVScroll", 0) ? true : false; - if (j > 0) { - m_skinEnabled = true; - M->getAeroState(); // refresh aero state (set to false when a skin is successfully loaded and active) + ZeroMemory(szSections, 6000); + p = szSections; + GetPrivateProfileSectionNames(szSections, 3000, m_tszFileName); + szSections[3001] = szSections[3000] = 0; + p = szSections; + while (lstrlen(p) > 1) { + if (p[0] != '%') { + p += (lstrlen(p) + 1); + continue; + } + for (i=0; i <= ID_EXTBK_LAST; i++) { + if (!_tcsicmp(&p[1], SkinItems[i].szName[0] == '{' ? &SkinItems[i].szName[3] : SkinItems[i].szName)) { + ReadItem(i, p); + break; } + } + p += (lstrlen(p) + 1); + j++; + } - GetPrivateProfileString(_T("Avatars"), _T("BorderColor"), _T("000000"), buffer, 20, m_tszFileName); - m_avatarBorderClr = (COLORREF)HexStringToLong(buffer); + if (j > 0) { + m_skinEnabled = true; + M->getAeroState(); // refresh aero state (set to false when a skin is successfully loaded and active) + } + + GetPrivateProfileString(_T("Avatars"), _T("BorderColor"), _T("000000"), buffer, 20, m_tszFileName); + m_avatarBorderClr = (COLORREF)HexStringToLong(buffer); - GetPrivateProfileString(_T("Global"), _T("SideBarBG"), _T("None"), buffer, 20, m_tszFileName); - if (_tcscmp(buffer, _T("None"))) - m_sideBarContainerBG = (COLORREF)HexStringToLong(buffer); - else - m_sideBarContainerBG = SkinItems[ID_EXTBKSIDEBARBG].COLOR; + GetPrivateProfileString(_T("Global"), _T("SideBarBG"), _T("None"), buffer, 20, m_tszFileName); + if (_tcscmp(buffer, _T("None"))) + m_sideBarContainerBG = (COLORREF)HexStringToLong(buffer); + else + m_sideBarContainerBG = SkinItems[ID_EXTBKSIDEBARBG].COLOR; - m_bAvatarBorderType = GetPrivateProfileInt(_T("Avatars"), _T("BorderType"), 1, m_tszFileName); + m_bAvatarBorderType = GetPrivateProfileInt(_T("Avatars"), _T("BorderType"), 1, m_tszFileName); - LoadIcon(_T("Global"), _T("CloseGlyph"), &CSkin::m_closeIcon); - LoadIcon(_T("Global"), _T("MaximizeGlyph"), &CSkin::m_maxIcon); - LoadIcon(_T("Global"), _T("MinimizeGlyph"), &CSkin::m_minIcon); + LoadIcon(_T("Global"), _T("CloseGlyph"), &CSkin::m_closeIcon); + LoadIcon(_T("Global"), _T("MaximizeGlyph"), &CSkin::m_maxIcon); + LoadIcon(_T("Global"), _T("MinimizeGlyph"), &CSkin::m_minIcon); - m_frameSkins = GetPrivateProfileInt(_T("Global"), _T("framelessmode"), 0, m_tszFileName) ? true : false; - m_DisableScrollbars = GetPrivateProfileInt(_T("Global"), _T("NoScrollbars"), 0, m_tszFileName) ? true : false; + m_frameSkins = GetPrivateProfileInt(_T("Global"), _T("framelessmode"), 0, m_tszFileName) ? true : false; + m_DisableScrollbars = GetPrivateProfileInt(_T("Global"), _T("NoScrollbars"), 0, m_tszFileName) ? true : false; - m_SkinnedFrame_left = GetPrivateProfileInt(_T("WindowFrame"), _T("left"), 4, m_tszFileName); - m_SkinnedFrame_right = GetPrivateProfileInt(_T("WindowFrame"), _T("right"), 4, m_tszFileName); - m_SkinnedFrame_caption = GetPrivateProfileInt(_T("WindowFrame"), _T("Caption"), 24, m_tszFileName); - m_SkinnedFrame_bottom = GetPrivateProfileInt(_T("WindowFrame"), _T("bottom"), 4, m_tszFileName); + m_SkinnedFrame_left = GetPrivateProfileInt(_T("WindowFrame"), _T("left"), 4, m_tszFileName); + m_SkinnedFrame_right = GetPrivateProfileInt(_T("WindowFrame"), _T("right"), 4, m_tszFileName); + m_SkinnedFrame_caption = GetPrivateProfileInt(_T("WindowFrame"), _T("Caption"), 24, m_tszFileName); + m_SkinnedFrame_bottom = GetPrivateProfileInt(_T("WindowFrame"), _T("bottom"), 4, m_tszFileName); - m_titleBarButtonSize.cx = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonWidth"), 24, m_tszFileName); - m_titleBarButtonSize.cy = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonHeight"), 12, m_tszFileName); - m_titleButtonTopOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonTopOffset"), 0, m_tszFileName); + m_titleBarButtonSize.cx = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonWidth"), 24, m_tszFileName); + m_titleBarButtonSize.cy = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonHeight"), 12, m_tszFileName); + m_titleButtonTopOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleButtonTopOffset"), 0, m_tszFileName); - m_titleBarRightOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleBarRightOffset"), 0, m_tszFileName); - m_titleBarLeftOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleBarLeftOffset"), 0, m_tszFileName); + m_titleBarRightOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleBarRightOffset"), 0, m_tszFileName); + m_titleBarLeftOff = GetPrivateProfileInt(_T("WindowFrame"), _T("TitleBarLeftOffset"), 0, m_tszFileName); - m_captionOffset = GetPrivateProfileInt(_T("WindowFrame"), _T("CaptionOffset"), 3, m_tszFileName); - m_captionPadding = GetPrivateProfileInt(_T("WindowFrame"), _T("CaptionPadding"), 0, m_tszFileName); - m_sidebarTopOffset = GetPrivateProfileInt(_T("ClientArea"), _T("SidebarTop"), -1, m_tszFileName); - m_sidebarBottomOffset = GetPrivateProfileInt(_T("ClientArea"), _T("SidebarBottom"), -1, m_tszFileName); + m_captionOffset = GetPrivateProfileInt(_T("WindowFrame"), _T("CaptionOffset"), 3, m_tszFileName); + m_captionPadding = GetPrivateProfileInt(_T("WindowFrame"), _T("CaptionPadding"), 0, m_tszFileName); + m_sidebarTopOffset = GetPrivateProfileInt(_T("ClientArea"), _T("SidebarTop"), -1, m_tszFileName); + m_sidebarBottomOffset = GetPrivateProfileInt(_T("ClientArea"), _T("SidebarBottom"), -1, m_tszFileName); - m_bClipBorder = GetPrivateProfileInt(_T("WindowFrame"), _T("ClipFrame"), 0, m_tszFileName) ? true : false;; + m_bClipBorder = GetPrivateProfileInt(_T("WindowFrame"), _T("ClipFrame"), 0, m_tszFileName) ? true : false;; - BYTE radius_tl, radius_tr, radius_bl, radius_br; - TCHAR szFinalName[MAX_PATH]; - TCHAR szDrive[MAX_PATH], szPath[MAX_PATH]; + BYTE radius_tl, radius_tr, radius_bl, radius_br; + TCHAR szFinalName[MAX_PATH]; + TCHAR szDrive[MAX_PATH], szPath[MAX_PATH]; - radius_tl = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusTL"), 0, m_tszFileName); - radius_tr = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusTR"), 0, m_tszFileName); - radius_bl = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusBL"), 0, m_tszFileName); - radius_br = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusBR"), 0, m_tszFileName); + radius_tl = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusTL"), 0, m_tszFileName); + radius_tr = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusTR"), 0, m_tszFileName); + radius_bl = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusBL"), 0, m_tszFileName); + radius_br = GetPrivateProfileInt(_T("WindowFrame"), _T("RadiusBR"), 0, m_tszFileName); - CSkin::m_bRoundedCorner = radius_tl; + CSkin::m_bRoundedCorner = radius_tl; - GetPrivateProfileString(_T("Theme"), _T("File"), _T("None"), buffer, MAX_PATH, m_tszFileName); + GetPrivateProfileString(_T("Theme"), _T("File"), _T("None"), buffer, MAX_PATH, m_tszFileName); - _tsplitpath(m_tszFileName, szDrive, szPath, NULL, NULL); - mir_sntprintf(szFinalName, MAX_PATH, _T("%s\\%s\\%s"), szDrive, szPath, buffer); - if (PathFileExists(szFinalName)) { - ReadThemeFromINI(szFinalName, 0, FALSE, m_fLoadOnStartup ? 0 : M->GetByte("skin_loadmode", 0)); - CacheLogFonts(); - CacheMsgLogIcons(); - } + _tsplitpath(m_tszFileName, szDrive, szPath, NULL, NULL); + mir_sntprintf(szFinalName, MAX_PATH, _T("%s\\%s\\%s"), szDrive, szPath, buffer); + if (PathFileExists(szFinalName)) { + ReadThemeFromINI(szFinalName, 0, FALSE, m_fLoadOnStartup ? 0 : M->GetByte("skin_loadmode", 0)); + CacheLogFonts(); + CacheMsgLogIcons(); + } - GetPrivateProfileString(_T("Global"), _T("MenuBarBG"), _T("None"), buffer, 20, m_tszFileName); - data = HexStringToLong(buffer); - if (m_MenuBGBrush) { - DeleteObject(m_MenuBGBrush); - m_MenuBGBrush = 0; - } - if (_tcscmp(buffer, _T("None"))) - m_MenuBGBrush = CreateSolidBrush(data); + GetPrivateProfileString(_T("Global"), _T("MenuBarBG"), _T("None"), buffer, 20, m_tszFileName); + data = HexStringToLong(buffer); + if (m_MenuBGBrush) { + DeleteObject(m_MenuBGBrush); + m_MenuBGBrush = 0; + } + if (_tcscmp(buffer, _T("None"))) + m_MenuBGBrush = CreateSolidBrush(data); - GetPrivateProfileString(_T("Global"), _T("LightShadow"), _T("000000"), buffer, 20, m_tszFileName); - data = HexStringToLong(buffer); - CSkin::m_SkinLightShadowPen = CreatePen(PS_SOLID, 1, RGB(GetRValue(data), GetGValue(data), GetBValue(data))); - GetPrivateProfileString(_T("Global"), _T("DarkShadow"), _T("000000"), buffer, 20, m_tszFileName); - data = HexStringToLong(buffer); - CSkin::m_SkinDarkShadowPen = CreatePen(PS_SOLID, 1, RGB(GetRValue(data), GetGValue(data), GetBValue(data))); + GetPrivateProfileString(_T("Global"), _T("LightShadow"), _T("000000"), buffer, 20, m_tszFileName); + data = HexStringToLong(buffer); + CSkin::m_SkinLightShadowPen = CreatePen(PS_SOLID, 1, RGB(GetRValue(data), GetGValue(data), GetBValue(data))); + GetPrivateProfileString(_T("Global"), _T("DarkShadow"), _T("000000"), buffer, 20, m_tszFileName); + data = HexStringToLong(buffer); + CSkin::m_SkinDarkShadowPen = CreatePen(PS_SOLID, 1, RGB(GetRValue(data), GetGValue(data), GetBValue(data))); - SkinCalcFrameWidth(); + SkinCalcFrameWidth(); - GetPrivateProfileString(_T("Global"), _T("FontColor"), _T("None"), buffer, 20, m_tszFileName); - if (_tcscmp(buffer, _T("None"))) - CSkin::m_DefaultFontColor = HexStringToLong(buffer); - else - CSkin::m_DefaultFontColor = GetSysColor(COLOR_BTNTEXT); - buffer[499] = 0; - free(szSections); + GetPrivateProfileString(_T("Global"), _T("FontColor"), _T("None"), buffer, 20, m_tszFileName); + if (_tcscmp(buffer, _T("None"))) + CSkin::m_DefaultFontColor = HexStringToLong(buffer); + else + CSkin::m_DefaultFontColor = GetSysColor(COLOR_BTNTEXT); + buffer[499] = 0; + free(szSections); - LoadItems(); - ::FreeTabConfig(); - ::ReloadTabConfig(); - } - } + LoadItems(); + ::FreeTabConfig(); + ::ReloadTabConfig(); } #define SECT_BUFFER_SIZE 2500 @@ -2272,9 +2049,8 @@ UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID } LRESULT orig = mir_callNextSubclass(hwnd, MyWndProc, msg, wParam, lParam); - if (0 == mwdat) - return(orig); + return orig; if (CSkin::m_skinEnabled) { CSkinItem *item = &SkinItems[skinID]; @@ -2312,7 +2088,8 @@ UINT CSkin::NcCalcRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC OldWndProc) { - LRESULT result = mir_callNextSubclass(hwnd, OldWndProc, msg, wParam, lParam); // do default processing (otherwise, NO scrollbar as it is painted in NC_PAINT) + // do default processing (otherwise, NO scrollbar as it is painted in NC_PAINT) + LRESULT result = mir_callNextSubclass(hwnd, OldWndProc, msg, wParam, lParam); if (0 == mwdat) return result; @@ -2339,7 +2116,8 @@ UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, if (CSkin::m_skinEnabled && !item->IGNORED) { right_off = item->MARGIN_RIGHT; bottom_off = item->MARGIN_BOTTOM; - } else { + } + else { right_off = left_off; bottom_off = top_off; } @@ -2352,7 +2130,8 @@ UINT CSkin::DrawRichEditFrame(HWND hwnd, const TWindowData *mwdat, UINT skinID, if (CSkin::m_skinEnabled && !item->IGNORED) { ReleaseDC(hwnd, hdc); return result; - } else if (CMimAPI::m_pfnDrawThemeBackground) { + } + if (CMimAPI::m_pfnDrawThemeBackground) { if (isMultipleReason || isEditNotesReason || isSendLaterReason) { HBRUSH br = CreateSolidBrush(isMultipleReason ? RGB(255, 130, 130) : (isEditNotesReason ? RGB(80, 255, 80) : RGB(80, 80, 255))); FillRect(hdc, &rcWindow, br); -- cgit v1.2.3