void LoadClientIcons()
{

	int i;
	HICON hicon;
	char name[256];
	for (i=0;i<ClientNumber;i++)
	{
		mir_snprintf(name,sizeof(name),"ClientIcons_%s",ClientNames[i]);
		
		if (ClientImageListIdx[i]==0)
		{
		hicon=LoadIconFromExternalFile("clisticons.dll",i+100,TRUE,TRUE,name,Translate("Contact List/Client Icons"),ClientNamesDesc[i],-ClientICOIDX[i]);
        if (!hicon) hicon=LoadIcon(g_hInst, MAKEINTRESOURCE(ClientICOIDX[i]));
		if (hicon) ClientImageListIdx[i]=ImageList_AddIcon(hExtraImageList,hicon );		
		}else
		{
		hicon=LoadIconFromExternalFile("clisticons.dll",i+100,TRUE,FALSE,name, Translate("Contact List/Client Icons"),ClientNamesDesc[i],-ClientICOIDX[i]);			
        if (!hicon) hicon=LoadIcon(g_hInst, MAKEINTRESOURCE(ClientICOIDX[ClientNumber]));
		if (hicon) ClientImageListIdx[i]=ImageList_ReplaceIcon(hExtraImageList,ClientImageListIdx[i],hicon );		
};

	}


}
int OnIconLibIconChanged(WPARAM wParam,LPARAM lParam)
{
	HICON hicon;
	hicon=LoadIconFromExternalFile("clisticons.dll",0,TRUE,FALSE,"Email","Contact List","Email Icon",-IDI_EMAIL);
	ExtraImageIconsIndex[0]=ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[0],hicon );		

	hicon=LoadIconFromExternalFile("clisticons.dll",1,TRUE,FALSE,"Sms","Contact List","Sms Icon",-IDI_SMS);
	ExtraImageIconsIndex[1]=ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[1],hicon );		

	hicon=LoadIconFromExternalFile("clisticons.dll",4,TRUE,FALSE,"Web","Contact List","Web Icon",-IDI_GLOBUS);
	ExtraImageIconsIndex[2]=ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[2],hicon );		

	NotifyEventHooks(ME_SKIN_ICONSCHANGED,0,0);
	pcli->pfnClcBroadcast( INTM_INVALIDATE,0,0);
	return 0;
}
Beispiel #3
0
HICON GetConnectingIconForProto_DLL(char *szProto,int b)
{
	char szFullPath[MAX_PATH];
	HICON hIcon=NULL;

	b=b-1;
	_snprintf(szFullPath, SIZEOF(szFullPath), "proto_conn_%s.dll",szProto);
	//		hIcon=ExtractIconFromPath(szFullPath);
	//		if (hIcon) return hIcon;

	hIcon=LoadIconFromExternalFile(szFullPath,b+1,FALSE,FALSE,NULL,NULL,NULL,0,0);
	if (hIcon) return hIcon;

#ifdef _DEBUG
	{
		char buf [256];
		sprintf(buf,"IconNotFound %s %d\r\n",szProto,b);
		//	OutputDebugStringA(buf);
	}
#endif

	if (!strcmp(szProto,"ICQ"))
	{

#ifdef _DEBUG
		char buf [256];
		sprintf(buf,"Icon %d %d\r\n",GetTickCount(),b);
		//OutputDebugStringA(buf);
#endif
		return(LoadIconA(g_hInst,(LPCSTR)(IDI_ICQC1+b)));
	}

	return(hIcon);
}
void ReloadExtraIcons()
{
			{	
				int count,i;
				PROTOCOLDESCRIPTOR **protos;
				HICON hicon;

				SendMessage(hwndContactTree,CLM_SETEXTRACOLUMNSSPACE,DBGetContactSettingByte(NULL,"CLUI","ExtraColumnSpace",18),0);					
				SendMessage(hwndContactTree,CLM_SETEXTRAIMAGELIST,0,(LPARAM)NULL);		
				if (hExtraImageList){ImageList_Destroy(hExtraImageList);};
				hExtraImageList=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256);
				memset(ClientImageListIdx,0,sizeof(ClientImageListIdx));
//adding protocol icons
				CallService(MS_PROTO_ENUMPROTOCOLS,(WPARAM)&count,(LPARAM)&protos);
	
				//loading icons
				hicon=LoadIconFromExternalFile("clisticons.dll",0,TRUE,TRUE,"Email","Contact List",Translate("Email Icon"),-IDI_EMAIL);
				if (!hicon) hicon=LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_EMAIL));
				ExtraImageIconsIndex[0]=ImageList_AddIcon(hExtraImageList,hicon );


				hicon=LoadIconFromExternalFile("clisticons.dll",1,TRUE,TRUE,"Sms","Contact List",Translate("Sms Icon"),-IDI_SMS);
				if (!hicon) hicon=LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_SMS));
				ExtraImageIconsIndex[1]=ImageList_AddIcon(hExtraImageList,hicon );

				hicon=LoadIconFromExternalFile("clisticons.dll",4,TRUE,TRUE,"Web","Contact List",Translate("Web Icon"),-IDI_GLOBUS);
				if (!hicon) hicon=LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_GLOBUS));
				ExtraImageIconsIndex[2]=ImageList_AddIcon(hExtraImageList,hicon );	
				//calc only needed protocols
				for(i=0;i<count;i++) {
				if(protos[i]->type!=PROTOTYPE_PROTOCOL || CallProtoService(protos[i]->szName,PS_GETCAPS,PFLAGNUM_2,0)==0) continue;
				ImageList_AddIcon(hExtraImageList,LoadSkinnedProtoIcon(protos[i]->szName,ID_STATUS_ONLINE));
				}
				LoadClientIcons();
				SendMessage(hwndContactTree,CLM_SETEXTRAIMAGELIST,0,(LPARAM)hExtraImageList);		
				//SetAllExtraIcons(hImgList);
				SetNewExtraColumnCount();
				NotifyEventHooks(hExtraImageListRebuilding,0,0);
				ImageCreated=TRUE;
				TRACE("ReloadExtraIcons Done\r\n");
			}

};
int OnIconLibIconChanged(WPARAM wParam,LPARAM lParam)
{
	HICON hicon;
				hicon=LoadIconFromExternalFile("clisticons.dll",0,TRUE,FALSE,"Email","Contact List",Translate("Email Icon"),-IDI_EMAIL);
				ExtraImageIconsIndex[0]=ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[0],hicon );		

				hicon=LoadIconFromExternalFile("clisticons.dll",1,TRUE,FALSE,"Sms","Contact List",Translate("Sms Icon"),-IDI_SMS);
				ExtraImageIconsIndex[1]=ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[1],hicon );		

				hicon=LoadIconFromExternalFile("clisticons.dll",4,TRUE,FALSE,"Web","Contact List",Translate("Web Icon"),-IDI_GLOBUS);
				ExtraImageIconsIndex[2]=ImageList_ReplaceIcon(hExtraImageList,ExtraImageIconsIndex[2],hicon );		
				
				LoadClientIcons();
				
				CListIconsChanged(wParam,lParam);
				CluiIconsChanged(wParam,lParam);
				ClcIconsChanged(wParam,lParam);
				NotifyEventHooks(ME_SKIN_ICONSCHANGED,0,0);
				return 0;
};
void ReloadExtraIcons()
{
	int count,i;
	PROTOACCOUNT **accs;
	HICON hicon;

	SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNSSPACE,DBGetContactSettingByte(NULL,"CLUI","ExtraColumnSpace",18),0);					
	SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,0,(LPARAM)NULL);		
	if (hExtraImageList){ImageList_Destroy(hExtraImageList);};
	hExtraImageList=ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256);

	if (!HasExtraIconsService())
	{
		//loading icons
		hicon=LoadIconFromExternalFile("clisticons.dll",0,TRUE,TRUE,"Email","Contact List","Email Icon",-IDI_EMAIL);
		if (!hicon) hicon=LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_EMAIL));
		ExtraImageIconsIndex[0]=ImageList_AddIcon(hExtraImageList,hicon );


		hicon=LoadIconFromExternalFile("clisticons.dll",1,TRUE,TRUE,"Sms","Contact List","Sms Icon",-IDI_SMS);
		if (!hicon) hicon=LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_SMS));
		ExtraImageIconsIndex[1]=ImageList_AddIcon(hExtraImageList,hicon );

		hicon=LoadIconFromExternalFile("clisticons.dll",4,TRUE,TRUE,"Web","Contact List","Web Icon",-IDI_GLOBUS);
		if (!hicon) hicon=LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_GLOBUS));
		ExtraImageIconsIndex[2]=ImageList_AddIcon(hExtraImageList,hicon );	

		//calc only needed protocols
		ProtoEnumAccounts( &count, &accs );
		for ( i=0; i < count; i++ )
			if ( IsAccountEnabled( accs[i] ) && CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 ))
				ImageList_AddIcon( hExtraImageList, LoadSkinnedProtoIcon( accs[i]->szModuleName, ID_STATUS_ONLINE ));
	}

	SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,0,(LPARAM)hExtraImageList);		

	//SetAllExtraIcons(hImgList);
	SetNewExtraColumnCount();
	NotifyEventHooks(hExtraImageListRebuilding,0,0);
	ImageCreated=TRUE;
}
Beispiel #7
0
int static OnIconLibIconChanged(WPARAM wParam, LPARAM lParam)
{
	HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,FALSE,"NewGroup","Contact list","New Group",-IDI_NEWGROUP,0);
	NewGroupIconidx = ImageList_ReplaceIcon(hCListImages,NewGroupIconidx,hicon);

	CLISTMENUITEM mi = { sizeof(mi) };
	mi.flags = CMIM_ICON;
	mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
	Menu_ModifyItem(hNewSubGroupMenuItem, &mi);
	Menu_ModifyItem(hNewGroupMenuItem, &mi);
	return 0;
}
Beispiel #8
0
void RegisterProtoIcons (char *protoname)
{
	if (ServiceExists(MS_SKIN2_GETICON)&&DBGetContactSettingByte(NULL,"CList","UseProtoIconFromIcoLib",1))
	{
		int i;
		char buf[256];
		char buf2[256];
		for (i=0;i<8;i++)
		{
			sprintf(buf,"%s #%d",protoname,i);
			sprintf(buf2,"Contact List/Connection Icons %s",protoname);
			
			LoadIconFromExternalFile(NULL,i,TRUE,TRUE,buf,buf2,buf,0,GetConnectingIconForProto_DLL(protoname,i));
		}
	}
}
Beispiel #9
0
HICON GetConnectingIconForProto(char *szProto,int b)
{
		if (ServiceExists(MS_SKIN2_GETICON)&&DBGetContactSettingByte(NULL,"CList","UseProtoIconFromIcoLib",1))
		{
			HICON hIcon=0;
			char buf[256];
			sprintf(buf,"%s #%d",szProto,b);
			
			 hIcon=LoadIconFromExternalFile(NULL,b,TRUE,FALSE,buf,"Contact List/Connection Icons",buf,0,NULL);
			 if (hIcon==NULL) return (GetConnectingIconForProto_DLL(szProto,b));
			 return (CopyIcon(hIcon));
		
		}else
		{
			return(GetConnectingIconForProto_DLL(szProto,b));
		}
		return (NULL);
}
Beispiel #10
0
void InitGroupMenus(void)
{
	HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact list","New Group",-IDI_NEWGROUP2,0);
	NewGroupIconidx = ImageList_AddIcon(hCListImages,hicon );

	CreateServiceFunction("CLISTMENUSGroup/ExecService",GroupMenuExecService);
	CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu",FreeOwnerDataGroupMenu);
	CreateServiceFunction("CLISTMENUSGroup/GroupMenuonAddService",GroupMenuonAddService);
	CreateServiceFunction("CLISTMENUSGroup/HideGroupsHelper",HideGroupsHelper);
	CreateServiceFunction("CLISTMENUSGroup/UseGroupsHelper",UseGroupsHelper);
	CreateServiceFunction("CLISTMENUSGroup/HideOfflineRootHelper",HideOfflineRootHelper);

	CreateServiceFunction("CList/AddGroupMenuItem",AddGroupMenuItem);
	CreateServiceFunction(MS_CLIST_REMOVEGROUPMENUITEM,RemoveGroupMenuItem);
	CreateServiceFunction(MS_CLIST_MENUBUILDGROUP,BuildGroupMenu);
	hPreBuildGroupMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDGROUPMENU);
	HookEvent(ME_CLIST_PREBUILDGROUPMENU,OnBuildGroupMenu);

	InitSubGroupMenus();

	// Group menu
	hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
	MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService");
	{
		//add  exit command to menu
		GroupMenuParam gmp;

		CLISTMENUITEM mi = { sizeof(mi) };
		mi.position = 1900000;
		mi.pszService = "CloseAction";
		mi.pszName = LPGEN("E&xit");
		AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 500;
		mi.pszService = MS_CLIST_SHOWHIDE;
		mi.pszName = LPGEN("&Hide/Show");
		hHideShowMainMenuItem = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 200000;
		mi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FINDUSER));
		mi.pszService = "FindAdd/FindAddCommand";
		mi.pszName = LPGEN("&Find/Add Contacts...");
		AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 300000;
		mi.pszService = "";
		mi.pszName = LPGEN("&Main menu");
		hGroupMainMenuItemProxy = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 300100;
		mi.pszService = "";
		mi.pszName = LPGEN("&Status");
		hGroupStatusMenuItemProxy = (HANDLE)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 400000;
		mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_OPTIONS));
		mi.pszService = "Options/OptionsCommand";
		mi.pszName = LPGEN("&Options...");

		AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 500000;
		mi.hIcon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_CLIENTMIRANDA));
		mi.pszService = "Help/AboutCommand";
		mi.pszName = LPGEN("&About");

		//AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100000;
		mi.hIcon = ImageList_GetIcon(hCListImages,NewGroupIconidx,0);
		mi.pszService = MS_CLIST_GROUPCREATE;
		mi.pszName = LPGEN("&New Group");
		hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100001;
		mi.hIcon = NULL;
		mi.pszService = MS_CLIST_SETHIDEOFFLINE;
		mi.pszName = LPGEN("&Hide Offline Users");
		gmp.lParam = 0;gmp.wParam = -1;
		hHideOfflineUsersMenuItem = (HGENMENU)AddGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100002;
		mi.hIcon = NULL;
		mi.pszService = "CLISTMENUSGroup/HideOfflineRootHelper";
		mi.pszName = LPGEN("Hide &Offline Users out here");
		hHideOfflineUsersOutHereMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100003;
		mi.hIcon = NULL;
		mi.pszService = "CLISTMENUSGroup/HideGroupsHelper";
		mi.pszName = LPGEN("Hide &Empty Groups");
		hHideEmptyGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);

		memset(&mi,0,sizeof(mi));
		mi.cbSize = sizeof(mi);
		mi.position = 100004;
		mi.hIcon = NULL;
		mi.pszService = "CLISTMENUSGroup/UseGroupsHelper";
		mi.pszName = LPGEN("Disable &Groups");
		hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0,(LPARAM)&mi);

		HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibIconChanged);
	}
}