void ToolBarIcons::reInit(int size) { ImageList_SetIconSize(getDefaultLst(), size, size); ImageList_SetIconSize(getHotLst(), size, size); ImageList_SetIconSize(getDisableLst(), size, size); for (size_t i = 0, len = _tbiis.size(); i < len; ++i) { if (_tbiis[i]._defaultIcon != -1) { _iconListVector[HLIST_DEFAULT].addIcon(_tbiis[i]._defaultIcon); _iconListVector[HLIST_HOT].addIcon(_tbiis[i]._hotIcon); _iconListVector[HLIST_DISABLE].addIcon(_tbiis[i]._grayIcon); } } }
BOOL _ShellImageListInit(int cxIcon, int cyIcon, int cxSmIcon, int cySmIcon, UINT flags, BOOL fRestore) { int i; TCHAR szModule[MAX_PATH]; HKEY hkeyIcons; ASSERTCRITICAL; if (himlIcons == NULL) { himlIcons = ImageList_Create(cxIcon, cyIcon, ILC_MASK|ILC_SHARED|flags, 0, 32); } else { ImageList_Remove(himlIcons, -1); ImageList_SetIconSize(himlIcons, cxIcon, cyIcon); } if (himlIcons == NULL) { return FALSE; } if (himlIconsSmall == NULL) { himlIconsSmall = ImageList_Create(cxSmIcon, cySmIcon, ILC_MASK|ILC_SHARED|flags, 0, 32); } else { ImageList_Remove(himlIconsSmall, -1); ImageList_SetIconSize(himlIconsSmall, cxSmIcon, cySmIcon); } if (himlIconsSmall == NULL) { ImageList_Destroy(himlIcons); himlIcons = NULL; return FALSE; } // set the bk colors to COLOR_WINDOW since this is what will // be used most of the time as the bk for these lists (cabinet, tray) // this avoids having to do ROPs when drawing, thus making it fast ImageList_SetBkColor(himlIcons, GetSysColor(COLOR_WINDOW)); ImageList_SetBkColor(himlIconsSmall, GetSysColor(COLOR_WINDOW)); GetModuleFileName(HINST_THISDLL, szModule, ARRAYSIZE(szModule)); // WARNING: this code assumes that these icons are the first in // our RC file and are in this order and these indexes correspond // to the II_ constants in shell.h. hkeyIcons = SHGetExplorerSubHkey(HKEY_LOCAL_MACHINE, g_szShellIcons, FALSE); for (i = 0; i < ARRAYSIZE(c_SystemImageListIndexes); i++) { HICON hIcon=NULL; HICON hSmallIcon=NULL; int iIndex; // // Load all of the icons with fRestore == TRUE, or only the overlays // if fRestore == FALSE. // if (fRestore || (i >= II_OVERLAYFIRST && i <= II_OVERLAYLAST)) { // // check to see if icon is overridden in the registry // if (hkeyIcons) { TCHAR val[10]; TCHAR ach[MAX_PATH]; DWORD cb=MAX_PATH; int iIcon; wsprintf(val, g_szD, i); ach[0] = 0; RegQueryValueEx(hkeyIcons, val, NULL, NULL, (LPBYTE)ach, &cb); if (ach[0]) { HICON hIcons[2] = {0, 0}; iIcon = PathParseIconLocation(ach); ExtractIcons(ach, iIcon, MAKELONG(g_cxIcon,g_cxSmIcon), MAKELONG(g_cyIcon,g_cySmIcon), hIcons, NULL, 2, g_lrFlags); hIcon = hIcons[0]; hSmallIcon = hIcons[1]; if (hIcon) { DebugMsg(DM_TRACE, TEXT("ShellImageListInit: Got default icon #%d from registry: %s,%d"), i, ach, iIcon); } } } if (hIcon == NULL) { hIcon = LoadImage(HINST_THISDLL, MAKEINTRESOURCE(c_SystemImageListIndexes[i]), IMAGE_ICON, cxIcon, cyIcon, g_lrFlags); hSmallIcon = LoadImage(HINST_THISDLL, MAKEINTRESOURCE(c_SystemImageListIndexes[i]), IMAGE_ICON, cxSmIcon, cySmIcon, g_lrFlags); } if (hIcon) { iIndex = SHAddIconsToCache(hIcon, hSmallIcon, szModule, i, 0); Assert(iIndex == i); // assume index if (i >= II_OVERLAYFIRST && i <= II_OVERLAYLAST) { ImageList_SetOverlayImage(himlIcons, iIndex, i - II_OVERLAYFIRST + 1); ImageList_SetOverlayImage(himlIconsSmall, iIndex, i - II_OVERLAYFIRST + 1); } } } } if (hkeyIcons) RegCloseKey(hkeyIcons); return TRUE; }
void IconList::setIconSize(int size) const { ImageList_SetIconSize(_hImglst, size, size); for (int i = 0 ; i < _iconIDArraySize ; ++i) addIcon(_pIconIDArray[i]); }
extern "C" int __declspec(dllexport) CListInitialise(PLUGINLINK * link) { int rc = 0; DBVARIANT dbv; int i; char szProfilePath[MAX_PATH]; pluginLink = link; #ifdef _DEBUG _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif mir_getMMI(&mmi); mir_getLI(&li); mir_getTMI(&tmi); mir_getLP( &pluginInfo ); API::onInit(); LoadCLCButtonModule(); RegisterCLUIFrameClasses(); ZeroMemory((void*) &cfg::dat, sizeof(cfg::dat)); int iCount = CallService(MS_DB_CONTACT_GETCOUNT, 0, 0); iCount += 20; if( iCount < 300 ) iCount = 300; cfg::eCache = reinterpret_cast<TExtraCache *>(malloc(sizeof(TExtraCache) * iCount)); ZeroMemory(cfg::eCache, sizeof(struct TExtraCache) * iCount); cfg::nextCacheEntry = 0; cfg::maxCacheEntry = iCount; cfg::init(); cfg::dat.toolbarVisibility = cfg::getDword("CLUI", "TBVisibility", DEFAULT_TB_VISIBILITY); cfg::dat.hMenuButtons = GetSubMenu(LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)), 3); cfg::dat.hMenuNotify = CreatePopupMenu(); cfg::dat.wNextMenuID = 1; cfg::dat.sortTimer = cfg::getDword("CLC", "SortTimer", 150); cfg::dat.szNoEvents = TranslateTS(szNoevents); cfg::dat.avatarBorder = (COLORREF)cfg::getDword("CLC", "avatarborder", 0); cfg::dat.avatarRadius = (COLORREF)cfg::getDword("CLC", "avatarradius", 4); cfg::dat.hBrushAvatarBorder = CreateSolidBrush(cfg::dat.avatarBorder); cfg::dat.avatarSize = cfg::getWord("CList", "AvatarSize", 24); cfg::dat.dualRowMode = cfg::getByte("CLC", "DualRowMode", 0); cfg::dat.avatarPadding = cfg::getByte("CList", "AvatarPadding", 0); cfg::dat.isTransparent = cfg::getByte("CList", "Transparent", 0); cfg::dat.alpha = cfg::getByte("CList", "Alpha", SETTING_ALPHA_DEFAULT); cfg::dat.autoalpha = cfg::getByte("CList", "AutoAlpha", SETTING_ALPHA_DEFAULT); cfg::dat.fadeinout = cfg::getByte("CLUI", "FadeInOut", 0); cfg::dat.autosize = cfg::getByte("CLUI", "AutoSize", 0); cfg::dat.dwExtraImageMask = cfg::getDword("CLUI", "ximgmask", 0); cfg::dat.bNoOfflineAvatars = cfg::getByte("CList", "NoOfflineAV", 1); cfg::dat.bFullTransparent = cfg::getByte("CLUI", "fulltransparent", 0); cfg::dat.bDblClkAvatars = cfg::getByte("CLC", "dblclkav", 0); cfg::dat.bEqualSections = cfg::getByte("CLUI", "EqualSections", 0); cfg::dat.bCenterStatusIcons = cfg::getByte("CLC", "si_centered", 1); cfg::dat.boldHideOffline = -1; cfg::dat.bSecIMAvail = ServiceExists("SecureIM/IsContactSecured") ? 1 : 0; cfg::dat.bNoTrayTips = cfg::getByte("CList", "NoTrayTips", 0); cfg::dat.bShowLocalTime = cfg::getByte("CLC", "ShowLocalTime", 1); cfg::dat.bShowLocalTimeSelective = cfg::getByte("CLC", "SelectiveLocalTime", 1); cfg::dat.bDontSeparateOffline = cfg::getByte("CList", "DontSeparateOffline", 0); cfg::dat.bShowXStatusOnSbar = cfg::getByte("CLUI", "xstatus_sbar", 0); cfg::dat.bLayeredHack = cfg::getByte("CLUI", "layeredhack", 1); cfg::dat.bFirstRun = cfg::getByte("CLUI", "firstrun", 1); cfg::dat.langPackCP = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); cfg::dat.realTimeSaving = cfg::getByte("CLUI", "save_pos_always", 0); DWORD sortOrder = cfg::getDword("CList", "SortOrder", SORTBY_NAME); cfg::dat.sortOrder[0] = LOBYTE(LOWORD(sortOrder)); cfg::dat.sortOrder[1] = HIBYTE(LOWORD(sortOrder)); cfg::dat.sortOrder[2] = LOBYTE(HIWORD(sortOrder)); if(cfg::dat.bFirstRun) cfg::writeByte("CLUI", "firstrun", 0); if(!cfg::getString(NULL, "CLUI", "exIconOrder", &dbv)) { if(lstrlenA(dbv.pszVal) < EXICON_COUNT) { for(i = 1; i <= EXICON_COUNT; i++) cfg::dat.exIconOrder[i - 1] = i; } else { for(i = 0; i < EXICON_COUNT; i++) if(dbv.pszVal[i] < EXICON_COUNT+1 && dbv.pszVal[i] >0) cfg::dat.exIconOrder[i] = dbv.pszVal[i]; else cfg::dat.exIconOrder[i] = i+1; } DBFreeVariant(&dbv); } else { for(i = 1; i <= EXICON_COUNT; i++) cfg::dat.exIconOrder[i - 1] = i; } ReloadThemedOptions(); FLT_ReadOptions(); Reload3dBevelColors(); himlExtraImages = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 30, 2); ImageList_SetIconSize(himlExtraImages, cfg::dat.exIconScale, cfg::dat.exIconScale); cfg::dat.dwFlags = cfg::getDword("CLUI", "Frameflags", CLUI_FRAME_SHOWTOPBUTTONS | CLUI_FRAME_STATUSICONS | CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_BUTTONSFLAT | CLUI_FRAME_CLISTSUNKEN); cfg::dat.dwFlags |= (cfg::getByte("CLUI", "ShowSBar", 1) ? CLUI_FRAME_SBARSHOW : 0); cfg::dat.soundsOff = cfg::getByte("CLUI", "NoSounds", 0); CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szProfilePath); #if defined(_UNICODE) MultiByteToWideChar(CP_ACP, 0, szProfilePath, MAX_PATH, cfg::dat.tszProfilePath, MAX_PATH); cfg::dat.tszProfilePath[MAX_PATH - 1] = 0; #else mir_sntprintf(cfg::dat.tszProfilePath, MAX_PATH, "%s", szProfilePath); #endif _tcslwr(cfg::dat.tszProfilePath); if(cfg::getByte("Skin", "UseSound", 0) != cfg::dat.soundsOff) cfg::writeByte("Skin", "UseSound", (BYTE)(cfg::dat.soundsOff ? 0 : 1)); // get the clist interface pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); if ( (INT_PTR)pcli == CALLSERVICE_NOTFOUND ) { LBL_Error: MessageBoxA( NULL, "This plugin requires Miranda IM 0.8.0.9 or later", "Fatal error", MB_OK ); return 1; } if ( pcli->version < 6 ) // don't join it with the previous if() goto LBL_Error; pcli->pfnBuildGroupPopupMenu = BuildGroupPopupMenu; pcli->pfnCluiProtocolStatusChanged = CluiProtocolStatusChanged; pcli->pfnCompareContacts = CompareContacts; pcli->pfnCreateClcContact = CreateClcContact; pcli->pfnCreateEvent = fnCreateEvent; pcli->pfnDocking_ProcessWindowMessage = Docking_ProcessWindowMessage; pcli->pfnGetDefaultFontSetting = GetDefaultFontSetting; pcli->pfnGetRowBottomY = RowHeight::getItemBottomY; pcli->pfnGetRowHeight = RowHeight::getHeight; pcli->pfnGetRowTopY = RowHeight::getItemTopY; pcli->pfnGetRowTotalHeight = RowHeight::getTotalHeight; pcli->pfnGetWindowVisibleState = GetWindowVisibleState; pcli->pfnHitTest = HitTest; pcli->pfnLoadContactTree = LoadContactTree; pcli->pfnOnCreateClc = LoadCLUIModule; pcli->pfnPaintClc = PaintClc; pcli->pfnRebuildEntireList = RebuildEntireList; pcli->pfnRowHitTest = RowHeight::hitTest; pcli->pfnScrollTo = ScrollTo; pcli->pfnTrayIconUpdateBase = TrayIconUpdateBase; pcli->pfnSetHideOffline = SetHideOffline; pcli->pfnShowHide = ShowHide; saveAddContactToGroup = pcli->pfnAddContactToGroup; pcli->pfnAddContactToGroup = AddContactToGroup; saveRemoveItemFromGroup = pcli->pfnRemoveItemFromGroup; pcli->pfnRemoveItemFromGroup = RemoveItemFromGroup; saveAddEvent = pcli->pfnAddEvent; pcli->pfnAddEvent = AddEvent; saveRemoveEvent = pcli->pfnRemoveEvent; pcli->pfnRemoveEvent = RemoveEvent; saveAddGroup = pcli->pfnAddGroup; pcli->pfnAddGroup = AddGroup; saveAddInfoItemToGroup = pcli->pfnAddInfoItemToGroup; pcli->pfnAddInfoItemToGroup = AddInfoItemToGroup; saveContactListControlWndProc = pcli->pfnContactListControlWndProc; pcli->pfnContactListControlWndProc = ContactListControlWndProc; saveContactListWndProc = pcli->pfnContactListWndProc; pcli->pfnContactListWndProc = ContactListWndProc; saveIconFromStatusMode = pcli->pfnIconFromStatusMode; pcli->pfnIconFromStatusMode = fnIconFromStatusMode; saveLoadClcOptions = pcli->pfnLoadClcOptions; pcli->pfnLoadClcOptions = LoadClcOptions; saveProcessExternalMessages = pcli->pfnProcessExternalMessages; pcli->pfnProcessExternalMessages = ProcessExternalMessages; saveRecalcScrollBar = pcli->pfnRecalcScrollBar; pcli->pfnRecalcScrollBar = RecalcScrollBar; saveTrayIconProcessMessage = pcli->pfnTrayIconProcessMessage; pcli->pfnTrayIconProcessMessage = TrayIconProcessMessage; rc = LoadContactListModule(); if (rc == 0) rc = LoadCLCModule(); HookEvent(ME_SYSTEM_MODULESLOADED, systemModulesLoaded); return rc; }