diff options
126 files changed, 1753 insertions, 3385 deletions
diff --git a/bin10/lib/Miranda32.lib b/bin10/lib/Miranda32.lib Binary files differindex 7aafc9e156..5e158a028a 100644 --- a/bin10/lib/Miranda32.lib +++ b/bin10/lib/Miranda32.lib diff --git a/bin10/lib/Miranda64.lib b/bin10/lib/Miranda64.lib Binary files differindex a399a5f10a..619ae7e221 100644 --- a/bin10/lib/Miranda64.lib +++ b/bin10/lib/Miranda64.lib diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib Binary files differindex 9d1e620651..ea3a307912 100644 --- a/bin10/lib/mir_core.lib +++ b/bin10/lib/mir_core.lib diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib Binary files differindex a70910901d..fd85f605a1 100644 --- a/bin10/lib/mir_core64.lib +++ b/bin10/lib/mir_core64.lib diff --git a/include/m_core.h b/include/m_core.h index 99fa85bdde..393767602c 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -197,12 +197,40 @@ MIR_CORE_DLL(pfnExceptionFilter) GetExceptionFilter(void); MIR_CORE_DLL(pfnExceptionFilter) SetExceptionFilter(pfnExceptionFilter pMirandaExceptFilter);
///////////////////////////////////////////////////////////////////////////////
+// icons support
+
+extern int hLangpack;
+
+typedef struct tagIconItem
+{
+ char *szDescr, *szName;
+ int defIconID, size;
+ HANDLE hIcolib;
+}
+ IconItem;
+
+typedef struct tagIconItemT
+{
+ TCHAR *tszDescr;
+ char *szName;
+ int defIconID, size;
+ HANDLE hIcolib;
+}
+ IconItemT;
+
+#if defined( __cplusplus )
+MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char* szSection, IconItem* pIcons, size_t iCount, char *prefix = NULL, int = hLangpack);
+MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const TCHAR* szSection, IconItemT* pIcons, size_t iCount, char *prefix = NULL, int = hLangpack);
+#else
+MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char* szSection, IconItem* pIcons, size_t iCount, char *prefix, int hLangpack);
+MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const TCHAR* szSection, IconItemT* pIcons, size_t iCount, char *prefix, int hLangpack);
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
// language packs support
#define LANG_UNICODE 0x1000
-extern int hLangpack;
-
MIR_CORE_DLL(void) Langpack_SortDuplicates(void);
MIR_CORE_DLL(int) Langpack_GetDefaultCodePage( void );
MIR_CORE_DLL(int) Langpack_GetDefaultLocale(void);
diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index 61f3c1ed38..71d711bde8 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -22,8 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., HINSTANCE hInst;
int hLangpack;
-static HANDLE hModulesLoaded = 0, hChangedIcons = 0, hAccListChanged = 0,
- hMainMenuItem = 0, hToolBarItem = 0, hService = 0;
+static HANDLE hMainMenuItem = 0, hToolBarItem = 0;
HANDLE hIconLibItem;
HWND hAddDlg;
@@ -134,20 +133,13 @@ static int CreateButton(WPARAM, LPARAM) return 0;
}
+static IconItem icon = { LPGEN("Add Contact"), ICON_ADD, IDI_ADDCONTACT };
+
static int OnModulesLoaded(WPARAM, LPARAM)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszDefaultFile = szFile;
- sid.ptszSection = LPGENT("AddContact+");
- sid.iDefaultIndex = -IDI_ADDCONTACT;
- sid.ptszDescription = LPGENT("Add Contact");
- sid.pszName = ICON_ADD;
- hIconLibItem = Skin_AddIcon(&sid);
- hChangedIcons = HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
+ Icon_Register(hInst, LPGEN("AddContact+"), &icon, 1);
+
+ HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
HOTKEYDESC hkd = {0};
hkd.cbSize = sizeof(hkd);
@@ -174,19 +166,14 @@ extern "C" int __declspec(dllexport) Load(void) icex.dwICC = ICC_USEREX_CLASSES;
InitCommonControlsEx(&icex);
- hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- hAccListChanged = HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccListChanged);
- hService = CreateServiceFunction(MS_ADDCONTACTPLUS_SHOW, AddContactPlusDialog);
-
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccListChanged);
+
+ CreateServiceFunction(MS_ADDCONTACTPLUS_SHOW, AddContactPlusDialog);
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
- UnhookEvent(hModulesLoaded);
- UnhookEvent(hChangedIcons);
- UnhookEvent(hAccListChanged);
- DestroyServiceFunction(hService);
-
return 0;
}
diff --git a/plugins/Alarms/src/icons.cpp b/plugins/Alarms/src/icons.cpp index d02534df31..8b9aca1780 100644 --- a/plugins/Alarms/src/icons.cpp +++ b/plugins/Alarms/src/icons.cpp @@ -3,6 +3,15 @@ HICON hIconMenuSet, hIconList1, hIconList2, hIconMenuShowHide, hIconSystray;
+static IconItem iconList[] =
+{
+ { LPGEN("Menu: Set Alarm"), "alarms_menu_set", IDI_MAINMENU },
+ { LPGEN("Reminder: Soon"), "alarms_list1", IDI_LIST1 },
+ { LPGEN("Reminder: Very Soon"), "alarms_list2", IDI_LIST2 },
+ { LPGEN("Alarm: System Tray"), "alarms_systray", IDI_MAINMENU },
+ { LPGEN("Menu: Show/Hide Reminders"), "alarms_menu_showhide", IDI_MAINMENU }
+};
+
int ReloadIcons(WPARAM wParam, LPARAM lParam)
{
hIconMenuSet = Skin_GetIcon("alarms_menu_set");
@@ -17,51 +26,11 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam) void InitIcons()
{
- TCHAR path[MAX_PATH]; - GetModuleFileName(hInst, path, MAX_PATH); -
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = "Alarms";
- sid.ptszDefaultFile = path;
- sid.flags = SIDF_PATH_TCHAR;
-
- sid.pszDescription = LPGEN("Menu: Set Alarm");
- sid.pszName = "alarms_menu_set";
- sid.pszDefaultFile = "alarms.dll";
- sid.iDefaultIndex = -IDI_MAINMENU;
- Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Reminder: Soon");
- sid.pszName = "alarms_list1";
- sid.pszDefaultFile = "alarms.dll";
- sid.iDefaultIndex = -IDI_LIST1;
-
- sid.pszDescription = LPGEN("Reminder: Very Soon");
- sid.pszName = "alarms_list2";
- sid.pszDefaultFile = "alarms.dll";
- sid.iDefaultIndex = -IDI_LIST2;
- Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Alarm: System Tray");
- sid.pszName = "alarms_systray";
- sid.pszDefaultFile = "alarms.dll";
- sid.iDefaultIndex = -IDI_MAINMENU;
- Skin_AddIcon(&sid);
-
- if ( !ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
- sid.pszDescription = LPGEN("Menu: Show/Hide Reminders");
- sid.pszName = "alarms_menu_showhide";
- sid.pszDefaultFile = "alarms.dll";
- sid.iDefaultIndex = -IDI_MAINMENU;
- Skin_AddIcon(&sid);
+ Icon_Register(hInst, "Alarms", iconList, SIZEOF(iconList));
+ if ( !ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
hIconMenuShowHide = Skin_GetIcon("alarms_menu_showhide");
- }
-
- hIconMenuSet = Skin_GetIcon("alarms_menu_set");
- hIconList1 = Skin_GetIcon("alarms_list1");
- hIconList2 = Skin_GetIcon("alarms_list2");
- hIconSystray = Skin_GetIcon("alarms_systray");
+ ReloadIcons(0, 0);
HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
}
diff --git a/plugins/AuthState/src/commonheaders.h b/plugins/AuthState/src/commonheaders.h index a234517f03..ba5fd1ebc6 100644 --- a/plugins/AuthState/src/commonheaders.h +++ b/plugins/AuthState/src/commonheaders.h @@ -44,6 +44,7 @@ #include <m_langpack.h>
#include <m_icolib.h>
#include <m_cluiframes.h>
+#include <win2k.h>
#include "resource.h"
#include "Version.h"
diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index cf2e215e72..e6b6f4496e 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -169,31 +169,17 @@ int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) return 0;
}
+static IconItem iconList[] =
+{
+ { LPGEN("Auth"), "auth_icon", IDI_AUTH },
+ { LPGEN("Grant"), "grant_icon", IDI_GRANT },
+ { LPGEN("Auth & Grant"), "authgrant_icon", IDI_AUTHGRANT }
+};
+
int onModulesLoaded(WPARAM wParam,LPARAM lParam)
{
// IcoLib support
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = szFile;
- sid.pszSection = "Auth State";
-
- sid.pszDescription = LPGEN("Auth");
- sid.pszName = "auth_icon";
- sid.iDefaultIndex = -IDI_AUTH;
- Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Grant");
- sid.pszName = "grant_icon";
- sid.iDefaultIndex = -IDI_GRANT;
- Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Auth & Grant");
- sid.pszName = "authgrant_icon";
- sid.iDefaultIndex = -IDI_AUTHGRANT;
- Skin_AddIcon(&sid);
+ Icon_Register(g_hInst, "Auth State", iconList, SIZEOF(iconList));
// extra icons
hExtraIcon = ExtraIcon_Register("authstate", "Auth State", "authgrant_icon");
diff --git a/plugins/AutoShutdown/src/main.cpp b/plugins/AutoShutdown/src/main.cpp index c81b86a0b8..4128bd7a1a 100644 --- a/plugins/AutoShutdown/src/main.cpp +++ b/plugins/AutoShutdown/src/main.cpp @@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE hInst;
static HANDLE hHookModulesLoaded;
-HANDLE hActiveIcon,hInactiveIcon;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -39,6 +38,13 @@ PLUGININFOEX pluginInfo = { {0x9de24579, 0x5c5c, 0x49aa, {0x80, 0xe8, 0x4d, 0x38, 0xe4, 0x34, 0x4e, 0x63}}
};
+IconItem iconList[] =
+{
+ { LPGEN("Header"), "AutoShutdown_Header", IDI_HEADER },
+ { LPGEN("Active"), "AutoShutdown_Active", IDI_ACTIVE },
+ { LPGEN("Inactive"), "AutoShutdown_Inactive", IDI_INACTIVE },
+};
+
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, VOID *pReserved)
{
hInst = hinstDLL;
@@ -89,6 +95,8 @@ extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD m extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[]={MIID_SHUTDOWN,MIID_LAST};
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
@@ -100,9 +108,7 @@ extern "C" __declspec(dllexport) int Load(void) if(InitFrame()) return 1; /* before icons */
/* shared */
- IcoLib_AddIconRes("AutoShutdown_Header",TranslateT("Automatic Shutdown"),TranslateT("Header"),hInst,IDI_HEADER,TRUE);
- hActiveIcon=IcoLib_AddIconRes("AutoShutdown_Active",TranslateT("Automatic Shutdown"),TranslateT("Active"),hInst,IDI_ACTIVE,FALSE);
- hInactiveIcon=IcoLib_AddIconRes("AutoShutdown_Inactive",TranslateT("Automatic Shutdown"),TranslateT("Inactive"),hInst,IDI_INACTIVE,FALSE);
+ Icon_Register(hInst, "Automatic Shutdown", iconList, SIZEOF(iconList));
InitShutdownSvc();
InitWatcher(); /* before InitSettingsDlg() */
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp index 4c980117f2..36910dfdf7 100644 --- a/plugins/AutoShutdown/src/settingsdlg.cpp +++ b/plugins/AutoShutdown/src/settingsdlg.cpp @@ -435,14 +435,14 @@ void SetShutdownToolbarButton(BOOL fActive) /************************* Menu Item **********************************/
static HANDLE hMainMenuItem,hTrayMenuItem;
-extern HANDLE hActiveIcon,hInactiveIcon;
+extern IconItem iconList[];
void SetShutdownMenuItem(BOOL fActive)
{
/* main menu */
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 2001090000;
- mi.icolibItem = fActive?hActiveIcon:hInactiveIcon;
+ mi.icolibItem = fActive ? iconList[1].hIcolib : iconList[2].hIcolib;
mi.ptszName = fActive?_T("Stop automatic &shutdown"):_T("Automatic &shutdown..."); /* autotranslated */
mi.pszService = "AutoShutdown/MenuCommand";
mi.flags = CMIF_TCHAR|CMIF_ICONFROMICOLIB;
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index de344a5929..f06469adef 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -36,8 +36,6 @@ TCHAR * GetContactFolder(TCHAR *fn, HANDLE hContact); BOOL ResolveShortcut(TCHAR *shortcut, TCHAR *file);
static INT_PTR ShowDialogSvc(WPARAM wParam, LPARAM lParam);
-extern HANDLE hServices[];
-extern HANDLE hHooks[];
struct AvatarDialogData
{
@@ -540,7 +538,7 @@ int PreBuildContactMenu(WPARAM wParam,LPARAM lParam) void InitMenuItem()
{
- hServices[2] = CreateServiceFunction(MS_AVATARHISTORY_SHOWDIALOG, ShowDialogSvc);
+ CreateServiceFunction(MS_AVATARHISTORY_SHOWDIALOG, ShowDialogSvc);
CLISTMENUITEM mi = { sizeof(mi) };
mi.ptszName = LPGENT("View Avatar History");
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 68fed732d0..fe493bddd5 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -27,9 +27,6 @@ HINSTANCE hInst; DWORD mirVer;
-HANDLE hHooks[6] = {0};
-HANDLE hServices[3] = {0};
-
HANDLE hFolder = NULL;
char *metacontacts_proto = NULL;
@@ -172,14 +169,14 @@ extern "C" __declspec(dllexport) int Load(void) LoadOptions();
- hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
- hHooks[1] = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
- hHooks[3] = HookEvent(ME_OPT_INITIALISE, OptInit);
- hHooks[4] = HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged);
- hHooks[5] = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);
+ HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
+ HookEvent(ME_OPT_INITIALISE, OptInit);
+ HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu);
- hServices[0] = CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled);
- hServices[1] = CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);
+ CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled);
+ CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar);
if(CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath) != 0)
_tcscpy(profilePath, _T(".")); // Failed, use current dir
@@ -206,10 +203,9 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) if (ServiceExists(MS_MC_GETPROTOCOLNAME))
metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
- if (DBGetContactSettingByte(NULL, MODULE_NAME, "LogToHistory", AVH_DEF_LOGTOHISTORY))
+ if (DBGetContactSettingByte(NULL, MODULE_NAME, "LogToHistory", AVH_DEF_LOGTOHISTORY))
{
- char *templates[] = { "Avatar change\nchanged his/her avatar",
- "Avatar removal\nremoved his/her avatar" };
+ char *templates[] = { "Avatar change\nchanged his/her avatar", "Avatar removal\nremoved his/her avatar" };
HICON hIcon = createDefaultOverlayedIcon(FALSE);
HistoryEvents_RegisterWithTemplates(MODULE_NAME, "avatarchange", "Avatar change", EVENTTYPE_AVATAR_CHANGE, hIcon,
HISTORYEVENTS_FORMAT_CHAR | HISTORYEVENTS_FORMAT_WCHAR | HISTORYEVENTS_FORMAT_RICH_TEXT,
@@ -218,23 +214,14 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) DestroyIcon(hIcon);
}
- hHooks[2] = HookEvent(ME_AV_CONTACTAVATARCHANGED, AvatarChanged);
+ HookEvent(ME_AV_CONTACTAVATARCHANGED, AvatarChanged);
return 0;
}
static int PreShutdown(WPARAM wParam, LPARAM lParam)
{
- int i;
-
- for (i = 0; i < MAX_REGS(hHooks); i++)
- UnhookEvent(hHooks[i]);
-
- for (i = 0; i < MAX_REGS(hServices); i++)
- DestroyServiceFunction(hServices[i]);
-
WindowList_Broadcast(hAvatarWindowsList,WM_CLOSE,0,0);
-
return 0;
}
diff --git a/plugins/AvatarHistory/src/icolib.cpp b/plugins/AvatarHistory/src/icolib.cpp index 28a88494bb..12497d1009 100644 --- a/plugins/AvatarHistory/src/icolib.cpp +++ b/plugins/AvatarHistory/src/icolib.cpp @@ -6,42 +6,20 @@ enum IconIndex I_OVERLAY
};
-typedef struct
+static IconItem iconList[] =
{
- TCHAR* szDescr;
- char* szName;
- int defIconID;
- BOOL core;
-} IconStruct;
-
-static IconStruct iconList[] =
-{
- { LPGENT("History"), "core_main_10", IDI_AVATARHIST, TRUE },
- { LPGENT("Avatar Overlay"), "avh_overlay", IDI_AVATAROVERLAY, FALSE }
+ { LPGEN("History"), "core_main_10", IDI_AVATARHIST },
+ { LPGEN("Avatar Overlay"), "avh_overlay", IDI_AVATAROVERLAY }
};
-extern HANDLE hHooks[];
-
static HICON LoadIconEx(IconIndex i)
{
- HICON hIcon;
-
- if (hHooks[4])
- hIcon = Skin_GetIcon(iconList[(int)i].szName);
- else
- hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(iconList[(int)i].defIconID),
- IMAGE_ICON, 0, 0, 0);
-
- return hIcon;
+ return Skin_GetIcon(iconList[(int)i].szName);
}
-
static void ReleaseIconEx(HICON hIcon)
{
- if (hHooks[4])
- Skin_ReleaseIcon(hIcon);
- else
- DestroyIcon(hIcon);
+ Skin_ReleaseIcon(hIcon);
}
static void IcoLibUpdateMenus()
@@ -61,24 +39,8 @@ int IcoLibIconsChanged(WPARAM wParam, LPARAM lParam) void SetupIcoLib()
{
- if (hHooks[4]) {
- TCHAR path[MAX_PATH];
- GetModuleFileName(hInst, path, sizeof(path));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszSection = LPGENT("Avatar History");
- sid.ptszDefaultFile = path;
- sid.flags = SIDF_ALL_TCHAR;
-
- for (unsigned i = 0; i < MAX_REGS(iconList); i++) {
- if (!iconList[i].core) {
- sid.ptszDescription = iconList[i].szDescr;
- sid.pszName = iconList[i].szName;
- sid.iDefaultIndex = -iconList[i].defIconID;
- Skin_AddIcon(&sid);
- }
- }
- }
+ iconList[0].hIcolib = LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY);
+ Icon_Register(hInst, LPGEN("Avatar History"), iconList+1, SIZEOF(iconList)-1);
IcoLibUpdateMenus();
}
diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index d981658be9..da170979b1 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -296,40 +296,15 @@ INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara return 0;
}
-struct
+static IconItem iconList[] =
{
- char* szDescr;
- char* szName;
- int defIconID;
-}
-static const iconList[] =
-{
- { "Audio device is opened", "BASSSoundOnOffUp", IDI_BASSSoundOnOffUp },
- { "Audio device is closed", "BASSSoundOnOffDown", IDI_BASSSoundOnOffDown }
+ { LPGEN("Audio device is opened"), "BASSSoundOnOffUp", IDI_BASSSoundOnOffUp },
+ { LPGEN("Audio device is closed"), "BASSSoundOnOffDown", IDI_BASSSoundOnOffDown }
};
-static HANDLE hIconLibItem[SIZEOF(iconList)];
-
void InitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.pszSection = ModuleName;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i=0; i < SIZEOF(iconList); i++) {
- char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", ModuleName, iconList[i].szName);
-
- sid.pszName = szSettingName;
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInst, ModuleName, iconList, SIZEOF(iconList));
}
int OptionsInit(WPARAM wParam, LPARAM lParam)
@@ -376,8 +351,8 @@ int OnToolbarLoaded(WPARAM wParam, LPARAM lParam) tbb.pszService = "BASSinterface/BASSSoundOnOff";
tbb.pszTooltipUp = LPGEN("Audio device is opened");
tbb.pszTooltipDn = LPGEN("Audio device is closed");
- tbb.hIconHandleUp = hIconLibItem[0];
- tbb.hIconHandleDn = hIconLibItem[1];
+ tbb.hIconHandleUp = iconList[0].hIcolib;
+ tbb.hIconHandleDn = iconList[1].hIcolib;
tbb.dwFlags = TTBBF_SHOWTOOLTIP;
hTBButton = TopToolbar_AddButton(&tbb);
return 0;
diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 482641463e..c9b6920d67 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -26,13 +26,9 @@ HINSTANCE hInst; HCURSOR hCurSplitNS, hCurSplitWE;
HANDLE g_hMainThread=NULL;
-extern HINSTANCE hInst;
-
HANDLE hServiceShowContactHistory, hServiceDeleteAllContactHistory, hServiceExecuteTask;
HANDLE *hEventIcons = NULL;
-int iconsNum;
-HANDLE hPlusIcon, hMinusIcon, hFindNextIcon, hFindPrevIcon;
-HANDLE hPlusExIcon, hMinusExIcon;
+int iconsNum = 3;
HANDLE hToolbarButton;
HGENMENU hContactMenu, hDeleteContactMenu;
HGENMENU hTaskMainMenu;
@@ -193,63 +189,30 @@ void InitTaskMenuItems() }
}
+IconItem iconList[] =
+{
+ { LPGEN("Incoming message"), "BasicHistory_in", IDI_INM },
+ { LPGEN("Outgoing message"), "BasicHistory_out", IDI_OUTM },
+ { LPGEN("Status change"), "BasicHistory_status", IDI_STATUS },
+ { LPGEN("Show Contacts"), "BasicHistory_show", IDI_SHOW },
+ { LPGEN("Hide Contacts"), "BasicHistory_hide", IDI_HIDE },
+ { LPGEN("Find Next"), "BasicHistory_findnext", IDI_FINDNEXT },
+ { LPGEN("Find Previous"), "BasicHistory_findprev", IDI_FINDPREV },
+ { LPGEN("Plus in export"), "BasicHistory_plusex", IDI_PLUSEX },
+ { LPGEN("Minus in export"), "BasicHistory_minusex", IDI_MINUSEX },
+};
+
void InitIcolib()
{
- TCHAR stzFile[MAX_PATH];
- GetModuleFileName(hInst, stzFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.cx = sid.cy = 16;
- sid.ptszDefaultFile = stzFile;
- sid.pszSection = LPGEN("History");
- sid.flags = SIDF_PATH_TCHAR;
-
- iconsNum = 3;
- hEventIcons = new HANDLE[iconsNum];
- sid.pszName = "BasicHistory_in";
- sid.pszDescription = LPGEN("Incoming message");
- sid.iDefaultIndex = -IDI_INM;
- hEventIcons[0] = Skin_AddIcon(&sid);
-
- sid.pszName = "BasicHistory_out";
- sid.pszDescription = LPGEN("Outgoing message");
- sid.iDefaultIndex = -IDI_OUTM;
- hEventIcons[1] = Skin_AddIcon(&sid);
-
- sid.pszName = "BasicHistory_status";
- sid.pszDescription = LPGEN("Statuschange");
- sid.iDefaultIndex = -IDI_STATUS;
- hEventIcons[2] = Skin_AddIcon(&sid);
-
- sid.pszName = "BasicHistory_show";
- sid.pszDescription = LPGEN("Show Contacts");
- sid.iDefaultIndex = -IDI_SHOW;
- hPlusIcon = Skin_AddIcon(&sid);
-
- sid.pszName = "BasicHistory_hide";
- sid.pszDescription = LPGEN("Hide Contacts");
- sid.iDefaultIndex = -IDI_HIDE;
- hMinusIcon = Skin_AddIcon(&sid);
-
- sid.pszName = "BasicHistory_findnext";
- sid.pszDescription = LPGEN("Find Next");
- sid.iDefaultIndex = -IDI_FINDNEXT;
- hFindNextIcon = Skin_AddIcon(&sid);
-
- sid.pszName = "BasicHistory_findprev";
- sid.pszDescription = LPGEN("Find Previous");
- sid.iDefaultIndex = -IDI_FINDPREV;
- hFindPrevIcon = Skin_AddIcon(&sid);
-
- sid.pszName = "BasicHistory_plusex";
- sid.pszDescription = LPGEN("Plus in export");
- sid.iDefaultIndex = -IDI_PLUSEX;
- hPlusExIcon = Skin_AddIcon(&sid);
-
- sid.pszName = "BasicHistory_minusex";
- sid.pszDescription = LPGEN("Minus in export");
- sid.iDefaultIndex = -IDI_MINUSEX;
- hMinusExIcon = Skin_AddIcon(&sid);
+}
+
+HICON LoadIconEx(int iconId, int big)
+{
+ for (int i=0; i < SIZEOF(iconList); i++)
+ if ( iconList[i].defIconID == iconId)
+ return Skin_GetIconByHandle(iconList[i].hIcolib, big);
+
+ return 0;
}
INT_PTR ShowContactHistory(WPARAM wParam, LPARAM lParam)
@@ -328,16 +291,22 @@ extern "C" int __declspec(dllexport) Load(void) DuplicateHandle(GetCurrentProcess(),GetCurrentThread(),GetCurrentProcess(),&g_hMainThread,0,FALSE,DUPLICATE_SAME_ACCESS);
mir_getTMI(&tmi);
mir_getLP(&pluginInfo);
+
hCurSplitNS = LoadCursor(NULL, IDC_SIZENS);
hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE);
+
hServiceShowContactHistory = CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, ShowContactHistory);
hServiceDeleteAllContactHistory = CreateServiceFunction(MS_HISTORY_DELETEALLCONTACTHISTORY, HistoryWindow::DeleteAllUserHistory);
hServiceExecuteTask = CreateServiceFunction(MS_HISTORY_EXECUTE_TASK, ExecuteTaskService);
+
Options::instance = new Options();
+
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_OPT_INITIALISE, Options::InitOptions);
+
EventList::Init();
- InitIcolib();
+
+ Icon_Register(hInst, LPGEN("History"), iconList, SIZEOF(iconList));
return 0;
}
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index dfde02eb0b..98ca26771c 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -26,12 +26,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MODULE "BasicHistory"
extern HINSTANCE hInst;
-extern HCURSOR hCurSplitNS, hCurSplitWE;
-extern HANDLE *hEventIcons;
+extern HCURSOR hCurSplitNS, hCurSplitWE;
extern int iconsNum;
-extern HANDLE hPlusIcon, hMinusIcon, hFindNextIcon, hFindPrevIcon;
extern bool g_SmileyAddAvail;
extern char* metaContactProto;
+extern IconItem iconList[];
#define DM_HREBUILD (WM_USER+11)
#define DM_SPLITTERMOVED (WM_USER+15)
@@ -56,7 +55,7 @@ HistoryWindow::HistoryWindow(HANDLE _hContact) : isLoading(false),
isGroupImages(false),
allIconNumber(0),
- eventIcoms(NULL),
+ eventIcons(NULL),
bkBrush(NULL),
bkFindBrush(NULL),
hSystem(NULL),
@@ -80,13 +79,13 @@ HistoryWindow::HistoryWindow(HANDLE _hContact) : HistoryWindow::~HistoryWindow()
{
- if(eventIcoms != NULL)
+ if(eventIcons != NULL)
{
for(int i = 0; i < iconsNum; ++i)
- if(eventIcoms[i] != NULL)
- Skin_ReleaseIcon(eventIcoms[i]);
+ if(eventIcons[i] != NULL)
+ Skin_ReleaseIcon(eventIcons[i]);
- delete[] eventIcoms;
+ delete[] eventIcons;
}
if(plusIco != NULL)
@@ -1203,8 +1202,8 @@ void HistoryWindow::Initialise() ScreenToClient(hWnd, &pt);
listOryginalPos = pt.x;
- plusIco = Skin_GetIconByHandle(hPlusIcon, 1);
- minusIco = Skin_GetIconByHandle(hMinusIcon, 1);
+ plusIco = LoadIconEx(IDI_SHOW, 1);
+ minusIco = LoadIconEx(IDI_HIDE, 1);
SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONSETASPUSHBTN, TRUE, 0 );
SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONSETASFLATBTN, TRUE, 0 );
if(hContact == NULL || Options::instance->showContacts)
@@ -1241,22 +1240,21 @@ void HistoryWindow::Initialise() if(himlSmall)
{
allIconNumber = iconsNum + 3;
- eventIcoms = new HICON[allIconNumber];
- for(int i = 0; i < iconsNum; ++i)
- {
- eventIcoms[i] = hEventIcons[i] == NULL ? NULL : Skin_GetIconByHandle(hEventIcons[i]);
- ImageList_AddIcon(himlSmall, eventIcoms[i]);
+ eventIcons = new HICON[allIconNumber];
+ for(int i = 0; i < iconsNum; ++i) {
+ eventIcons[i] = Skin_GetIconByHandle( iconList[i].hIcolib );
+ ImageList_AddIcon(himlSmall, eventIcons[i]);
}
int id = iconsNum;
- eventIcoms[id] = LoadSkinnedIcon(SKINICON_EVENT_FILE);
- ImageList_AddIcon(himlSmall, eventIcoms[id]);
+ eventIcons[id] = LoadSkinnedIcon(SKINICON_EVENT_FILE);
+ ImageList_AddIcon(himlSmall, eventIcons[id]);
- eventIcoms[++id] = LoadSkinnedIcon(SKINICON_EVENT_URL);
- ImageList_AddIcon(himlSmall, eventIcoms[id]);
+ eventIcons[++id] = LoadSkinnedIcon(SKINICON_EVENT_URL);
+ ImageList_AddIcon(himlSmall, eventIcons[id]);
- eventIcoms[++id] = LoadSkinnedIcon(SKINICON_OTHER_WINDOWS);
- ImageList_AddIcon(himlSmall, eventIcoms[id]);
+ eventIcons[++id] = LoadSkinnedIcon(SKINICON_OTHER_WINDOWS);
+ ImageList_AddIcon(himlSmall, eventIcons[id]);
if((isGroupImages = Options::instance->groupShowEvents) != false)
ListView_SetImageList(listWindow, himlSmall, LVSIL_SMALL);
@@ -1284,9 +1282,9 @@ void HistoryWindow::Initialise() HIMAGELIST himlButtons = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 3, 3);
if(himlButtons)
{
- findNextIco = Skin_GetIconByHandle(hFindNextIcon);
+ findNextIco = LoadIconEx(IDI_FINDNEXT);
ImageList_AddIcon(himlButtons, findNextIco);
- findPrevIco = Skin_GetIconByHandle(hFindPrevIcon);
+ findPrevIco = LoadIconEx(IDI_FINDPREV);
ImageList_AddIcon(himlButtons, findPrevIco);
configIco = LoadSkinnedIcon(SKINICON_OTHER_OPTIONS);
ImageList_AddIcon(himlButtons, configIco);
@@ -1608,14 +1606,14 @@ void HistoryWindow::SelectEventGroup(int sel) HICON ico;
if(GetEventIcon(lastMe, data.eventType, imId))
{
- ico = eventIcoms[imId];
+ ico = eventIcons[imId];
}
else
{
ico = GetEventCoreIcon(hDbEvent);
if(ico == NULL)
{
- ico = eventIcoms[imId];
+ ico = eventIcons[imId];
}
}
diff --git a/plugins/BasicHistory/src/HistoryWindow.h b/plugins/BasicHistory/src/HistoryWindow.h index 5575c6c11e..afc00c787d 100644 --- a/plugins/BasicHistory/src/HistoryWindow.h +++ b/plugins/BasicHistory/src/HistoryWindow.h @@ -56,7 +56,7 @@ private: LONG splitterOrgY;
LONG splitterX;
LONG splitterOrgX;
- HICON *eventIcoms;
+ HICON *eventIcons;
int allIconNumber;
HICON plusIco, minusIco, findNextIco, findPrevIco, configIco, deleteIco;
WNDPROC OldSplitterProc;
diff --git a/plugins/BasicHistory/src/RichHtmlExport.cpp b/plugins/BasicHistory/src/RichHtmlExport.cpp index d1254e4dcc..3a000f0744 100644 --- a/plugins/BasicHistory/src/RichHtmlExport.cpp +++ b/plugins/BasicHistory/src/RichHtmlExport.cpp @@ -27,8 +27,6 @@ RichHtmlExport::~RichHtmlExport() }
extern HINSTANCE hInst;
-extern HANDLE *hEventIcons;
-extern HANDLE hPlusExIcon, hMinusExIcon;
extern bool g_SmileyAddAvail;
std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<size_t, size_t> >* positionMap = NULL)
@@ -318,19 +316,19 @@ void RichHtmlExport::WriteHeader(const std::wstring &fileName, const std::wstrin ExtractFile(IDR_CSS, css);
ExtractFile(IDR_JS, folder + _T("\\history.js"));
- HICON ico = Skin_GetIconByHandle(hPlusExIcon);
+ HICON ico = LoadIconEx(IDI_PLUSEX);
IcoSave(folder + _T("\\pnode.ico"), ico);
Skin_ReleaseIcon(ico);
- ico = Skin_GetIconByHandle(hMinusExIcon);
+ ico = LoadIconEx(IDI_MINUSEX);
IcoSave(folder + _T("\\mnode.ico"), ico);
Skin_ReleaseIcon(ico);
- ico = Skin_GetIconByHandle(hEventIcons[0]);
+ ico = LoadIconEx(IDI_INM);
IcoSave(folder + _T("\\event0.ico"), ico);
Skin_ReleaseIcon(ico);
- ico = Skin_GetIconByHandle(hEventIcons[1]);
+ ico = LoadIconEx(IDI_OUTM);
IcoSave(folder + _T("\\event1.ico"), ico);
Skin_ReleaseIcon(ico);
diff --git a/plugins/BasicHistory/src/stdafx.h b/plugins/BasicHistory/src/stdafx.h index 1be1d46674..32ef7720e7 100644 --- a/plugins/BasicHistory/src/stdafx.h +++ b/plugins/BasicHistory/src/stdafx.h @@ -86,4 +86,6 @@ #define HISTORY_HK_ALLCONTACTS 117
#define EVENTTYPE_STATUSCHANGE 25368
-#define EVENTTYPE_SMTPSIMPLE 2350
\ No newline at end of file +#define EVENTTYPE_SMTPSIMPLE 2350
+
+HICON LoadIconEx(int iconId, int big = 0);
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 23f2ed6ac9..6870846174 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -32,7 +32,7 @@ // unique to this DLL, not to be shared
HINSTANCE g_hInstance;
CLIST_INTERFACE *pcli;
-HANDLE g_hmGenMenuInit, g_hIcon, g_hMenuItem, g_hHideService, g_hIsHiddenService;
+HANDLE g_hmGenMenuInit, g_hMenuItem, g_hHideService, g_hIsHiddenService;
HWINEVENTHOOK g_hWinHook;
HWND g_hListenWindow, hDlg, g_hDlgPass, hOldForegroundWindow;
HWND_ITEM *g_pMirWnds; // a pretty simple linked list
@@ -596,22 +596,10 @@ static TCHAR *GetBossKeyText(void) return buf;
}
-static int IcoLibInit (void) // Icolib support
+static IconItem iconList[] =
{
- TCHAR tszFile[MAX_PATH];
- GetModuleFileName(g_hInstance, tszFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszDefaultFile = tszFile;
- sid.cx = sid.cy = 16;
- sid.ptszSection = _T("BossKey");
- sid.pszName = "hidemim";
- sid.ptszDescription = _T("Hide Miranda NG");
- sid.iDefaultIndex = -IDI_DLGPASSWD;
- g_hIcon = Skin_AddIcon(&sid);
- return 0;
-}
+ { LPGEN("Hide Miranda NG"), "hidemim", IDI_DLGPASSWD }
+};
static int GenMenuInit(WPARAM wParam, LPARAM lParam) // Modify menu item text before to show the main menu
{
@@ -673,7 +661,7 @@ static int ModernToolbarInit(WPARAM, LPARAM) // Modern toolbar support button.pszService = MS_BOSSKEY_HIDE;
button.pszTooltipUp = button.name = LPGEN("Hide Miranda NG");
button.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- button.hIconHandleUp = g_hIcon;
+ button.hIconHandleUp = iconList[0].hIcolib;
TopToolbar_AddButton(&button);
return 0;
}
@@ -698,7 +686,7 @@ static int TabsrmmButtonsInit(WPARAM wParam, LPARAM lParam) bbd.dwDefPos = 5000;
bbd.ptszTooltip = _T("Hide Miranda NG");
bbd.bbbFlags = BBBF_ISRSIDEBUTTON | BBBF_CANBEHIDDEN;
- bbd.hIcon = g_hIcon;
+ bbd.hIcon = iconList[0].hIcolib;
CallService (MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
return 0;
@@ -842,7 +830,7 @@ extern "C" int __declspec(dllexport) Load(void) DBWriteContactSettingByte(NULL, "PopUp", "ModuleIsEnabled", 0);
}
- IcoLibInit();
+ Icon_Register(g_hInstance, "BossKey", iconList, SIZEOF(iconList));
g_hHideService = CreateServiceFunction(MS_BOSSKEY_HIDE,BossKeyHideMiranda); // Create service
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 69942d594c..6ff1fe116a 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -48,7 +48,6 @@ HANDLE hHookExtraIconsRebuild = NULL; HANDLE hHookExtraIconsApply = NULL;
HICON hIcon;
-HANDLE hEnabledIcon = NULL, hDisabledIcon = NULL;
HANDLE hExtraIcon;
// Popup Actions
@@ -71,6 +70,15 @@ PLUGININFOEX pluginInfo = { {0xddf8aec9, 0x7d37, 0x49af, {0x9d, 0x22, 0xbb, 0xbc, 0x92, 0x0e, 0x6f, 0x05}}
};
+static IconItem iconList[] =
+{
+ { LPGEN("Tray/popup icon"), "main_icon", IDI_MAINICON },
+ { LPGEN("Enabled"), "enabled_icon", IDI_ENABLED },
+ { LPGEN("Disabled"), "disabled_icon", IDI_DISABLED },
+ { LPGEN("Hide"), "hide_icon", IDI_HIDE },
+ { LPGEN("NeverHide"), "neverhide_icon", IDI_NEVERHIDE }
+};
+
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
hInst = hinstDLL;
@@ -480,13 +488,13 @@ int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) {
mi.flags |= CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.ptszName = LPGENT("Disable Miss You");
- mi.icolibItem = hEnabledIcon;
+ mi.icolibItem = iconList[1].hIcolib;
}
else
{
mi.flags |= CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.ptszName = LPGENT("Enable Miss You");
- mi.icolibItem = hDisabledIcon;
+ mi.icolibItem = iconList[2].hIcolib;
}
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi);
@@ -657,6 +665,7 @@ int ModulesLoaded2(WPARAM wParam, LPARAM lParam) /**
* Called when all the modules are loaded
*/
+
int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
hEventUserInfoInit = HookEvent(ME_USERINFO_INITIALISE, UserinfoInit);
@@ -675,39 +684,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) ////////////////////////////////////////////////////////////////////////////
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- // IcoLib support
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszSection = LPGENT("BuddyExpectator");
-
- sid.ptszDescription = LPGENT("Tray/popup icon");
- sid.pszName = "main_icon";
- sid.iDefaultIndex = -IDI_MAINICON;
- Skin_AddIcon(&sid);
-
- sid.ptszDescription = LPGENT("Enabled");
- sid.pszName = "enabled_icon";
- sid.iDefaultIndex = -IDI_ENABLED;
- hEnabledIcon = Skin_AddIcon(&sid);
-
- sid.ptszDescription = LPGENT("Disabled");
- sid.pszName = "disabled_icon";
- sid.iDefaultIndex = -IDI_DISABLED;
- hDisabledIcon = Skin_AddIcon(&sid);
-
- sid.ptszDescription = LPGENT("Hide");
- sid.pszName = "hide_icon";
- sid.iDefaultIndex = -IDI_HIDE;
- Skin_AddIcon(&sid);
-
- sid.ptszDescription = LPGENT("NeverHide");
- sid.pszName = "neverhide_icon";
- sid.iDefaultIndex = -IDI_NEVERHIDE;
- Skin_AddIcon(&sid);
+ Icon_Register(hInst, "BuddyExpectator", iconList, SIZEOF(iconList));
hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, onIconsChanged);
@@ -718,7 +695,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- mi.icolibItem = hDisabledIcon;
+ mi.icolibItem = iconList[2].hIcolib;
mi.position = 200000;
mi.ptszName = LPGENT("Enable Miss You");
mi.pszService = "BuddyExpectator/actionMissYouClick";
diff --git a/plugins/BuddyExpectator/src/common.h b/plugins/BuddyExpectator/src/common.h index 4317679036..ecabbfe949 100644 --- a/plugins/BuddyExpectator/src/common.h +++ b/plugins/BuddyExpectator/src/common.h @@ -46,6 +46,7 @@ #include <m_options.h>
#include <m_protosvc.h>
#include <m_utils.h>
+#include <win2k.h>
#include <m_ignore.h>
#include <m_message.h>
#include <m_userinfo.h>
diff --git a/plugins/ChangeKeyboardLayout/src/commonheaders.h b/plugins/ChangeKeyboardLayout/src/commonheaders.h index 27646be794..3e148b9278 100644 --- a/plugins/ChangeKeyboardLayout/src/commonheaders.h +++ b/plugins/ChangeKeyboardLayout/src/commonheaders.h @@ -22,6 +22,7 @@ #include <m_ieview.h>
#include "m_changekeyboardlayout.h"
#include <m_popup2.h>
+#include <win2k.h>
#include "resource.h"
#include "options.h"
@@ -94,7 +95,6 @@ typedef struct extern HINSTANCE hInst;
extern HANDLE hChangeLayout, hGetLayoutOfText, hChangeTextLayout;
-extern HANDLE hIcoLibIconsChanged;
extern HICON hPopupIcon, hCopyIcon;
diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index 69f5266a5b..227ba6e2fb 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -100,6 +100,11 @@ int OnIconsChanged(WPARAM wParam, LPARAM lParam) return 0;
}
+static IconItem iconList[] =
+{
+ { LPGEN("Popup"), "ckl_popup_icon", IDI_POPUPICON },
+ { LPGEN("Copy to clipboard"), "ckl_copy_icon", IDI_COPYICON }
+};
int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
@@ -150,25 +155,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) hChangeTextLayout = CreateServiceFunction(MS_CKL_CHANGETEXTLAYOUT, APIChangeTextLayout);
// IcoLib support
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_PATH_TCHAR;
-
- sid.pszSection = Translate(ModuleName);
- sid.pszDescription = Translate("Popup");
- sid.pszName = "ckl_popup_icon";
- sid.iDefaultIndex = -IDI_POPUPICON;
- Skin_AddIcon(&sid);
+ Icon_Register(hInst, ModuleName, iconList, SIZEOF(iconList));
- sid.pszDescription = Translate("Copy to clipboard");
- sid.pszName = "ckl_copy_icon";
- sid.iDefaultIndex = -IDI_COPYICON;
- Skin_AddIcon(&sid);
-
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
OnIconsChanged(0, 0);
RegPopupActions();
@@ -214,24 +203,20 @@ LRESULT CALLBACK Keyboard_Hook(int code, WPARAM wParam, LPARAM lParam) lcode += wParam;
// Ïðîâåðêà íà ïóñòîé õîòêåé. Èíà÷å - ïèçäåö, êàê â âåðñèè 1.4
- if (lcode != 0)
- if ((lcode == moOptions.dwHotkey_Layout) && (!(lParam&0x40000000)))
- {
+ if (lcode != 0) {
+ if ((lcode == moOptions.dwHotkey_Layout) && (!(lParam & 0x40000000))) {
ChangeLayout(NULL, TOT_Layout, moOptions.CurrentWordLayout);
return 1;
}
- else
- if ((lcode == moOptions.dwHotkey_Layout2) && (!(lParam&0x40000000)))
- {
+ if ((lcode == moOptions.dwHotkey_Layout2) && (!(lParam & 0x40000000))) {
ChangeLayout(NULL, TOT_Layout, moOptions.CurrentWordLayout2);
return 1;
}
- else
- if ((lcode == moOptions.dwHotkey_Case) && (!(lParam&0x40000000)))
- {
+ if ((lcode == moOptions.dwHotkey_Case) && (!(lParam & 0x40000000))) {
ChangeLayout(NULL, TOT_Case, moOptions.CurrentWordCase);
return 1;
}
+ }
}
return CallNextHookEx(kbHook_All, code, wParam, lParam);
}
@@ -241,43 +226,28 @@ int CALLBACK CKLPopupDlgProc(HWND hWnd, UINT uiMessage, WPARAM wParam, LPARAM lP LPTSTR ptszPopupText;
ptszPopupText = (LPTSTR)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, (LPARAM)&ptszPopupText);
- switch(uiMessage)
- {
- case WM_COMMAND:
- {
- if (HIWORD(wParam) == STN_CLICKED)
- {
- if (!IsBadStringPtr(ptszPopupText, MaxTextSize))
- CopyTextToClipboard(ptszPopupText);
- PUDeletePopUp(hWnd);
-
- }
- break;
- }
-
- case WM_CONTEXTMENU:
- {
- PUDeletePopUp(hWnd);
- break;
- }
-
- case UM_POPUPACTION:
- {
- if ((lParam == 0) && (!IsBadStringPtr(ptszPopupText, MaxTextSize)))
- {
- CopyTextToClipboard(ptszPopupText);
- }
- break;
- }
-
- case UM_FREEPLUGINDATA:
- {
- mir_free(ptszPopupText);
- return TRUE;
- }
-
- default:
- break;
+ switch(uiMessage) {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED) {
+ if (!IsBadStringPtr(ptszPopupText, MaxTextSize))
+ CopyTextToClipboard(ptszPopupText);
+ PUDeletePopUp(hWnd);
+ }
+ break;
+
+ case WM_CONTEXTMENU:
+ PUDeletePopUp(hWnd);
+ break;
+
+ case UM_POPUPACTION:
+ if ((lParam == 0) && (!IsBadStringPtr(ptszPopupText, MaxTextSize)))
+ CopyTextToClipboard(ptszPopupText);
+ break;
+
+ case UM_FREEPLUGINDATA:
+ mir_free(ptszPopupText);
+ return TRUE;
}
+
return DefWindowProc(hWnd, uiMessage, wParam, lParam);
}
diff --git a/plugins/ChangeKeyboardLayout/src/main.cpp b/plugins/ChangeKeyboardLayout/src/main.cpp index e175cb5278..c90bd39f66 100644 --- a/plugins/ChangeKeyboardLayout/src/main.cpp +++ b/plugins/ChangeKeyboardLayout/src/main.cpp @@ -10,7 +10,6 @@ HINSTANCE hInst; HHOOK kbHook_All;
MainOptions moOptions;
PopupOptions poOptions, poOptionsTemp;
-HANDLE hIcoLibIconsChanged;
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
@@ -65,7 +64,6 @@ extern "C" __declspec(dllexport) int Unload(void) mir_free(ptszLayStrings[i]);
UnhookEvent(hOptionsInitialize);
- UnhookEvent(hIcoLibIconsChanged);
UnhookEvent(hModulesLoaded);
DestroyServiceFunction(hChangeLayout);
DestroyServiceFunction(hGetLayoutOfText);
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 2d9c063b41..6d8acbe8e6 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -100,21 +100,22 @@ static HBITMAP hbmLockedPoint = 0, hbmOldLockedPoint = 0; HICON overlayicons[10];
-static struct IconDesc myIcons[] = {
- { "CLN_online", LPGEN("Toggle show online/offline"), -IDI_HIDEOFFLINE },
- { "CLN_groups", LPGEN("Toggle groups"), -IDI_HIDEGROUPS },
- { "CLN_findadd", LPGEN("Find contacts"), -IDI_FINDANDADD },
- { "CLN_options", LPGEN("Open preferences"), -IDI_TBOPTIONS },
- { "CLN_sound", LPGEN("Toggle sounds"), -IDI_SOUNDSON },
- { "CLN_minimize", LPGEN("Minimize contact list"), -IDI_MINIMIZE },
- { "CLN_slist", LPGEN("Show tabSRMM session list"), -IDI_TABSRMMSESSIONLIST },
- { "CLN_menu", LPGEN("Show tabSRMM menu"), -IDI_TABSRMMMENU },
- { "CLN_soundsoff", LPGEN("Sounds are off"), -IDI_SOUNDSOFF },
- { "CLN_CLVM_select", LPGEN("Select view mode"), -IDI_CLVM_SELECT },
- { "CLN_CLVM_reset", LPGEN("Reset view mode"), -IDI_DELETE },
- { "CLN_CLVM_options", LPGEN("Configure view modes"), -IDI_CLVM_OPTIONS },
- { "CLN_topmenu", LPGEN("Show menu"), -IDI_TBTOPMENU },
- { "CLN_accounts", LPGEN("Setup accounts"), -IDI_TBACCOUNTS }
+static IconItem myIcons[] =
+{
+ { LPGEN("Toggle show online/offline"), "CLN_online", IDI_HIDEOFFLINE },
+ { LPGEN("Toggle groups"), "CLN_groups", IDI_HIDEGROUPS },
+ { LPGEN("Find contacts"), "CLN_findadd", IDI_FINDANDADD },
+ { LPGEN("Open preferences"), "CLN_options", IDI_TBOPTIONS },
+ { LPGEN("Toggle sounds"), "CLN_sound", IDI_SOUNDSON },
+ { LPGEN("Minimize contact list"), "CLN_minimize", IDI_MINIMIZE },
+ { LPGEN("Show tabSRMM session list"), "CLN_slist", IDI_TABSRMMSESSIONLIST },
+ { LPGEN("Show tabSRMM menu"), "CLN_menu", IDI_TABSRMMMENU },
+ { LPGEN("Sounds are off"), "CLN_soundsoff", IDI_SOUNDSOFF },
+ { LPGEN("Select view mode"), "CLN_CLVM_select", IDI_CLVM_SELECT },
+ { LPGEN("Reset view mode"), "CLN_CLVM_reset", IDI_DELETE },
+ { LPGEN("Configure view modes"), "CLN_CLVM_options", IDI_CLVM_OPTIONS },
+ { LPGEN("Show menu"), "CLN_topmenu", IDI_TBTOPMENU },
+ { LPGEN("Setup accounts"), "CLN_accounts", IDI_TBACCOUNTS }
};
HWND hTbMenu, hTbGlobalStatus;
@@ -283,17 +284,12 @@ static void CacheClientIcons() mir_snprintf(szBuffer, sizeof(szBuffer), "cln_ovl_%d", ID_STATUS_OFFLINE + (i - IDI_OVL_OFFLINE));
overlayicons[i - IDI_OVL_OFFLINE] = Skin_GetIcon(szBuffer);
}
-
- /* !!!!!!!!!!!!!!!!!!!!!!
- ImageList_AddIcon(himlExtraImages, Skin_GetIcon("core_main_14"));
- ImageList_AddIcon(himlExtraImages, (HICON)LoadSkinnedIcon(SKINICON_EVENT_URL));
- ImageList_AddIcon(himlExtraImages, Skin_GetIcon("core_main_17"));
- ImageList_AddIcon(himlExtraImages, Skin_GetIcon("core_main_17"));
- */
}
static void InitIcoLib()
{
+ Icon_Register(g_hInst, LPGEN("CList - Nicer/Default"), myIcons, SIZEOF(myIcons));
+
TCHAR szFilename[MAX_PATH];
GetModuleFileName(g_hInst, szFilename, MAX_PATH);
@@ -301,16 +297,6 @@ static void InitIcoLib() char szBuffer[128];
SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.pszSection = LPGEN("CList - Nicer/Default");
- sid.ptszDefaultFile = szFilename;
- for (i=0; i < SIZEOF(myIcons); i++) {
- sid.pszName = myIcons[i].szName;
- sid.pszDescription = myIcons[i].szDesc;
- sid.iDefaultIndex = myIcons[i].uId;
- Skin_AddIcon(&sid);
- }
-
sid.flags = SIDF_ALL_TCHAR;
sid.ptszSection = LPGENT("CList - Nicer/Overlay Icons");
for (i = IDI_OVL_OFFLINE; i <= IDI_OVL_OUTTOLUNCH; i++) {
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index 74f0f731c4..3305a4de82 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -114,6 +114,12 @@ static int Openfile(TCHAR *outputFile, int selection); static HANDLE hTTBButt = 0;
+static IconItem iconList[] =
+{
+ { "Show", "Console_Up", IDI_BTN_UP },
+ { "Hide", "Console_Down", IDI_BTN_DN },
+};
+
static int OnTTBLoaded(WPARAM wParam,LPARAM lParam)
{
if ( !IsWindow(hwndConsole))
@@ -121,26 +127,12 @@ static int OnTTBLoaded(WPARAM wParam,LPARAM lParam) int state = IsWindowVisible(hwndConsole);
+ Icon_Register(hInst, "Console", iconList, SIZEOF(iconList));
+
TTBButton ttbb = { 0 };
ttbb.cbSize = sizeof(ttbb);
-
- TCHAR szModuleFileName[MAX_PATH];
- GetModuleFileName(hInst, szModuleFileName, SIZEOF(szModuleFileName));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = "Console";
- sid.ptszDefaultFile = szModuleFileName;
- sid.flags = SIDF_PATH_TCHAR;
- sid.pszDescription = "Show";
- sid.pszName = "Console_Up";
- sid.iDefaultIndex = -IDI_BTN_UP;
- ttbb.hIconHandleUp = Skin_AddIcon(&sid);
-
- sid.pszDescription = "Hide";
- sid.pszName = "Console_Down";
- sid.iDefaultIndex = -IDI_BTN_DN;
- ttbb.hIconHandleDn = Skin_AddIcon(&sid);
-
+ ttbb.hIconHandleUp = iconList[0].hIcolib;
+ ttbb.hIconHandleDn = iconList[1].hIcolib;
ttbb.dwFlags = (state ? TTBBF_PUSHED : 0) | TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttbb.pszService = MS_CONSOLE_SHOW_HIDE;
ttbb.name = LPGEN("Show/Hide Console");
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 047f93a7ef..b94ad9f0ca 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -72,10 +72,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirVers // MirandaInterfaces - returns the protocol interface to the core
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SERVICEMODE, MIID_CRASHDUMP, MIID_LAST };
-HANDLE hHooks[5];
-HANDLE hServices[6];
-
-
INT_PTR StoreVersionInfoToFile(WPARAM, LPARAM lParam)
{
CreateDirectoryTree(VersionInfoFolder);
@@ -218,24 +214,24 @@ static int ToolbarModulesLoaded(WPARAM, LPARAM) tbb.pszService = MS_CRASHDUMPER_STORETOCLIP;
tbb.name = tbb.pszTooltipUp = LPGEN("Version Information To Clipboard");
- tbb.hIconHandleUp = GetIconHandle("storeToClip");
+ tbb.hIconHandleUp = GetIconHandle(IDI_VITOCLIP);
tbb.dwFlags = TTBBF_VISIBLE;
TopToolbar_AddButton(&tbb);
tbb.pszService = MS_CRASHDUMPER_STORETOFILE;
tbb.name = tbb.pszTooltipUp = LPGEN("Version Information To File");
- tbb.hIconHandleUp = GetIconHandle("storeToFile");
+ tbb.hIconHandleUp = GetIconHandle(IDI_VITOFILE);
tbb.dwFlags = 0;
TopToolbar_AddButton(&tbb);
tbb.pszService = MS_CRASHDUMPER_VIEWINFO;
tbb.name = tbb.pszTooltipUp = LPGEN("Show Version Information");
- tbb.hIconHandleUp = GetIconHandle("showInfo");
+ tbb.hIconHandleUp = GetIconHandle(IDI_VISHOW);
TopToolbar_AddButton(&tbb);
tbb.pszService = MS_CRASHDUMPER_UPLOAD;
tbb.name = tbb.pszTooltipUp = LPGEN("Upload Version Information");
- tbb.hIconHandleUp = GetIconHandle("uploadInfo");
+ tbb.hIconHandleUp = GetIconHandle(IDI_VIUPLOAD);
TopToolbar_AddButton(&tbb);
return 0;
}
@@ -262,10 +258,8 @@ static int ModulesLoaded(WPARAM, LPARAM) FoldersPathChanged(0, 0);
-
-
- hHooks[2] = HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersPathChanged);
- if (hHooks[3] == NULL) hHooks[3] = HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded);
+ HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersPathChanged);
+ HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded);
UploadInit();
@@ -273,7 +267,7 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.popupPosition = 2000089999;
mi.position = 2000089999;
mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- mi.icolibItem = GetIconHandle("versionInfo");
+ mi.icolibItem = GetIconHandle(IDI_VI);
mi.ptszName = LPGENT("Version Information");
mi.pszPopupName = (char *)-1;
HANDLE hMenuRoot = Menu_AddMainMenuItem(&mi);
@@ -284,33 +278,33 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.position = 2000089995;
mi.ptszName = LPGENT("Copy to clipboard");
- mi.icolibItem = GetIconHandle("storeToClip");
+ mi.icolibItem = GetIconHandle(IDI_VITOCLIP);
mi.pszService = MS_CRASHDUMPER_STORETOCLIP;
Menu_AddMainMenuItem(&mi);
mi.position = 2000089996;
mi.ptszName = LPGENT("Store to file");
- mi.icolibItem = GetIconHandle("storeToFile");
+ mi.icolibItem = GetIconHandle(IDI_VITOFILE);
mi.pszService = MS_CRASHDUMPER_STORETOFILE;
Menu_AddMainMenuItem(&mi);
mi.position = 2000089997;
mi.ptszName = LPGENT("Show");
- mi.icolibItem = GetIconHandle("showInfo");
+ mi.icolibItem = GetIconHandle(IDI_VISHOW);
mi.pszService = MS_CRASHDUMPER_VIEWINFO;
Menu_AddMainMenuItem(&mi);
mi.popupPosition = 1;
mi.position = 2000089998;
mi.ptszName = LPGENT("Show with DLLs");
- mi.icolibItem = GetIconHandle("showInfo");
+ mi.icolibItem = GetIconHandle(IDI_VIUPLOAD);
mi.pszService = MS_CRASHDUMPER_VIEWINFO;
Menu_AddMainMenuItem(&mi);
mi.popupPosition = 0;
mi.position = 2000089999;
mi.ptszName = LPGENT("Upload");
- mi.icolibItem = GetIconHandle("uploadInfo");
+ mi.icolibItem = GetIconHandle(IDI_VIUPLOAD);
mi.pszService = MS_CRASHDUMPER_UPLOAD;
Menu_AddMainMenuItem(&mi);
@@ -341,12 +335,10 @@ static int ModulesLoaded(WPARAM, LPARAM) hk.pszService = MS_CRASHDUMPER_VIEWINFO;
Hotkey_Register(&hk);
- if (servicemode) ViewVersionInfo(0, 0);
- else
- {
- if (DBGetContactSettingByte(NULL, PluginName, "UploadChanged", 0) && !ProcessVIHash(false))
- UploadVersionInfo(0, 0xa1);
- }
+ if (servicemode)
+ ViewVersionInfo(0, 0);
+ else if (DBGetContactSettingByte(NULL, PluginName, "UploadChanged", 0) && !ProcessVIHash(false))
+ UploadVersionInfo(0, 0xa1);
CheckForOtherCrashReportingPlugins();
return 0;
@@ -354,33 +346,22 @@ static int ModulesLoaded(WPARAM, LPARAM) static int PreShutdown(WPARAM, LPARAM)
{
- unsigned i;
-
DestroyAllWindows();
UploadClose();
-
- for (i=0; i<SIZEOF(hHooks); ++i)
- UnhookEvent(hHooks[i]);
-
- for (i=0; i<SIZEOF(hServices); ++i)
- DestroyServiceFunction(hServices[i]);
-
return 0;
}
extern "C" int __declspec(dllexport) Load(void)
{
-
-
clsdates = DBGetContactSettingByte(NULL, PluginName, "ClassicDates", 1) != 0;
dtsubfldr = DBGetContactSettingByte(NULL, PluginName, "SubFolders", 1) != 0;
mir_getLP(&pluginInfoEx);
- hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- hHooks[1] = HookEvent(ME_OPT_INITIALISE, OptionsInit);
- hHooks[3] = HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded);
- hHooks[4] = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
+ HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
packlcid = (LCID)CallService(MS_LANGPACK_GETLOCALE, 0, 0);
@@ -388,16 +369,12 @@ extern "C" int __declspec(dllexport) Load(void) InitExceptionHandler();
- hServices[0] = CreateServiceFunction(MS_CRASHDUMPER_STORETOFILE, StoreVersionInfoToFile);
- hServices[1] = CreateServiceFunction(MS_CRASHDUMPER_STORETOCLIP, StoreVersionInfoToClipboard);
- hServices[2] = CreateServiceFunction(MS_CRASHDUMPER_VIEWINFO, ViewVersionInfo);
- hServices[3] = CreateServiceFunction(MS_CRASHDUMPER_UPLOAD, UploadVersionInfo);
- hServices[4] = CreateServiceFunction(MS_CRASHDUMPER_URL, OpenUrl);
- hServices[5] = CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceModeLaunch);
-
- // unsigned *p = (unsigned*)0x15;
- // *p = 324;
-
+ CreateServiceFunction(MS_CRASHDUMPER_STORETOFILE, StoreVersionInfoToFile);
+ CreateServiceFunction(MS_CRASHDUMPER_STORETOCLIP, StoreVersionInfoToClipboard);
+ CreateServiceFunction(MS_CRASHDUMPER_VIEWINFO, ViewVersionInfo);
+ CreateServiceFunction(MS_CRASHDUMPER_UPLOAD, UploadVersionInfo);
+ CreateServiceFunction(MS_CRASHDUMPER_URL, OpenUrl);
+ CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceModeLaunch);
return 0;
}
diff --git a/plugins/CrashDumper/src/crshdmp_icons.cpp b/plugins/CrashDumper/src/crshdmp_icons.cpp index 670adae90c..d469c5349d 100644 --- a/plugins/CrashDumper/src/crshdmp_icons.cpp +++ b/plugins/CrashDumper/src/crshdmp_icons.cpp @@ -17,15 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "utils.h"
-#include <m_icolib.h>
-struct _tag_iconList
-{
- const char* szDescr;
- const char* szName;
- int defIconID;
-}
-static const iconList[] =
+static IconItem iconList[] =
{
{ "Version Information", "versionInfo", IDI_VI },
{ "Copy To Clipboard", "storeToClip", IDI_VITOCLIP },
@@ -34,52 +27,25 @@ static const iconList[] = { "Upload", "uploadInfo", IDI_VIUPLOAD },
};
-static HANDLE hIconLibItem[SIZEOF(iconList)];
-
void InitIcons(void)
{
- char szSettingName[100];
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszName = szSettingName;
- sid.pszSection = (char*)PluginName;
-
- for (unsigned i = 0; i < SIZEOF(iconList); i++) {
- mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s", PluginName, iconList[i].szName);
-
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInst, PluginName, iconList, SIZEOF(iconList), PluginName);
}
-HICON LoadIconEx(const char* name, bool big)
+HICON LoadIconEx(int iconId, bool big)
{
- char szSettingName[100];
- mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s", PluginName, name);
- return Skin_GetIcon(szSettingName, big);
-}
+ for (int i=0; i < SIZEOF(iconList); i++)
+ if (iconList[i].defIconID == iconId)
+ return Skin_GetIconByHandle(iconList[i].hIcolib);
-HANDLE GetIconHandle(const char* name)
-{
- unsigned i;
- for (i=0; i < SIZEOF(iconList); i++)
- if (strcmp(iconList[i].szName, name) == 0)
- return hIconLibItem[i];
return NULL;
}
-void ReleaseIconEx(const char* name)
+HANDLE GetIconHandle(int iconId)
{
- char szSettingName[100];
- mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s", PluginName, name);
- Skin_ReleaseIcon(szSettingName);
-}
+ for (int i=0; i < SIZEOF(iconList); i++)
+ if (iconList[i].defIconID == iconId)
+ return iconList[i].hIcolib;
-void ReleaseIconEx(HICON hIcon)
-{
- Skin_ReleaseIcon(hIcon);
+ return NULL;
}
diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index f39a329069..2055554374 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -70,8 +70,8 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara {
hViewWnd = hwndDlg;
TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx("versionInfo", true));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx("versionInfo"));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadIconEx(IDI_VI, true));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIconEx(IDI_VI));
CHARFORMAT2 chf;
chf.cbSize = sizeof(chf);
@@ -192,8 +192,8 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case WM_DESTROY:
hViewWnd = NULL;
- ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
- ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
+ Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
+ Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
Utils_SaveWindowPosition(hwndDlg, NULL, PluginName, "ViewInfo_");
if (servicemode) PostQuitMessage(0);
break;
@@ -273,15 +273,13 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
+ switch (msg) {
case WM_CONTEXTMENU:
PUDeletePopUp(hWnd);
break;
case WM_COMMAND:
- switch ((int)PUGetPluginData(hWnd))
- {
+ switch ((int)PUGetPluginData(hWnd)) {
case 0:
OpenAuthUrl("http://www.miranda-vi.org/");
break;
@@ -301,7 +299,8 @@ LRESULT CALLBACK DlgProcPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) break;
case UM_FREEPLUGINDATA:
- ReleaseIconEx("versionInfo");
+ Skin_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0));
+ Skin_ReleaseIcon((HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0));
break;
}
@@ -321,7 +320,7 @@ void ShowMessage(int type, const TCHAR* format, ...) if (ServiceExists(MS_POPUP_ADDPOPUPT))
{
_tcscpy(pi.lptzContactName, TEXT(PluginName));
- pi.lchIcon = LoadIconEx("versionInfo");
+ pi.lchIcon = LoadIconEx(IDI_VI);
pi.PluginWindowProc = DlgProcPopup;
pi.PluginData = (void*)type;
diff --git a/plugins/CrashDumper/src/utils.h b/plugins/CrashDumper/src/utils.h index 9089f57571..e1f4c1919c 100644 --- a/plugins/CrashDumper/src/utils.h +++ b/plugins/CrashDumper/src/utils.h @@ -56,6 +56,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <m_hotkeys.h>
#include <m_protocols.h>
#include <m_help.h>
+#include <m_icolib.h>
#include "bkstring.h"
@@ -171,7 +172,6 @@ void OpenAuthUrl(const char* url); void __cdecl VersionInfoUploadThread(void* arg);
void InitIcons(void);
-HICON LoadIconEx(const char* name, bool big = false);
-HANDLE GetIconHandle(const char* name);
-void ReleaseIconEx(const char* name);
-void ReleaseIconEx(HICON hIcon);
+HICON LoadIconEx(int iconId, bool big = false);
+void ReleaseIconEx(int iconId);
+HANDLE GetIconHandle(int iconId);
diff --git a/plugins/DbEditorPP/src/icons.cpp b/plugins/DbEditorPP/src/icons.cpp index 145d14f036..88de410477 100644 --- a/plugins/DbEditorPP/src/icons.cpp +++ b/plugins/DbEditorPP/src/icons.cpp @@ -2,79 +2,31 @@ HIMAGELIST himl;
+static IconItem iconList[] =
+{
+ { LPGENT("Closed Known Module"), "DBE++_1", ICO_KNOWN },
+ { LPGENT("Open Known Module"), "DBE++_2", ICO_KNOWNOPEN },
+ { LPGENT("Closed Unknown Module"), "DBE++_3", ICO_UNKNOWN },
+ { LPGENT("Open Unknown Module"), "DBE++_4", ICO_UNKNOWNOPEN },
+ { LPGENT("Settings"), "DBE++_5", ICO_SETTINGS },
+ { LPGENT("Contacts Group"), "DBE++_6", ICO_CONTACTS },
+ { LPGENT("Unknown Contact"), "DBE++_7", ICO_OFFLINE },
+ { LPGENT("Known Contact"), "DBE++_8", ICO_ONLINE },
+};
+
void addIcons(TCHAR* szModuleFileName)
{
- char name[32];
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszSection = _T(modFullname);
- sid.ptszDefaultFile = szModuleFileName;
- sid.flags = SIDF_ALL_TCHAR;
-
- // closed known module
- sid.ptszDescription = LPGENT("Closed Known Module");
- mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_KNOWN);
- sid.pszName = name;
- sid.iDefaultIndex = -ICO_KNOWN;
- Skin_AddIcon(&sid);
-
- // open known module
- sid.ptszDescription = LPGENT("Open Known Module");
- mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_KNOWNOPEN);
- sid.pszName = name;
- sid.iDefaultIndex = -ICO_KNOWNOPEN;
- Skin_AddIcon(&sid);
-
- // closed unknown module
- sid.ptszDescription = LPGENT("Closed Unknown Module");
- mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_UNKNOWN);
- sid.pszName = name;
- sid.iDefaultIndex = -ICO_UNKNOWN;
- Skin_AddIcon(&sid);
-
- // open unknown module
- sid.ptszDescription = LPGENT("Open Unknown Module");
- mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_UNKNOWNOPEN);
- sid.pszName = name;
- sid.iDefaultIndex = -ICO_UNKNOWNOPEN;
- Skin_AddIcon(&sid);
-
- // settings contact
- sid.ptszDescription = LPGENT("Settings");
- mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_SETTINGS);
- sid.pszName = name;
- sid.iDefaultIndex = -ICO_SETTINGS;
- Skin_AddIcon(&sid);
-
- // contact group
- sid.ptszDescription = LPGENT("Contacts Group");
- mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_CONTACTS);
- sid.pszName = name;
- sid.iDefaultIndex = -ICO_CONTACTS;
- Skin_AddIcon(&sid);
-
- // unknwon contact
- sid.ptszDescription = LPGENT("Unknown Contact");
- mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_OFFLINE);
- sid.pszName = name;
- sid.iDefaultIndex = -ICO_OFFLINE;
- Skin_AddIcon(&sid);
-
- // known contact
- sid.ptszDescription = LPGENT("Known Contact");
- mir_snprintf(name, SIZEOF(name), "DBE++_%d", ICO_ONLINE);
- sid.pszName = name;
- sid.iDefaultIndex = -ICO_ONLINE;
- Skin_AddIcon(&sid);
+ Icon_Register(hInst, modFullname, iconList, SIZEOF(iconList));
}
HICON LoadSkinnedDBEIcon(int icon)
{
- char name[32];
- mir_snprintf(name, SIZEOF(name), "DBE++_%d", icon);
- HICON hIcon = Skin_GetIcon(name);
- return (hIcon) ? hIcon : LoadIcon(hInst, MAKEINTRESOURCE(icon));
-}
+ for (int i=0; i < SIZEOF(iconList); i++)
+ if (iconList[i].defIconID == icon)
+ return Skin_GetIconByHandle(iconList[i].hIcolib);
+ return LoadIcon(hInst, MAKEINTRESOURCE(icon));
+}
int AddIconToList(HIMAGELIST hil, HICON hIcon)
{
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index d971559218..055fc80df2 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -28,15 +28,9 @@ PLUGININFOEX pluginInfo={ { 0x81c220a6, 0x226, 0x4ad6, { 0xbf, 0xca, 0x21, 0x7b, 0x17, 0xa1, 0x60, 0x53 } }
};
-struct
-{
- TCHAR* szDescr;
- char* szName;
- int defIconID;
-}
-static const iconList[] = {
- { _T("Backup Profile"), "backup", IDI_ICON1 },
- { _T("Save Profile As..."), "saveas", IDI_ICON1 }
+static IconItem iconList[] = {
+ { LPGEN("Backup Profile"), "backup", IDI_ICON1 },
+ { LPGEN("Save Profile As..."), "saveas", IDI_ICON1 }
};
INT_PTR BackupServiceTrgr(WPARAM wParam, LPARAM lParam)
@@ -61,24 +55,6 @@ static int FoldersInit(void) return 0;
}
-static void IcoLibInit(void)
-{
- TCHAR tszFile[MAX_PATH];
- GetModuleFileName(hInst, tszFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = tszFile;
- sid.ptszSection = _T("Database/Database Backups");
- sid.flags = SIDF_ALL_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- sid.pszName = iconList[i].szName;
- sid.ptszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- Skin_AddIcon(&sid);
- }
-}
-
static void MenuInit(void)
{
CLISTMENUITEM mi = { sizeof(mi) };
@@ -112,7 +88,8 @@ static int ModulesLoad(WPARAM wParam, LPARAM lParam) {
profilePath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
- IcoLibInit();
+ Icon_Register(hInst, LPGEN("Database/Database Backups"), iconList, SIZEOF(iconList));
+
if(ServiceExists(MS_FOLDERS_REGISTER_PATH))
FoldersInit();
LoadOptions();
diff --git a/plugins/Dbx_mmap_SA/src/dialogs.cpp b/plugins/Dbx_mmap_SA/src/dialogs.cpp index a73745051f..11c1afc70f 100644 --- a/plugins/Dbx_mmap_SA/src/dialogs.cpp +++ b/plugins/Dbx_mmap_SA/src/dialogs.cpp @@ -80,31 +80,22 @@ void xModifyMenu(HANDLE hMenu,long flags,const TCHAR* name, HICON hIcon) CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hMenu,(LPARAM)&mi);
}
+static IconItem iconList[] =
+{
+ { LPGEN("Database"), "database", IDI_ICON2 },
+ { LPGEN("Change Password"), "password", IDI_ICON3 }
+};
+
int InitMenus(WPARAM, LPARAM)
{
HookEvent(ME_OPT_INITIALISE, OptionsInit);
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszSection = LPGENT("Database");
- sid.ptszDescription = LPGENT("Database");
- sid.pszName = "database";
- sid.iDefaultIndex = -IDI_ICON2;
- Skin_AddIcon(&sid);
-
- sid.ptszDescription = LPGENT("Change Password");
- sid.pszName = "password";
- sid.iDefaultIndex = -IDI_ICON3;
- HANDLE hIcon = Skin_AddIcon(&sid);
+ Icon_Register(g_hInst, LPGEN("Database"), iconList, SIZEOF(iconList));
// main menu item
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_ALL | CMIF_TCHAR | CMIF_ICONFROMICOLIB;
- mi.icolibItem = hIcon;
+ mi.icolibItem = iconList[1].hIcolib;
mi.ptszName = (g_Db->m_bEncoding) ? LPGENT("Change password") : LPGENT("Set password");
mi.ptszPopupName = LPGENT("Database");
mi.pszService = MS_DB_CHANGEPASSWORD;
diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index ce2a211cb3..d6f5dfe11b 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -70,53 +70,26 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_FTPFILE //------------ INIT FUNCTIONS ------------//
-struct _tag_iconList
+static IconItem iconList[] =
{
- char *szDescr;
- char *szName;
- int defIconID;
-}
-static const iconList[6] =
-{
- { "Send file", "main", IDI_MENU },
- { "Clipboard", "clipboard", IDI_CLIPBOARD },
- { "Pause", "pause", IDI_PAUSE },
- { "Resume", "resume", IDI_RESUME },
- { "Delete from list", "clear", IDI_CLEAR },
- { "Delete from FTP", "delete", IDI_DELETE }
+ { "FTP Server 1", "ftp1", IDI_FTP0 },
+ { "FTP Server 2", "ftp2", IDI_FTP1 },
+ { "FTP Server 3", "ftp3", IDI_FTP2 },
+ { "FTP Server 4", "ftp4", IDI_FTP3 },
+ { "FTP Server 5", "ftp5", IDI_FTP4 },
+ { "Send file", "main", IDI_MENU },
+ { "Clipboard", "clipboard", IDI_CLIPBOARD },
+ { "Pause", "pause", IDI_PAUSE },
+ { "Resume", "resume", IDI_RESUME },
+ { "Delete from list", "clear", IDI_CLEAR },
+ { "Delete from FTP", "delete", IDI_DELETE }
};
static HANDLE hIconlibItem[ServerList::FTP_COUNT + SIZEOF(iconList)];
static void InitIcolib()
{
- char szSettingName[100];
- char szDesc[100];
-
- TCHAR stzFile[MAX_PATH];
- GetModuleFileName(hInst, stzFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.cx = sid.cy = 16;
- sid.ptszDefaultFile = stzFile;
- sid.pszSection = MODULE;
- sid.pszDescription = szDesc;
- sid.pszName = szSettingName;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i = 0; i < ServerList::FTP_COUNT; i++) {
- mir_snprintf(szDesc, sizeof(szDesc), Translate("FTP Server %d"), i + 1);
- mir_snprintf(szSettingName, sizeof(szSettingName), "%s_ftp%d", MODULE, i);
- sid.iDefaultIndex = -(IDI_FTP0 + i);
- hIconlibItem[i] = Skin_AddIcon(&sid);
- }
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s", MODULE, iconList[i].szName);
- sid.pszDescription = Translate(iconList[i].szDescr);
- sid.iDefaultIndex = -(iconList[i].defIconID);
- hIconlibItem[i + ServerList::FTP_COUNT] = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInst, MODULE, iconList, SIZEOF(iconList), MODULE);
}
void InitMenuItems()
diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index b80c961d96..f6675982f8 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -284,6 +284,12 @@ int ProcessOptInitialise(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////
+static IconItem iconList[] =
+{
+ { LPGEN("Favourite Contact"), "favcontacts_favourite", IDI_FAVOURITE },
+ { LPGEN("Regular Contact"), "favcontacts_regular", IDI_REGULAR },
+};
+
extern "C" __declspec(dllexport) int Load(void)
{
if (!CoreCheck()) return 1;
@@ -320,24 +326,7 @@ extern "C" __declspec(dllexport) int Load(void) /////////////////////////////////////////////////////////////////////////////////////
- TCHAR buf[MAX_PATH];
- GetModuleFileName(g_hInst, buf, SIZEOF(buf));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszSection = _T("Favourites");
- sid.ptszDefaultFile = buf;
- sid.cx = sid.cy = 16;
- sid.flags = SIDF_ALL_TCHAR;
-
- sid.pszName = "favcontacts_favourite";
- sid.ptszDescription = _T("Favourite Contact");
- sid.iDefaultIndex = -IDI_FAVOURITE;
- g_icoFavourite = Skin_AddIcon(&sid);
-
- sid.pszName = "favcontacts_regular";
- sid.ptszDescription = _T("Regular Contact");
- sid.iDefaultIndex = -IDI_REGULAR;
- g_icoRegular = Skin_AddIcon(&sid);
+ Icon_Register(g_hInst, LPGEN("Favourites"), iconList, SIZEOF(iconList));
LoadHttpApi();
diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index 9a8cf990b4..4deee87182 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -25,35 +25,17 @@ HANDLE hHookDbSettingChange, hHookContactAdded, hHookSkinIconsChanged; extern INT_PTR CALLBACK OptionsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
-int idIcons[5] = {IDI_PLAY, IDI_PAUSE, IDI_REFRESH, IDI_STOP, IDI_SMALLICON};
HICON hIcons[5];
-char *szIconId[5] =
+static IconItem iconList[] =
{
- "FePlay",
- "FePause",
- "FeRefresh",
- "FeStop",
- "FeMain"
+ { "Play", "FePlay", IDI_PLAY },
+ { "Pause", "FePause", IDI_PAUSE },
+ { "Revive", "FeRefresh", IDI_REFRESH },
+ { "Stop", "FeStop", IDI_STOP },
+ { "Main", "FeMain", IDI_SMALLICON },
};
-char *szIconName[5] =
-{
- "Play",
- "Pause",
- "Revive",
- "Stop",
- "Main"
-};
-/*
-char *szIconGroup[5] =
-{
- "gr1",
- "gr3",
- "gr2",
- "gr3",
- "gr1"
-};
-*/
+
int iIconId[5] = {3,2,4,1,0};
//
@@ -63,7 +45,7 @@ int iIconId[5] = {3,2,4,1,0}; int OnSkinIconsChanged(WPARAM wParam,LPARAM lParam)
{
for(int indx = 0; indx < SIZEOF(hIcons); indx++)
- hIcons[indx] = Skin_GetIcon(szIconId[indx]);
+ hIcons[indx] = Skin_GetIconByHandle( iconList[indx].hIcolib );
WindowList_Broadcast(hFileList, WM_FE_SKINCHANGE, 0,0);
@@ -190,36 +172,15 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD dwVersi {
return &pluginInfo;
}
-/*
-DWORD CreateSetting(char *name, DWORD defvalue)
-{
- if(DBGetContactSettingDword(NULL, SERVICE_NAME, name, -1) == -1)
- DBWriteContactSettingDword(NULL, SERVICE_NAME, name, defvalue);
- else
- defvalue = DBGetContactSettingDword(NULL, SERVICE_NAME, name, defvalue);
- return defvalue;
-}
-*/
-int OnModulesLoaded(WPARAM wparam,LPARAM lparam)
-{
- int indx;
- char ModuleName[MAX_PATH];
- GetModuleFileName(hInst, ModuleName, sizeof(ModuleName));
+//
+// Startup initializing
+//
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = "fileAsMessage";
+static int OnModulesLoaded(WPARAM wparam,LPARAM lparam)
+{
for(int indx = 0; indx < SIZEOF(hIcons); indx++)
- {
- //sid.pszSection = szIconGroup[indx];
- sid.pszName = szIconId[indx];
- sid.pszDescription = szIconName[indx];
- sid.pszDefaultFile = ModuleName;
- sid.iDefaultIndex = iIconId[indx];
- Skin_AddIcon(&sid);
- }
- for(indx = 0; indx < SIZEOF(hIcons); indx++)
- hIcons[indx] = Skin_GetIcon(szIconId[indx]);
+ hIcons[indx] = Skin_GetIconByHandle( iconList[indx].hIcolib );
hHookSkinIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnSkinIconsChanged);
@@ -234,21 +195,16 @@ int OnModulesLoaded(WPARAM wparam,LPARAM lparam) return 0;
}
-//
-// Startup initializing
-//
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfo);
InitCRC32();
-// for(int indx = 0; indx < ARRAY_SIZE(hIcons); indx++)
-// hIcons[indx] = (HICON)LoadImage(hInst,MAKEINTRESOURCE(idIcons[indx]),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0);
+ Icon_Register(hInst, "fileAsMessage", iconList, SIZEOF(iconList));
hFileList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
- //CreateServiceFunction( SERVICE_NAME PS_GETCAPS, FEGetCaps );
CreateServiceFunction(SERVICE_NAME PSR_MESSAGE, OnRecvMessage);
CreateServiceFunction(SERVICE_NAME "/FESendFile", OnSendFile);
CreateServiceFunction(SERVICE_NAME "/FERecvFile", OnRecvFile);
diff --git a/plugins/Gender/src/commonheaders.h b/plugins/Gender/src/commonheaders.h index 1971484888..2d588792e5 100644 --- a/plugins/Gender/src/commonheaders.h +++ b/plugins/Gender/src/commonheaders.h @@ -48,6 +48,7 @@ #include <m_genmenu.h>
#include <m_icolib.h>
#include <m_cluiframes.h>
+#include <win2k.h>
//Gender SDK
#include "m_gender.h"
diff --git a/plugins/Gender/src/main.cpp b/plugins/Gender/src/main.cpp index 391a0d4722..fa662d172c 100644 --- a/plugins/Gender/src/main.cpp +++ b/plugins/Gender/src/main.cpp @@ -31,7 +31,6 @@ static HANDLE hContactMenu = NULL, hContactMenuMale = NULL, hContactMenuFemale = static HANDLE hSetMale = NULL, hSetFemale = NULL, hSetUndef = NULL, hGenderGetIcon = NULL;
HANDLE g_hExtraIcon = NULL;
-HANDLE g_hIconMale, g_hIconFemale, g_hIconMenu;
byte bEnableClistIcon = 1; // do we need clist icon?
byte bDrawNoGenderIcon = 0; // enable icon when no info?
@@ -54,6 +53,13 @@ sizeof(PLUGININFOEX), {0xfb1c17e0, 0x77fc, 0x45a7, {0x9c, 0x8b, 0xe2, 0xbe, 0xf4, 0xf5, 0x6b, 0x28}} /* FB1C17E0-77FC-45A7-9C8B-E2BEF4F56B28 */
};
+static IconItem iconList[] =
+{
+ { LPGEN("Male"), "male_icon", IDI_MALE },
+ { LPGEN("Female"), "female_icon", IDI_FEMALE },
+ { LPGEN("No info"), "menu_icon", IDI_UNDEF }
+};
+
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
g_hInst = hinstDLL;
@@ -112,9 +118,9 @@ INT_PTR GetIcon(WPARAM wParam, LPARAM lParam) if (gender > 0) {
if (gender == 77)
- return (INT_PTR)Skin_GetIconByHandle(g_hIconMale);
+ return (INT_PTR)Skin_GetIconByHandle(iconList[0].hIcolib);
if (gender == 70)
- return (INT_PTR)Skin_GetIconByHandle(g_hIconFemale);
+ return (INT_PTR)Skin_GetIconByHandle(iconList[1].hIcolib);
}
return 0;
@@ -209,29 +215,8 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu);
bMetaAvail = (ServiceExists(MS_MC_GETMETACONTACT) != 0);
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInst, szFile, MAX_PATH);
-
//IcoLib support
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.pszSection = LPGEN("Gender");
- sid.ptszDefaultFile = szFile;
-
- sid.pszDescription = LPGEN("Male");
- sid.pszName = "male_icon";
- sid.iDefaultIndex = -IDI_MALE;
- g_hIconMale = Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Female");
- sid.pszName = "female_icon";
- sid.iDefaultIndex = -IDI_FEMALE;
- g_hIconFemale = Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("No info");
- sid.pszName = "menu_icon";
- sid.iDefaultIndex = -IDI_UNDEF;
- g_hIconMenu = Skin_AddIcon(&sid);
+ Icon_Register(g_hInst, "Gender", iconList, SIZEOF(iconList));
// Adding clist extra icon
g_hExtraIcon = ExtraIcon_Register("gender", "Gender", "menu_icon");
@@ -249,7 +234,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) {
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- mi.icolibItem = g_hIconMenu;
+ mi.icolibItem = iconList[2].hIcolib;
mi.pszPopupName = (char*)-1;
mi.position = 203;
mi.ptszName = LPGENT("Set Gender");
@@ -261,12 +246,12 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) mi.pszPopupName = (char*)hContactMenu;
mi.ptszName = LPGENT("Male");
- mi.icolibItem = g_hIconMale;
+ mi.icolibItem = iconList[0].hIcolib;
mi.pszService = "Gender/MenuItemSetMale";
hContactMenuMale = Menu_AddContactMenuItem(&mi);
mi.ptszName = LPGENT("Female");
- mi.icolibItem = g_hIconFemale;
+ mi.icolibItem = iconList[1].hIcolib;
mi.pszService = "Gender/MenuItemSetFemale";
hContactMenuFemale = Menu_AddContactMenuItem(&mi);
@@ -281,14 +266,14 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.position = 1001;
mi.ptszName = LPGENT("Set Male");
- mi.icolibItem = g_hIconMale;
+ mi.icolibItem = iconList[0].hIcolib;
mi.pszService = "Gender/MenuItemSetMale";
hContactMenuMale = Menu_AddContactMenuItem(&mi);
mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
mi.position = 1002;
mi.ptszName = LPGENT("Set Female");
- mi.icolibItem = g_hIconFemale;
+ mi.icolibItem = iconList[1].hIcolib;
mi.pszService = "Gender/MenuItemSetFemale";
hContactMenuFemale = Menu_AddContactMenuItem(&mi);
diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index f086285349..8cae37d6e5 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -44,42 +44,19 @@ const char* keep_strings[] = "Keep 50 last events"
};
-struct
+static IconItem iconList[] =
{
- char* szDescr;
- char* szName;
- int defIconID;
-}
-static const iconList[] =
-{
- { "Default Action", "actG", IDI_ACTG },
- { "Action 1", "act1", IDI_ACT1 },
- { "Action 2", "act2", IDI_ACT2 },
- { "Delete All", "actDel", IDI_ACTDEL }
+ { "Default Action", "actG", IDI_ACTG },
+ { "Action 1", "act1", IDI_ACT1 },
+ { "Action 2", "act2", IDI_ACT2 },
+ { "Delete All", "actDel", IDI_ACTDEL }
};
static HANDLE hIconLibItem[SIZEOF(iconList)];
void InitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.pszSection = ModuleName;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i=0; i < SIZEOF(iconList); i++) {
- char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", ModuleName, iconList[i].szName);
- sid.pszName = szSettingName;
-
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInst, ModuleName, iconList, SIZEOF(iconList), ModuleName);
}
HICON LoadIconEx(const char* name)
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp index 5826b55bcc..e81da8b9dc 100644 --- a/plugins/IgnoreState/src/main.cpp +++ b/plugins/IgnoreState/src/main.cpp @@ -110,38 +110,13 @@ void applyExtraImage(HANDLE hContact) /////////////////////////////////////////////////////////////////////////////////////////
-static struct
+static IconItem iconList[] =
{
- TCHAR* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
-}
-iconList[] =
-{
- { LPGENT( "Full Ignore" ), "ignore_full", IDI_IFULL },
- { LPGENT( "Partial Ignore" ), "ignore_part", IDI_IPART },
- { LPGENT( "Message Ignore" ), "ignore_mess", IDI_IMESS },
+ { LPGEN("Full Ignore"), "ignore_full", IDI_IFULL },
+ { LPGEN("Partial Ignore"), "ignore_part", IDI_IPART },
+ { LPGEN("Message Ignore"), "ignore_mess", IDI_IMESS },
};
-static VOID init_icolib (void)
-{
- TCHAR tszFile[MAX_PATH];
- GetModuleFileName(g_hInst, tszFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszSection = _T(MODULENAME);
- sid.ptszDefaultFile = tszFile;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- sid.pszName = iconList[i].szName;
- sid.ptszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIconLibItem = Skin_AddIcon(&sid);
- }
-}
-
VOID fill_filter(void)
{
bUseMirandaSettings = DBGetContactSettingByte(NULL, MODULENAME, "UseMirandaSettings", 0);
@@ -161,7 +136,8 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) HookEvent(ME_OPT_INITIALISE, onOptInitialise);
//IcoLib support
- init_icolib();
+ Icon_Register(g_hInst, MODULENAME, iconList, SIZEOF(iconList));
+
fill_filter();
hExtraIcon = ExtraIcon_Register("ignore", "IgnoreState", "ignore_full");
diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp index f06d0aa2b5..3b8b6cc0b6 100644 --- a/plugins/Import/src/main.cpp +++ b/plugins/Import/src/main.cpp @@ -107,6 +107,10 @@ static int OnExit(WPARAM wParam, LPARAM lParam) return 0;
}
+static IconItem iconList[] = {
+ { LPGEN("Import..."), "import_main", -IDI_IMPORT }
+};
+
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP( &pluginInfo );
@@ -114,21 +118,11 @@ extern "C" __declspec(dllexport) int Load(void) hImportService = CreateServiceFunction(IMPORT_SERVICE, ImportCommand);
// icon
- TCHAR tszFile[MAX_PATH];
- GetModuleFileName(hInst, tszFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = tszFile;
- sid.pszSection = "Import";
- sid.pszName = "import_main";
- sid.pszDescription = LPGEN("Import...");
- sid.iDefaultIndex = -IDI_IMPORT;
- hIcoHandle = Skin_AddIcon(&sid);
+ Icon_Register(hInst, "Import", iconList, SIZEOF(iconList));
// menu item
CLISTMENUITEM mi = { sizeof(mi) };
- mi.icolibItem = hIcoHandle;
+ mi.icolibItem = iconList[0].hIcolib;
mi.pszName = LPGEN("&Import...");
mi.position = 500050000;
mi.pszService = IMPORT_SERVICE;
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index cbe4a7e9e3..e60296b254 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -53,7 +53,7 @@ PLUGININFOEX pluginInfo={ HINSTANCE hInst;
static HANDLE hEnableStateChangedEvent;
-HANDLE hExtraIcon, hIcon1, hIcon2;
+HANDLE hExtraIcon;
static HGENMENU hMainMenuGroup = NULL;
static HANDLE hListeningInfoChangedEvent = NULL;
@@ -291,8 +291,14 @@ int AccListChanged(WPARAM wParam, LPARAM lParam) return 0;
}
-
// Called when all the modules are loaded
+
+static IconItem iconList[] =
+{
+ { LPGEN("Listening to (enabled)"), "listening_to_icon", IDI_LISTENINGTO },
+ { LPGEN("Listening to (disabled)"), "listening_off_icon", IDI_LISTENINGOFF },
+};
+
int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
EnableDisablePlayers();
@@ -304,23 +310,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0);
// icons
- TCHAR tszFile[MAX_PATH];
- GetModuleFileName(hInst, tszFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = tszFile;
- sid.pszSection = "ListeningTo";
-
- sid.pszName = "listening_to_icon";
- sid.pszDescription = LPGEN("Listening to (enabled)");
- sid.iDefaultIndex = -IDI_LISTENINGTO;
- hIcon1 = Skin_AddIcon(&sid);
-
- sid.pszName = "listening_off_icon";
- sid.pszDescription = LPGEN("Listening to (disabled)");
- sid.iDefaultIndex = -IDI_LISTENINGOFF;
- hIcon2 = Skin_AddIcon(&sid);
+ Icon_Register(hInst, "ListeningTo", iconList, SIZEOF(iconList));
// Extra icon support
hExtraIcon = ExtraIcon_Register(MODULE_NAME, "Listening to music", "listening_to_icon");
@@ -346,7 +336,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) mi.position = 500080000;
mi.ptszName = LPGENT("Listening to");
mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- mi.icolibItem = hIcon1;
+ mi.icolibItem = iconList[0].hIcolib;
hMainMenuGroup = Menu_AddMainMenuItem(&mi);
mi.hParentMenu = hMainMenuGroup;
@@ -508,8 +498,8 @@ int TopToolBarLoaded(WPARAM wParam, LPARAM lParam) TTBButton ttb = {0};
ttb.cbSize = sizeof(ttb);
- ttb.hIconHandleDn = hIcon1;
- ttb.hIconHandleUp = hIcon2;
+ ttb.hIconHandleDn = iconList[0].hIcolib;
+ ttb.hIconHandleUp = iconList[1].hIcolib;
ttb.pszService = MS_LISTENINGTO_TTB;
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON | (enabled ? TTBBF_PUSHED : 0);
ttb.name = LPGEN("Enable/Disable sending Listening To info (to all protocols)");
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index b64897b109..728f858a09 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -21,7 +21,7 @@ const int vf_default = VF_VS|VF_HFL|VF_IGN|VF_CID|VF_SHOWID|VF_RECV|VF_STAT|VF_S HINSTANCE hinstance;
HGENMENU hmenuVis,hmenuOff,hmenuHide,hmenuIgnore,hmenuProto,hmenuAdded,hmenuAuthReq;
HGENMENU hmenuCopyID,hmenuRecvFiles,hmenuStatusMsg,hmenuCopyIP,hmenuCopyMirVer;
-static HANDLE hIgnoreItem[9], hProtoItem[MAX_PROTOS], hHooks[8], hServices[12];
+static HANDLE hIgnoreItem[9], hProtoItem[MAX_PROTOS];
HICON hIcon[5];
BOOL bMetaContacts;
PROTOACCOUNT **accs;
@@ -45,36 +45,24 @@ static const statusMsg[] = { { "AdvStatus", "activity/text", LPGENT("Activity text"), 8 }
};
-struct
-{
- TCHAR* szDescr;
- char* szName;
- int defIconID;
-}
-static const iconList[] = {
- { _T("Hide from list"), "miex_hidefl", IDI_ICON0 },
- { _T("Show in list"), "miex_showil", IDI_ICON8 },
- { _T("Always visible"), "miex_vis", IDI_ICON1 },
- { _T("Never visible"), "miex_invis", IDI_ICON2 },
- { _T("Send 'You were added'"), "miex_added", IDI_ICON4 },
- { _T("Request authorization"), "miex_authorization", IDI_ICON5 },
- { _T("Copy to Account"), "miex_protocol", IDI_ICON6 },
- { _T("Ignore"), "miex_ignore", IDI_ICON7 },
- { _T("Browse Received Files"), "miex_recfiles", IDI_ICON12 },
- { _T("Copy MirVer"), "miex_copymver", IDI_ICON13 }
+static IconItem iconList[] = {
+ { LPGEN("Hide from list"), "miex_hidefl", IDI_ICON0 },
+ { LPGEN("Show in list"), "miex_showil", IDI_ICON8 },
+ { LPGEN("Always visible"), "miex_vis", IDI_ICON1 },
+ { LPGEN("Never visible"), "miex_invis", IDI_ICON2 },
+ { LPGEN("Send 'You were added'"), "miex_added", IDI_ICON4 },
+ { LPGEN("Request authorization"), "miex_authorization", IDI_ICON5 },
+ { LPGEN("Copy to Account"), "miex_protocol", IDI_ICON6 },
+ { LPGEN("Ignore"), "miex_ignore", IDI_ICON7 },
+ { LPGEN("Browse Received Files"), "miex_recfiles", IDI_ICON12 },
+ { LPGEN("Copy MirVer"), "miex_copymver", IDI_ICON13 }
};
-struct
-{
- TCHAR* szDescr;
- char* szName;
- int defIconID;
-}
-static const overlayIconList[] = {
- { _T("Copy ID"), "miex_copyid", IDI_ICON3 },
- { _T("Copy Status Message"), "miex_copysm1", IDI_ICON9 },
- { _T("Copy xStatus Message"), "miex_copysm2", IDI_ICON10 },
- { _T("Copy IP"), "miex_copyip", IDI_ICON11 }
+static IconItem overlayIconList[] = {
+ { LPGEN("Copy ID"), "miex_copyid", IDI_ICON3 },
+ { LPGEN("Copy Status Message"), "miex_copysm1", IDI_ICON9 },
+ { LPGEN("Copy xStatus Message"), "miex_copysm2", IDI_ICON10 },
+ { LPGEN("Copy IP"), "miex_copyip", IDI_ICON11 }
};
struct {
@@ -195,29 +183,26 @@ void RenameDbProto(HANDLE hContact, HANDLE hContactNew, char* oldName, char* new CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)hContact,(LPARAM)&dbces);
setting = settinglist.first;
- while (setting)
- {
- if (!GetSetting(hContact,oldName,setting->name,&dbv))
- {
- switch (dbv.type)
- {
- case DBVT_BYTE:
- DBWriteContactSettingByte(hContactNew, newName, setting->name, dbv.bVal);
+ while (setting) {
+ if (!GetSetting(hContact,oldName,setting->name,&dbv)) {
+ switch (dbv.type) {
+ case DBVT_BYTE:
+ DBWriteContactSettingByte(hContactNew, newName, setting->name, dbv.bVal);
break;
- case DBVT_WORD:
- DBWriteContactSettingWord(hContactNew, newName, setting->name, dbv.wVal);
+ case DBVT_WORD:
+ DBWriteContactSettingWord(hContactNew, newName, setting->name, dbv.wVal);
break;
- case DBVT_DWORD:
- DBWriteContactSettingDword(hContactNew, newName, setting->name, dbv.dVal);
+ case DBVT_DWORD:
+ DBWriteContactSettingDword(hContactNew, newName, setting->name, dbv.dVal);
break;
- case DBVT_ASCIIZ:
- DBWriteContactSettingString(hContactNew, newName, setting->name, dbv.pszVal);
+ case DBVT_ASCIIZ:
+ DBWriteContactSettingString(hContactNew, newName, setting->name, dbv.pszVal);
break;
- case DBVT_UTF8:
- DBWriteContactSettingStringUtf(hContactNew, newName, setting->name, dbv.pszVal);
+ case DBVT_UTF8:
+ DBWriteContactSettingStringUtf(hContactNew, newName, setting->name, dbv.pszVal);
break;
- case DBVT_BLOB:
- DBWriteContactSettingBlob(hContactNew, newName, setting->name, dbv.pbVal, dbv.cpbVal);
+ case DBVT_BLOB:
+ DBWriteContactSettingBlob(hContactNew, newName, setting->name, dbv.pbVal, dbv.cpbVal);
break;
}
@@ -230,33 +215,6 @@ void RenameDbProto(HANDLE hContact, HANDLE hContactNew, char* oldName, char* new FreeModuleSettingLL(&settinglist);
} // end code from dbe++
-static void IconsInit()
-{
- int i;
- TCHAR tszFile[MAX_PATH];
- GetModuleFileName(hinstance, tszFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszDefaultFile = tszFile;
- sid.cx = sid.cy = 16;
- sid.ptszSection = LPGENT(MODULENAME);
-
- for ( i = 0; i < SIZEOF(iconList); i++ ) {
- sid.pszName = iconList[i].szName;
- sid.ptszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- Skin_AddIcon(&sid);
- }
-
- for ( i = 0; i < SIZEOF(overlayIconList); i++ ) {
- sid.pszName = overlayIconList[i].szName;
- sid.ptszDescription = overlayIconList[i].szDescr;
- sid.iDefaultIndex = -overlayIconList[i].defIconID;
- Skin_AddIcon(&sid);
- }
-}
-
void ShowPopup(char* szText, TCHAR* tszText, HANDLE hContact)
{
POPUPDATAT ppd = {0};
@@ -1193,22 +1151,23 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) {
int pos = 1000, i = 0;
- IconsInit();
+ Icon_Register(hinstance, MODULENAME, iconList, SIZEOF(iconList));
+ Icon_Register(hinstance, MODULENAME, overlayIconList, SIZEOF(overlayIconList));
bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT) != 0;
- hServices[0] = CreateServiceFunction(MS_SETINVIS,onSetInvis);
- hServices[1] = CreateServiceFunction(MS_SETVIS,onSetVis);
- hServices[2] = CreateServiceFunction(MS_HIDE,onHide);
- hServices[3] = CreateServiceFunction(MS_IGNORE,onIgnore);
- hServices[4] = CreateServiceFunction(MS_PROTO,onChangeProto);
- hServices[5] = CreateServiceFunction(MS_ADDED,onSendAdded);
- hServices[6] = CreateServiceFunction(MS_AUTHREQ,onSendAuthRequest);
- hServices[7] = CreateServiceFunction(MS_COPYID,onCopyID);
- hServices[8] = CreateServiceFunction(MS_RECVFILES,onRecvFiles);
- hServices[9] = CreateServiceFunction(MS_STATUSMSG,onCopyStatusMsg);
- hServices[10] = CreateServiceFunction(MS_COPYIP,onCopyIP);
- hServices[11] = CreateServiceFunction(MS_COPYMIRVER,onCopyMirVer);
+ CreateServiceFunction(MS_SETINVIS,onSetInvis);
+ CreateServiceFunction(MS_SETVIS,onSetVis);
+ CreateServiceFunction(MS_HIDE,onHide);
+ CreateServiceFunction(MS_IGNORE,onIgnore);
+ CreateServiceFunction(MS_PROTO,onChangeProto);
+ CreateServiceFunction(MS_ADDED,onSendAdded);
+ CreateServiceFunction(MS_AUTHREQ,onSendAuthRequest);
+ CreateServiceFunction(MS_COPYID,onCopyID);
+ CreateServiceFunction(MS_RECVFILES,onRecvFiles);
+ CreateServiceFunction(MS_STATUSMSG,onCopyStatusMsg);
+ CreateServiceFunction(MS_COPYIP,onCopyIP);
+ CreateServiceFunction(MS_COPYMIRVER,onCopyMirVer);
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_TCHAR;
@@ -1305,15 +1264,13 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hIcon[3] = MakeHalfAlphaIcon(hIcon[1]);
hIcon[4] = MakeHalfAlphaIcon(hIcon[2]);
- hHooks[0] = HookEvent(ME_CLIST_PREBUILDCONTACTMENU,BuildMenu);
- hHooks[1] = HookEvent(ME_OPT_INITIALISE,OptionsInit);
- hHooks[2] = HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ContactSettingChanged);
- hHooks[3] = HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtoSubmenu);
- hHooks[4] = HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit);
- if (hHooks[4])
- {
- hHooks[5] = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
- hHooks[6] = HookEvent(ME_MSG_WINDOWEVENT,ContactWindowOpen);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU,BuildMenu);
+ HookEvent(ME_OPT_INITIALISE,OptionsInit);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ContactSettingChanged);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtoSubmenu);
+ if (HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit)) {
+ HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
+ HookEvent(ME_MSG_WINDOWEVENT,ContactWindowOpen);
}
return 0;
@@ -1328,26 +1285,13 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(void)
{
-
mir_getLP(&pluginInfoEx);
- hHooks[7] = HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit);
return 0;
}
extern "C" __declspec(dllexport) int Unload(void)
{
- int i;
- for (i = 0; i < SIZEOF(hHooks); i++)
- {
- if (hHooks[i])
- UnhookEvent(hHooks[i]);
- }
- for (i = 0; i < SIZEOF(hServices); i++)
- {
- if (hServices[i])
- DestroyServiceFunction(hServices[i]);
- }
-
DestroyIcon( hIcon[3] );
DestroyIcon( hIcon[4] );
return 0;
@@ -1357,4 +1301,4 @@ BOOL WINAPI DllMain(HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved) {
hinstance = hinst;
return 1;
-}
\ No newline at end of file +}
diff --git a/plugins/MetaContacts/src/icons.cpp b/plugins/MetaContacts/src/icons.cpp index 3776212289..508fe50425 100644 --- a/plugins/MetaContacts/src/icons.cpp +++ b/plugins/MetaContacts/src/icons.cpp @@ -1,20 +1,13 @@ #include "metacontacts.h"
-struct
-{
- char* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIcolib;
-}
-static iconList[] = {
- { LPGEN("Toggle Off"), "mc_off", IDI_MCMENUOFF },
- { LPGEN("Toggle On"), "mc_on", IDI_MCMENU },
- { LPGEN("Convert to MetaContact"), "mc_convert", IDI_MCCONVERT },
- { LPGEN("Add to Existing"), "mc_add", IDI_MCADD },
- { LPGEN("Edit"), "mc_edit", IDI_MCEDIT },
- { LPGEN("Set to Default"), "mc_default", IDI_MCSETDEFAULT },
- { LPGEN("Remove"), "mc_remove", IDI_MCREMOVE },
+static IconItem iconList[] = {
+ { LPGEN("Toggle Off"), "off", IDI_MCMENUOFF },
+ { LPGEN("Toggle On"), "on", IDI_MCMENU },
+ { LPGEN("Convert to MetaContact"), "convert", IDI_MCCONVERT },
+ { LPGEN("Add to Existing"), "add", IDI_MCADD },
+ { LPGEN("Edit"), "edit", IDI_MCEDIT },
+ { LPGEN("Set to Default"), "default", IDI_MCSETDEFAULT },
+ { LPGEN("Remove"), "remove", IDI_MCREMOVE },
};
HANDLE GetIconHandle(IconIndex i)
@@ -29,18 +22,5 @@ HICON LoadIconEx(IconIndex i) void InitIcons(void)
{
- TCHAR path[MAX_PATH];
- GetModuleFileName(hInstance, path, SIZEOF(path));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.pszSection = META_PROTO;
- sid.ptszDefaultFile = path;
-
- for (int i=0; i < SIZEOF(iconList); ++i) {
- sid.pszDescription = iconList[i].szDescr;
- sid.pszName = iconList[i].szName;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIcolib = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInstance, META_PROTO, iconList, SIZEOF(iconList), "mc");
}
diff --git a/plugins/MirOTR/MirOTR/src/dllmain.cpp b/plugins/MirOTR/MirOTR/src/dllmain.cpp index e9d04647d6..4e5e0f91c9 100644 --- a/plugins/MirOTR/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/MirOTR/src/dllmain.cpp @@ -145,7 +145,6 @@ DLLFUNC int Unload(void) otrl_userstate_free(otr_user_state);
lib_cs_unlock();
- DeinitIcons();
DeinitUtils();
return 0;
diff --git a/plugins/MirOTR/MirOTR/src/icons.cpp b/plugins/MirOTR/MirOTR/src/icons.cpp index 10f140ff22..aa20796b58 100644 --- a/plugins/MirOTR/MirOTR/src/icons.cpp +++ b/plugins/MirOTR/MirOTR/src/icons.cpp @@ -2,54 +2,25 @@ #include "icons.h"
TCHAR g_dllpath[1024];
-struct
-{
- const TCHAR* stzDescr;
- const char* szName;
- int defIconID;
-}
-static iconList[] = {
- { _T(LANG_ICON_OTR), ICON_OTR, IDI_OTR },
- { _T(LANG_ICON_PRIVATE), ICON_PRIVATE, IDI_PRIVATE },
- { _T(LANG_ICON_UNVERIFIED), ICON_UNVERIFIED, IDI_UNVERIFIED },
- { _T(LANG_ICON_FINISHED), ICON_FINISHED, IDI_FINISHED },
- { _T(LANG_ICON_NOT_PRIVATE), ICON_NOT_PRIVATE, IDI_INSECURE }
-
+static IconItem iconList[] = {
+ { LPGEN(LANG_ICON_OTR), ICON_OTR, IDI_OTR },
+ { LPGEN(LANG_ICON_PRIVATE), ICON_PRIVATE, IDI_PRIVATE },
+ { LPGEN(LANG_ICON_UNVERIFIED), ICON_UNVERIFIED, IDI_UNVERIFIED },
+ { LPGEN(LANG_ICON_FINISHED), ICON_FINISHED, IDI_FINISHED },
+ { LPGEN(LANG_ICON_NOT_PRIVATE), ICON_NOT_PRIVATE, IDI_INSECURE }
};
-HANDLE hIconLibItem[SIZEOF(iconList)];
-
-void InitIcons() {
- TCHAR szFile[MAX_PATH+500];
-
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.ptszSection = _T(MODULENAME);
- sid.flags = SIDF_ALL_TCHAR;
-
- for ( int i = 0; i < SIZEOF(iconList); i++ ) {
- sid.pszName = (char*)iconList[i].szName;
- sid.ptszDescription = (TCHAR*)iconList[i].stzDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
-
-}
-
-void DeinitIcons() {
- for ( int i = 0; i < SIZEOF(iconList); i++ ) {
- (HANDLE)CallService(MS_SKIN2_REMOVEICON, 0, (LPARAM)iconList[i].szName);
- hIconLibItem[i] = NULL;
- }
+void InitIcons()
+{
+ Icon_Register(hInst, MODULENAME, iconList, SIZEOF(iconList));
}
HICON LoadIcon(const char* name, int big) {
return Skin_GetIcon(name, big);
}
-HANDLE GetIconHandle(const char* name) {
+HANDLE GetIconHandle(const char* name)
+{
return Skin_GetIconHandle(name);
}
diff --git a/plugins/MirOTR/MirOTR/src/icons.h b/plugins/MirOTR/MirOTR/src/icons.h index 0983cc147c..2a8e774dfa 100644 --- a/plugins/MirOTR/MirOTR/src/icons.h +++ b/plugins/MirOTR/MirOTR/src/icons.h @@ -6,7 +6,6 @@ #define ICON_OTR (MODULENAME"_otr")
void InitIcons();
-void DeinitIcons();
HICON LoadIcon(const char* name, int big);
HANDLE GetIconHandle(const char* name);
void ReleaseIcon(const char* name, int big);
diff --git a/plugins/MobileState/src/main.cpp b/plugins/MobileState/src/main.cpp index ec106a5ce4..d934e811e4 100644 --- a/plugins/MobileState/src/main.cpp +++ b/plugins/MobileState/src/main.cpp @@ -21,10 +21,8 @@ #include "clients.h"
HINSTANCE g_hInst;
-static HANDLE hHookModulesLoaded = NULL;
-static HANDLE hHookExtraIconsApply = NULL, hContactSettingChanged = NULL;
-HANDLE hExtraIcon = NULL;
int hLangpack;
+HANDLE hExtraIcon = NULL;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
@@ -40,6 +38,8 @@ PLUGININFOEX pluginInfo = { {0xf0ba32d0, 0xcd07, 0x4a9c, { 0x92, 0x6b, 0x5a, 0x1f, 0xf2, 0x1c, 0x3c, 0x10 }}
};
+static IconItem icon = { LPGEN("Mobile State"), "mobile_icon", IDI_MOBILE };
+
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
g_hInst = hinstDLL;
@@ -60,11 +60,9 @@ bool hasMobileClient(HANDLE hContact, LPARAM lParam) TCHAR *client = _tcslwr(NEWTSTR_ALLOCA(dbv.ptszVal));
DBFreeVariant(&dbv);
- for (size_t i=0; i<(sizeof(clients) / sizeof(TCHAR*)); i++) {
- if (_tcsstr(client, clients[i])) {
+ for (size_t i=0; i<(sizeof(clients) / sizeof(TCHAR*)); i++)
+ if (_tcsstr(client, clients[i]))
return true;
- }
- }
}
return false;
}
@@ -97,17 +95,7 @@ int onContactSettingChanged(WPARAM wParam,LPARAM lParam) int onModulesLoaded(WPARAM wParam,LPARAM lParam)
{
// IcoLib support
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.pszSection = "Mobile State";
- sid.ptszDefaultFile = szFile;
- sid.pszDescription = "Mobile State";
- sid.pszName = "mobile_icon";
- sid.iDefaultIndex = -IDI_MOBILE;
- Skin_AddIcon(&sid);
+ Icon_Register(g_hInst, "Mobile State", &icon, 1);
// extra icons
hExtraIcon = ExtraIcon_Register("mobilestate", "Mobile State", "mobile_icon");
@@ -122,28 +110,17 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) return 0;
}
-int onSystemOKToExit(WPARAM wParam,LPARAM lParam)
-{
-
- return 0;
-}
-
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
- hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
- hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
- hHookExtraIconsApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, ExtraIconsApply);
-
+ HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
+ HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, ExtraIconsApply);
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
- UnhookEvent(hHookModulesLoaded);
- UnhookEvent(hHookExtraIconsApply);
- UnhookEvent(hContactSettingChanged);
-
return 0;
}
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index 5d8ab4836c..ae66a1dca4 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -38,6 +38,13 @@ PLUGININFOEX pluginInfo={ { 0xa82baeb3, 0xa33c, 0x4036, { 0xb8, 0x37, 0x78, 0x3, 0xa5, 0xb6, 0xc2, 0xab } } // {A82BAEB3-A33C-4036-B837-7803A5B6C2AB}
};
+static IconItem iconList[] =
+{
+ { LPGEN("Listening to"), "LISTENING_TO_ICON", IDI_LISTENINGTO },
+ { LPGEN("Previous protocol"), "MYDETAILS_PREV_PROTOCOL", IDI_LEFT_ARROW },
+ { LPGEN("Next protocol"), "MYDETAILS_NEXT_PROTOCOL", IDI_RIGHT_ARROW }
+};
+
// Hooks
HANDLE hModulesLoadedHook = NULL;
HANDLE hPreShutdownHook = NULL;
@@ -199,33 +206,10 @@ static int MainInit(WPARAM wparam,LPARAM lparam) InitFrames();
- TCHAR tszPath[MAX_PATH];
- GetModuleFileName(hInst, tszPath, SIZEOF(tszPath));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = tszPath;
-
- if ( Skin_GetIcon("LISTENING_TO_ICON") == NULL) {
- sid.pszSection = LPGEN("Contact List");
- sid.pszDescription = LPGEN("Listening to");
- sid.pszName = "LISTENING_TO_ICON";
- sid.iDefaultIndex = -IDI_LISTENINGTO;
- Skin_AddIcon(&sid);
- }
-
- sid.pszSection = LPGEN("My Details");
- sid.pszDescription = LPGEN("Previous protocol");
- sid.pszName = "MYDETAILS_PREV_PROTOCOL";
- sid.iDefaultIndex = -IDI_LEFT_ARROW;
- Skin_AddIcon(&sid);
-
- sid.pszSection = LPGEN("My Details");
- sid.pszDescription = LPGEN("Next protocol");
- sid.pszName = "MYDETAILS_NEXT_PROTOCOL";
- sid.iDefaultIndex = -IDI_RIGHT_ARROW;
- Skin_AddIcon(&sid);
+ if ( Skin_GetIcon("LISTENING_TO_ICON") == NULL)
+ Icon_Register(hInst, LPGEN("Contact List"), iconList, 1);
+ Icon_Register(hInst, LPGEN("My Details"), iconList+1, SIZEOF(iconList)-1);
return 0;
}
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 0586311c5b..2440d90e84 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -1067,13 +1067,7 @@ void InitMainMenuItem() hServiceMenu = (HANDLE)CreateServiceFunction(MS_STATUSCHANGE_MENUCOMMAND, EnableDisableMenuCommand);
}
-struct _tag_iconList
-{
- char *szDescr;
- char *szName;
- int iIconID;
-}
-static const iconList[] =
+static IconItem iconList[] =
{
{ "Notification enabled", ICO_NOTIFICATION_OFF, IDI_NOTIFICATION_OFF },
{ "Notification disabled", ICO_NOTIFICATION_ON, IDI_NOTIFICATION_ON }
@@ -1081,23 +1075,7 @@ static const iconList[] = void InitIcolib()
{
- char szFile[MAX_PATH];
- char szSettingName[100];
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.cx = sid.cy = 16;
- sid.pszDefaultFile = szFile;
- sid.pszName = szSettingName;
- sid.pszSection = MODULE;
-
- GetModuleFileNameA(hInst, szFile, MAX_PATH);
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s", MODULE, iconList[i].szName);
- sid.pszDescription = Translate(iconList[i].szDescr);
- sid.iDefaultIndex = -iconList[i].iIconID;
- Skin_AddIcon(&sid);
- }
+ Icon_Register(hInst, MODULE, iconList, SIZEOF(iconList), MODULE);
}
void InitSound()
diff --git a/plugins/New_GPG/src/commonheaders.h b/plugins/New_GPG/src/commonheaders.h index 2c4d2f7a60..a3c451e2cd 100755 --- a/plugins/New_GPG/src/commonheaders.h +++ b/plugins/New_GPG/src/commonheaders.h @@ -76,6 +76,7 @@ using std::fstream; #include <m_icolib.h> #include "m_extraicons.h" #include "m_metacontacts.h" +#include "win2k.h" #include "resource.h" diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp index 890a7abbf5..4d16183422 100755 --- a/plugins/New_GPG/src/icons.cpp +++ b/plugins/New_GPG/src/icons.cpp @@ -18,28 +18,15 @@ extern HINSTANCE hInst;
-HANDLE IconLibDefine(char* desc, char* ident, TCHAR* def_file, int def_idx)
+static IconItem iconList[] =
{
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = szGPGModuleName;
- sid.pszDescription = desc;
- sid.flags = SIDF_PATH_TCHAR;
-
- sid.pszName = ident;
- sid.ptszDefaultFile = def_file;
- sid.iDefaultIndex = -def_idx;
- sid.cx = sid.cy = 16;
- return Skin_AddIcon(&sid);
-}
-
+ { "Secured", "secured", IDI_SECURED },
+ { "Unsecured", "unsecured", IDI_UNSECURED }
+};
void InitIconLib()
{
- TCHAR lib[MAX_PATH];
- GetModuleFileName(hInst, lib, MAX_PATH);
-
- IconLibDefine( "Secured", "secured", lib, IDI_SECURED);
- IconLibDefine( "Unsecured", "unsecured", lib, IDI_UNSECURED);
+ Icon_Register(hInst, szGPGModuleName, iconList, SIZEOF(iconList));
}
HICON IconLibGetIcon(const char* ident)
diff --git a/plugins/NewsAggregator/Src/Icons.cpp b/plugins/NewsAggregator/Src/Icons.cpp index 9ba2b0c79b..4d10a52955 100644 --- a/plugins/NewsAggregator/Src/Icons.cpp +++ b/plugins/NewsAggregator/Src/Icons.cpp @@ -19,15 +19,7 @@ Boston, MA 02111-1307, USA. #include "common.h"
-struct _tag_iconList
-{
- char* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
-}
-
-static iconList[] =
+static IconItem iconList[] =
{
{ LPGEN("Protocol icon"), "main", IDI_ICON },
{ LPGEN("Check All Feeds"), "checkall", IDI_CHECKALL },
@@ -39,23 +31,7 @@ static iconList[] = VOID InitIcons()
{
- char szSettingName[100];
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszDefaultFile = szFile;
- sid.pszName = szSettingName;
- sid.ptszSection = _T("News Aggregator");
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, iconList[i].szName);
-
- sid.pszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIconLibItem = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInst, LPGEN("News Aggregator"), iconList, SIZEOF(iconList), MODULE);
}
HICON LoadIconEx(const char* name, BOOL big)
@@ -65,11 +41,11 @@ HICON LoadIconEx(const char* name, BOOL big) return Skin_GetIcon(szSettingName, big);
}
-HANDLE GetIconHandle(const char* name)
+HANDLE GetIconHandle(const char* name)
{
- unsigned i;
- for (i=0; i < SIZEOF(iconList); i++)
+ for (int i=0; i < SIZEOF(iconList); i++)
if (strcmp(iconList[i].szName, name) == 0)
- return iconList[i].hIconLibItem;
+ return iconList[i].hIcolib;
+
return NULL;
}
\ No newline at end of file diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index e2742e3fcd..1b2f7048b0 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -366,7 +366,5 @@ extern "C" __declspec (dllexport) int Unload(void) { RemoveReadEvents();
DeleteCriticalSection(&list_cs);
-
- DeinitIcons();
return 0;
}
diff --git a/plugins/NoHistory/src/icons.cpp b/plugins/NoHistory/src/icons.cpp index f0d0844aa5..f823517f11 100644 --- a/plugins/NoHistory/src/icons.cpp +++ b/plugins/NoHistory/src/icons.cpp @@ -3,47 +3,27 @@ #include "resource.h"
HICON hIconRemove, hIconKeep, hIconClear;
-HANDLE hIcoLibIconsChanged = 0;
-int ReloadIcons(WPARAM wParam, LPARAM lParam) {
- hIconRemove = Skin_GetIcon(MODULE "_remove");
- hIconKeep = Skin_GetIcon(MODULE "_keep");
- hIconClear = Skin_GetIcon(MODULE "_clear");
+static IconItem iconList[] =
+{
+ { LPGEN("Disable"), "remove", IDI_HREMOVE },
+ { LPGEN("Enable"), "keep", IDI_HKEEP },
+ { LPGEN("Clear"), "clear", IDI_HCLEAR },
+};
+int ReloadIcons(WPARAM wParam, LPARAM lParam)
+{
+ hIconRemove = Skin_GetIconByHandle(iconList[0].hIcolib);
+ hIconKeep = Skin_GetIconByHandle(iconList[1].hIcolib);
+ hIconClear = Skin_GetIconByHandle(iconList[2].hIcolib);
return 0;
}
void InitIcons()
{
- TCHAR path[MAX_PATH];
- GetModuleFileName(hInst,path,MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = MODULE;
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = path;
-
- sid.pszDescription = LPGEN("Disable");
- sid.pszName = MODULE "_remove";
- sid.iDefaultIndex = -IDI_HREMOVE;
- Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Enable");
- sid.pszName = MODULE "_keep";
- sid.iDefaultIndex = -IDI_HKEEP;
- Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Clear");
- sid.pszName = MODULE "_clear";
- sid.iDefaultIndex = -IDI_HCLEAR;
- Skin_AddIcon(&sid);
+ Icon_Register(hInst, MODULE, iconList, SIZEOF(iconList), MODULE);
ReloadIcons(0, 0);
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
-}
-
-void DeinitIcons() {
- if(hIcoLibIconsChanged)
- UnhookEvent(hIcoLibIconsChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
}
diff --git a/plugins/NoHistory/src/icons.h b/plugins/NoHistory/src/icons.h index 88fae4be67..cfd2288c52 100644 --- a/plugins/NoHistory/src/icons.h +++ b/plugins/NoHistory/src/icons.h @@ -4,6 +4,5 @@ extern HICON hIconRemove, hIconKeep, hIconClear;
void InitIcons();
-void DeinitIcons();
#endif
diff --git a/plugins/NotesAndReminders/src/globals.h b/plugins/NotesAndReminders/src/globals.h index ecdae3cf1c..83fd2ce3ae 100644 --- a/plugins/NotesAndReminders/src/globals.h +++ b/plugins/NotesAndReminders/src/globals.h @@ -138,7 +138,7 @@ extern int g_notesListGeom[4]; extern int g_notesListColGeom[4];
extern HWND HKHwnd;
-extern HANDLE hIconLibItem[];
+extern IconItem iconList[];
// these defs are only used to emphasize that SYSTEMTIMEtoFILETIME/FILETIMEtoSYSTEMTIME only convert the data type,
// it does not apply any time conversion/correction like UTC to local etc. (if input is local, then output is local too)
diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index a94eee9a94..f4a60f787c 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -90,53 +90,29 @@ INT_PTR PluginMenuCommandDeleteReminders(WPARAM w,LPARAM l) return 0;
}
-struct
+IconItem iconList[] =
{
- char* szDescr;
- char* szName;
- int defIconID;
-}
-static const iconList[] =
-{
- { LPGEN("New Reminder"), "AddReminder", IDI_ADDREMINDER},
- { LPGEN("Delete All Notes"), "DeleteIcon", IDI_DELETEICON},
- { LPGEN("New Note"), "NoteIcon", IDI_NOTEICON},
- { LPGEN("Show/Hide Notes"), "ShowHide", IDI_SHOWHIDE},
- { LPGEN("On Top Caption Icon"), "CaptionIcon", IDI_CAPTIONICON},
- { LPGEN("Delete All Reminders"), "DeleteReminder", IDI_DELETEREMINDER},
- { LPGEN("View Reminders"), "ViewReminders", IDI_VIEWREMINDERS},
- { LPGEN("Not on Top Caption Icon"), "CaptionIconNotTop", IDI_CAPTIONICONNOTTOP},
- { LPGEN("Hide Note Icon"), "HideNote", IDI_HIDENOTE},
- { LPGEN("Remove Note Icon"), "RemoveNote", IDI_REMOVENOTE},
- { LPGEN("Reminder Icon"), "Reminder", IDI_REMINDER},
- { LPGEN("Bring All to Front"), "BringFront", IDI_BRINGFRONT},
- { LPGEN("Play Sound Icon"), "PlaySound", IDI_PLAYSOUND},
- { LPGEN("View Notes"), "ViewNotes", IDI_VIEWNOTES},
- { LPGEN("New Note"), "NewNote", IDI_NOTEICON},
- { LPGEN("New Reminder"), "NewReminder", IDI_ADDREMINDER}
+ { LPGEN("New Reminder"), "AddReminder", IDI_ADDREMINDER },
+ { LPGEN("Delete All Notes"), "DeleteIcon", IDI_DELETEICON },
+ { LPGEN("New Note"), "NoteIcon", IDI_NOTEICON },
+ { LPGEN("Show/Hide Notes"), "ShowHide", IDI_SHOWHIDE },
+ { LPGEN("On Top Caption Icon"), "CaptionIcon", IDI_CAPTIONICON },
+ { LPGEN("Delete All Reminders"), "DeleteReminder", IDI_DELETEREMINDER },
+ { LPGEN("View Reminders"), "ViewReminders", IDI_VIEWREMINDERS },
+ { LPGEN("Not on Top Caption Icon"), "CaptionIconNotTop", IDI_CAPTIONICONNOTTOP },
+ { LPGEN("Hide Note Icon"), "HideNote", IDI_HIDENOTE },
+ { LPGEN("Remove Note Icon"), "RemoveNote", IDI_REMOVENOTE },
+ { LPGEN("Reminder Icon"), "Reminder", IDI_REMINDER },
+ { LPGEN("Bring All to Front"), "BringFront", IDI_BRINGFRONT },
+ { LPGEN("Play Sound Icon"), "PlaySound", IDI_PLAYSOUND },
+ { LPGEN("View Notes"), "ViewNotes", IDI_VIEWNOTES },
+ { LPGEN("New Note"), "NewNote", IDI_NOTEICON },
+ { LPGEN("New Reminder"), "NewReminder", IDI_ADDREMINDER }
};
-HANDLE hIconLibItem[SIZEOF(iconList)];
-
void InitIcons(void)
{
- char szSettingName[100];
-
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hinstance, szFile, SIZEOF(szFile));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszName = szSettingName;
- sid.pszSection = MODULENAME;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULENAME, iconList[i].szName);
- sid.pszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(hinstance, MODULENAME, iconList, SIZEOF(iconList), MODULENAME);
}
int OnOptInitialise(WPARAM w, LPARAM L)
@@ -160,12 +136,12 @@ int OnTopToolBarInit(WPARAM w,LPARAM L) ttb.cbSize = sizeof(TTBButton);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
- ttb.hIconHandleUp = hIconLibItem[14];
+ ttb.hIconHandleUp = iconList[14].hIcolib;
ttb.pszService = MODULENAME"/MenuCommandAddNew";
ttb.name = ttb.pszTooltipUp = LPGEN("Add New Note");
TopToolbar_AddButton(&ttb);
- ttb.hIconHandleUp = hIconLibItem[15];
+ ttb.hIconHandleUp = iconList[15].hIcolib;
ttb.pszService = MODULENAME"/MenuCommandNewReminder";
ttb.name = ttb.pszTooltipUp = LPGEN("Add New Reminder");
TopToolbar_AddButton(&ttb);
@@ -214,56 +190,56 @@ int OnModulesLoaded(WPARAM wparam,LPARAM lparam) mi.flags = CMIF_TCHAR | CMIF_ICONFROMICOLIB;
mi.position = 1600000000;
- mi.icolibItem = hIconLibItem[2];
+ mi.icolibItem = iconList[2].hIcolib;
mi.ptszName = LPGENT("New &Note");
mi.pszService = MODULENAME"/MenuCommandAddNew";
if (g_AddContListMI) Menu_AddContactMenuItem(&mi);
Menu_AddMainMenuItem(&mi);
mi.position = 1600000001;
- mi.icolibItem = hIconLibItem[0];
+ mi.icolibItem = iconList[0].hIcolib;
mi.ptszName = LPGENT("New &Reminder");
mi.pszService = MODULENAME"/MenuCommandNewReminder";
if (g_AddContListMI) Menu_AddContactMenuItem(&mi);
Menu_AddMainMenuItem(&mi);
mi.position = 1600100000;
- mi.icolibItem = hIconLibItem[3];
+ mi.icolibItem = iconList[3].hIcolib;
mi.ptszName = LPGENT("&Show / Hide Notes");
mi.pszService = MODULENAME"/MenuCommandShowHide";
if (g_AddContListMI) Menu_AddContactMenuItem(&mi);
Menu_AddMainMenuItem(&mi);
mi.position = 1600100001;
- mi.icolibItem = hIconLibItem[13];
+ mi.icolibItem = iconList[13].hIcolib;
mi.ptszName = LPGENT("Vie&w Notes");
mi.pszService = MODULENAME"/MenuCommandViewNotes";
if (g_AddContListMI) Menu_AddContactMenuItem(&mi);
Menu_AddMainMenuItem(&mi);
mi.position = 1600100002;
- mi.icolibItem = hIconLibItem[1];
+ mi.icolibItem = iconList[1].hIcolib;
mi.ptszName = LPGENT("&Delete All Notes");
mi.pszService = MODULENAME"/MenuCommandDeleteAll";
if (g_AddContListMI) Menu_AddContactMenuItem(&mi);
Menu_AddMainMenuItem(&mi);
mi.position = 1600100003;
- mi.icolibItem = hIconLibItem[11];
+ mi.icolibItem = iconList[11].hIcolib;
mi.ptszName = LPGENT("&Bring All to Front");
mi.pszService = MODULENAME"/MenuCommandBringAllFront";
if (g_AddContListMI) Menu_AddContactMenuItem(&mi);
Menu_AddMainMenuItem(&mi);
mi.position = 1600200000;
- mi.icolibItem = hIconLibItem[6];
+ mi.icolibItem = iconList[6].hIcolib;
mi.ptszName = LPGENT("&View Reminders");
mi.pszService = MODULENAME"/MenuCommandViewReminders";
if (g_AddContListMI) Menu_AddContactMenuItem(&mi);
Menu_AddMainMenuItem(&mi);
mi.position = 1600200001;
- mi.icolibItem = hIconLibItem[5];
+ mi.icolibItem = iconList[5].hIcolib;
mi.ptszName = LPGENT("D&elete All Reminders");
mi.pszService = MODULENAME"/MenuCommandDeleteReminders";
if (g_AddContListMI) Menu_AddContactMenuItem(&mi);
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index 76f001cea1..25f372b1e7 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -1325,17 +1325,17 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l {
HICON hcIcon;
if (SN->OnTop)
- hcIcon = Skin_GetIconByHandle(hIconLibItem[4]);
+ hcIcon = Skin_GetIconByHandle(iconList[4].hIcolib);
else
- hcIcon = Skin_GetIconByHandle(hIconLibItem[7]);
+ hcIcon = Skin_GetIconByHandle(iconList[7].hIcolib);
DrawIcon(hdc, wr.right - wr.left - 16, 0 + 3, hcIcon);
Skin_ReleaseIcon(hcIcon);
- hcIcon = Skin_GetIconByHandle(hIconLibItem[9]);
+ hcIcon = Skin_GetIconByHandle(iconList[9].hIcolib);
DrawIcon(hdc, wr.right - wr.left - 32, 1 + 3, hcIcon);
Skin_ReleaseIcon(hcIcon);
- hcIcon = Skin_GetIconByHandle(hIconLibItem[8]);
+ hcIcon = Skin_GetIconByHandle(iconList[8].hIcolib);
DrawIcon(hdc, wr.right - wr.left - 48, 1 + 3, hcIcon);
Skin_ReleaseIcon(hcIcon);
}
@@ -1960,9 +1960,9 @@ INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog,UINT Message,WPARAM wParam,LPARAM {
HWND H;
- HICON hIcon = Skin_GetIconByHandle(hIconLibItem[13], ICON_SMALL);
+ HICON hIcon = Skin_GetIconByHandle(iconList[13].hIcolib, ICON_SMALL);
SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)hIcon);
- hIcon = Skin_GetIconByHandle(hIconLibItem[13], ICON_BIG);
+ hIcon = Skin_GetIconByHandle(iconList[13].hIcolib, ICON_BIG);
SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)hIcon);
SetWindowText(Dialog, _T("Notes"));
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index e64086f63c..62bad6bcd3 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -602,7 +602,7 @@ void InitSettings(void) InitFonts();
- g_hReminderIcon = Skin_GetIconByHandle(hIconLibItem[10]);
+ g_hReminderIcon = Skin_GetIconByHandle(iconList[10].hIcolib);
if (g_Transparency < MIN_ALPHA)
g_Transparency = MIN_ALPHA;
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 4183892d09..d991757090 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -2265,7 +2265,7 @@ INT_PTR CALLBACK DlgProcNewReminder(HWND Dialog,UINT Message,WPARAM wParam,LPARA }
}
- hIcon = Skin_GetIconByHandle(hIconLibItem[12]);
+ hIcon = Skin_GetIconByHandle(iconList[12].hIcolib);
SendDlgItemMessage(Dialog,IDC_BTN_PLAYSOUND,BM_SETIMAGE,(WPARAM)IMAGE_ICON,(LPARAM)hIcon);
if (NewReminderVisible == 2 && pEditReminder->SoundSel)
@@ -2655,9 +2655,9 @@ INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog,UINT Message,WPARAM wParam,LPA break;
case WM_INITDIALOG:
{
- HICON hIcon = Skin_GetIconByHandle(hIconLibItem[6], ICON_SMALL);
+ HICON hIcon = Skin_GetIconByHandle(iconList[6].hIcolib, ICON_SMALL);
SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)hIcon);
- hIcon = Skin_GetIconByHandle(hIconLibItem[6], ICON_BIG);
+ hIcon = Skin_GetIconByHandle(iconList[6].hIcolib, ICON_BIG);
SendMessage(Dialog, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)hIcon);
TranslateDialogDefault(Dialog);
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 7921fce8a9..ab5c252a3c 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -5,7 +5,7 @@ int nProtocol = 0;
-static HANDLE g_hEventModulesLoaded = NULL, hEventOptionsInitialize = NULL, g_hIcon = NULL, g_hEventDbWindowEvent = NULL, g_hEventToolbarLoaded = NULL, g_hEventButtonPressed = NULL, g_hEventAccountsChanged = NULL;
+static HANDLE g_hEventModulesLoaded = NULL, hEventOptionsInitialize = NULL, g_hEventDbWindowEvent = NULL, g_hEventToolbarLoaded = NULL, g_hEventButtonPressed = NULL, g_hEventAccountsChanged = NULL;
HINSTANCE hInst;
NudgeElementList *NudgeList = NULL;
@@ -363,20 +363,15 @@ void RegisterToDbeditorpp(void) CallService("DBEditorpp/RegisterSingleModule", (WPARAM)"Nudge", 0);
}
+static IconItem iconList[] =
+{
+ { LPGEN("Nudge as Default"), "Nudge_Default", IDI_NUDGE }
+};
+
void LoadIcons(void)
{
//Load icons
- TCHAR szFilename[MAX_PATH];
- GetModuleFileName(hInst,szFilename,MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.pszSection = LPGEN("Nudge");
- sid.ptszDefaultFile = szFilename;
- sid.pszName = "Nudge_Default";
- sid.pszDescription = LPGEN("Nudge as Default");
- sid.iDefaultIndex = -IDI_NUDGE;
- g_hIcon = Skin_AddIcon(&sid);
+ Icon_Register(hInst, LPGEN("Nudge"), iconList, SIZEOF(iconList));
}
// Nudge support
@@ -399,7 +394,7 @@ static int TabsrmmButtonInit(WPARAM wParam, LPARAM lParam) bbd.ptszTooltip = LPGENT("Send Nudge");
bbd.dwDefPos = 300;
bbd.bbbFlags = BBBF_ISIMBUTTON|BBBF_ISLSIDEBUTTON|BBBF_CANBEHIDDEN;
- bbd.hIcon = g_hIcon;
+ bbd.hIcon = iconList[0].hIcolib;
bbd.dwButtonID = 6000;
bbd.iButtonWidth = 0;
CallService (MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
@@ -550,7 +545,7 @@ void LoadPopupClass() ppc.flags = PCF_TCHAR;
ppc.pszName = "Nudge";
ppc.ptszDescription = LPGENT("Show Nudge");
- ppc.hIcon = Skin_GetIconByHandle(g_hIcon);
+ ppc.hIcon = Skin_GetIconByHandle(iconList[0].hIcolib);
ppc.colorBack = NULL;
ppc.colorText = NULL;
ppc.iSeconds = 0;
diff --git a/plugins/OpenFolder/src/openFolder.cpp b/plugins/OpenFolder/src/openFolder.cpp index 2fb3a4c8ae..98673b4c06 100644 --- a/plugins/OpenFolder/src/openFolder.cpp +++ b/plugins/OpenFolder/src/openFolder.cpp @@ -2,7 +2,7 @@ int hLangpack = 0;
HINSTANCE hInst;
-HANDLE hServiceOpenFolder, hButtonTopToolbar, hIconOpenFolder;
+HANDLE hServiceOpenFolder, hButtonTopToolbar;
PLUGININFOEX pluginInfoEx =
{
@@ -18,6 +18,8 @@ PLUGININFOEX pluginInfoEx = MIID_OPENFOLDER // {10896143-7249-4b36-A408-6501A6B6035A}
};
+static IconItem icon = { LPGEN("Open Folder"), "open", IDI_FOLDER };
+
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
hInst = hinstDLL;
@@ -45,7 +47,7 @@ static int ToptoolBarHook(WPARAM wParam, LPARAM lParam) {
TTBButton ttbb = { 0 };
ttbb.cbSize = sizeof( ttbb );
- ttbb.hIconHandleUp = hIconOpenFolder;
+ ttbb.hIconHandleUp = icon.hIcolib;
ttbb.pszService = MS_OPENFOLDER_OPEN;
ttbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttbb.name = LPGEN("Open Folder");
@@ -56,22 +58,9 @@ static int ToptoolBarHook(WPARAM wParam, LPARAM lParam) static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
HookEvent(ME_TTB_MODULELOADED,ToptoolBarHook);
- TCHAR szFile[MAX_PATH];
- GetModuleFileName( hInst, szFile, MAX_PATH );
-
- char szSettingName[64];
- mir_snprintf(szSettingName, sizeof( szSettingName ), "%s_%s", OPENFOLDER_MODULE_NAME, "open");
-
+
// icolib (0.7+)
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_ALL_TCHAR;
- sid.cx = sid.cy = 16;
- sid.ptszSection = LPGENT("Open Folder");
- sid.pszName = szSettingName;
- sid.ptszDescription = LPGENT("Open Folder");
- sid.iDefaultIndex = -IDI_FOLDER;
- hIconOpenFolder = Skin_AddIcon(&sid);
+ Icon_Register(hInst, LPGEN("Open Folder"), &icon, 1, OPENFOLDER_MODULE_NAME);
// hotkeys service (0.8+)
HOTKEYDESC hotkey = { 0 };
@@ -87,7 +76,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 0x7FFFFFFF;
mi.flags = CMIF_ICONFROMICOLIB|CMIF_TCHAR;
- mi.icolibItem = hIconOpenFolder;
+ mi.icolibItem = icon.hIcolib;
mi.ptszName = LPGENT("Open Folder");
mi.pszService = MS_OPENFOLDER_OPEN;
Menu_AddMainMenuItem(&mi);
diff --git a/plugins/PackUpdater/Src/Common.h b/plugins/PackUpdater/Src/Common.h index 1e2f507688..8f8a25aa8a 100644 --- a/plugins/PackUpdater/Src/Common.h +++ b/plugins/PackUpdater/Src/Common.h @@ -78,13 +78,6 @@ struct FILEINFO BYTE Force;
};
-struct PackUpdaterIconList
-{
- char* szIconName;
- TCHAR* tszDescr;
- int IconID;
-};
-
#define DEFAULT_REMINDER 1
#define DEFAULT_UPDATEONSTARTUP 1
#define DEFAULT_ONLYONCEADAY 0
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 4a46f46c90..150552b18d 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -33,31 +33,17 @@ MYOPTIONS MyOptions = {0}; aPopups PopupsList[POPUPS];
LPCTSTR Title = {0}, Text = {0};
-PackUpdaterIconList iconList[] =
+IconItem iconList[] =
{
- { "check_update", _T("Check for pack updates"), IDI_MENU },
- { "empty_folder", _T("Clear pack updates folder"), IDI_DELETE },
- { "btn_ok", _T("'Yes' Button"), IDI_OK },
- { "btn_cancel", _T("'No' Button"), IDI_CANCEL }
+ { LPGEN("Check for pack updates"), "check_update", IDI_MENU },
+ { LPGEN("Clear pack updates folder"), "empty_folder", IDI_DELETE },
+ { LPGEN("'Yes' Button"), "btn_ok", IDI_OK },
+ { LPGEN("'No' Button"), "btn_cancel", IDI_CANCEL }
};
VOID IcoLibInit()
{
- TCHAR destfile[MAX_PATH];
- GetModuleFileName(hInst, destfile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_ALL_TCHAR;
- sid.cx = sid.cy = 16;
- sid.ptszDefaultFile = destfile;
- sid.ptszSection = MODULE;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- sid.pszName = iconList[i].szIconName;
- sid.ptszDescription = iconList[i].tszDescr;
- sid.iDefaultIndex = -iconList[i].IconID;
- Skin_AddIcon(&sid);
- }
+ Icon_Register(hInst, MODULEA, iconList, SIZEOF(iconList));
}
BOOL NetlibInit()
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index aab0d15d68..4d23855372 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -26,7 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // {1AAC15E8-DCEC-4050-B66F-2AA0E6120C22}
#define MIID_PASTEIT { 0x1aac15e8, 0xdcec, 0x4050, { 0xb6, 0x6f, 0x2a, 0xa0, 0xe6, 0x12, 0xc, 0x22 } }
-
PasteToWeb* pasteToWebs[PasteToWeb::pages];
std::map<HANDLE, HWND>* contactWindows;
DWORD gMirandaVersion;
@@ -38,7 +37,6 @@ HANDLE hPrebuildContactMenu; HANDLE hServiceContactMenu;
HGENMENU hContactMenu;
HGENMENU hWebPageMenus[PasteToWeb::pages];
-HANDLE hMainIcon;
HANDLE hOptionsInit;
HANDLE hWindowEvent = NULL;
HINSTANCE hInst;
@@ -62,6 +60,8 @@ PLUGININFOEX pluginInfo={ MIID_PASTEIT
};
+static IconItem icon = { LPGEN("Paste It"), "PasteIt_main", IDI_MENU };
+
XML_API xi = {0};
int hLangpack = 0;
@@ -364,28 +364,11 @@ INT_PTR ContactMenuService(WPARAM wParam, LPARAM lParam) return 0;
}
-void InitIcolib()
-{
- TCHAR stzFile[MAX_PATH];
- GetModuleFileName(hInst, stzFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.cx = sid.cy = 16;
- sid.ptszDefaultFile = stzFile;
- sid.ptszSection = LPGENT("Paste It");
- sid.flags = SIDF_ALL_TCHAR;
-
- sid.pszName = "PasteIt_main";
- sid.ptszDescription = LPGENT("Paste It");
- sid.iDefaultIndex = -IDI_MENU;
- hMainIcon = Skin_AddIcon(&sid);
-}
-
void InitMenuItems()
{
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- mi.icolibItem = hMainIcon;
+ mi.icolibItem = icon.hIcolib;
mi.position = 3000090005;
mi.ptszName = _T("Paste It");
@@ -445,14 +428,13 @@ void InitTabsrmmButton() btn.dwButtonID = 1;
btn.pszModuleName = MODULE;
btn.dwDefPos = 110;
- btn.hIcon = hMainIcon;
+ btn.hIcon = icon.hIcolib;
btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_ISLSIDEBUTTON | BBBF_CANBEHIDDEN | BBBF_ISCHATBUTTON;
btn.ptszTooltip = TranslateT("Paste It");
CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&btn);
+
if(hTabsrmmButtonPressed != NULL)
- {
UnhookEvent(hTabsrmmButtonPressed);
- }
hTabsrmmButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
}
@@ -485,7 +467,6 @@ int WindowEvent(WPARAM wParam, MessageWindowEventData* lParam) int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- InitIcolib();
InitMenuItems();
InitTabsrmmButton();
hWindowEvent = HookEvent(ME_MSG_WINDOWEVENT, (MIRANDAHOOK)WindowEvent);
@@ -497,6 +478,9 @@ extern "C" int __declspec(dllexport) Load(void) {
mir_getXI(&xi);
mir_getLP(&pluginInfo);
+
+ Icon_Register(hInst, LPGEN("Paste It"), &icon, 1);
+
NETLIBUSER nlu = {0};
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_HTTPCONNS;
@@ -526,25 +510,20 @@ extern "C" int __declspec(dllexport) Unload(void) UnhookEvent(hPrebuildContactMenu);
UnhookEvent(hOptionsInit);
if(hWindowEvent != NULL)
- {
UnhookEvent(hWindowEvent);
- }
+
DestroyServiceFunction(hServiceContactMenu);
Netlib_CloseHandle(g_hNetlibUser);
if(hTabsrmmButtonPressed != NULL)
- {
UnhookEvent(hTabsrmmButtonPressed);
- }
+
for(int i=0; i < PasteToWeb::pages; ++i)
- {
- if(pasteToWebs[i] != NULL)
- {
+ if(pasteToWebs[i] != NULL) {
delete pasteToWebs[i];
pasteToWebs[i] = NULL;
}
- }
- if(Options::instance != NULL)
- {
+
+ if(Options::instance != NULL) {
delete Options::instance;
Options::instance = NULL;
}
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index 22b8b2e63d..28200aa85c 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -315,38 +315,17 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam) return 0;
}
+static IconItem iconList[] =
+{
+ { LPGEN("Responding"), "ping_responding", IDI_ICON_RESPONDING },
+ { LPGEN("Not Responding"), "ping_not_responding", IDI_ICON_NOTRESPONDING },
+ { LPGEN("Testing"), "ping_testing", IDI_ICON_TESTING },
+ { LPGEN("Disabled"), "ping_disabled", IDI_ICON_DISABLED },
+};
+
void InitUtils()
{
- TCHAR file[MAX_PATH];
- GetModuleFileName(hInst,file,MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszSection = LPGENT("Ping");
- sid.flags = SIDF_PATH_TCHAR;
-
- sid.pszDescription = LPGEN("Responding");
- sid.pszName = "ping_responding";
- sid.ptszDefaultFile = file;
- sid.iDefaultIndex = -IDI_ICON_RESPONDING;
- Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Not Responding");
- sid.pszName = "ping_not_responding";
- sid.ptszDefaultFile = file;
- sid.iDefaultIndex = -IDI_ICON_NOTRESPONDING;
- Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Testing");
- sid.pszName = "ping_testing";
- sid.ptszDefaultFile = file;
- sid.iDefaultIndex = -IDI_ICON_TESTING;
- Skin_AddIcon(&sid);
-
- sid.pszDescription = LPGEN("Disabled");
- sid.pszName = "ping_disabled";
- sid.ptszDefaultFile = file;
- sid.iDefaultIndex = -IDI_ICON_DISABLED;
- Skin_AddIcon(&sid);
+ Icon_Register(hInst, LPGENT("Ping"), iconList, SIZEOF(iconList));
hIconResponding = Skin_GetIcon("ping_responding");
hIconNotResponding = Skin_GetIcon("ping_not_responding");
@@ -365,4 +344,4 @@ void InitUtils() test.PluginWindowProc = NullWindowProc;
CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&test);
}
-}
\ No newline at end of file +}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index f5a578c60f..4415261691 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -27,6 +27,9 @@ HANDLE CheckThread = NULL, hNetlibUser = NULL; POPUP_OPTIONS PopupOptions = {0};
aPopups PopupsList[POPUPS];
+/////////////////////////////////////////////////////////////////////////////////////
+// we don't use Icon_Register here because it should work under Miranda IM too
+
struct
{
char *szIconName;
diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index b1ee0142c0..7ea5b9d0fb 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.cpp @@ -32,49 +32,40 @@ Last change by : $Author: Merlin_de $ #include "headers.h"
-struct
-{
- LPSTR pszName;
- LPSTR ptszDesc;
- LPSTR ptszSection;
- WORD idResource;
- LPSTR pszIcon;
- int size;
-}
-static icoDesc[] =
+static IconItem iconList[] =
{
//toolbar
- { ICO_TB_POPUP_ON, "Popups are enabled", SECT_TOLBAR, IDI_POPUP, NULL, 0 },
- { ICO_TB_POPUP_OFF, "Popups are disabled", SECT_TOLBAR, IDI_NOPOPUP, NULL, 0 },
+ { ICO_TB_POPUP_ON, "Popups are enabled", IDI_POPUP },
+ { ICO_TB_POPUP_OFF, "Popups are disabled", IDI_NOPOPUP },
//common popup
- { ICO_POPUP_ON, "Popups are enabled", SECT_POPUP, IDI_POPUP, NULL, 0 },
- { ICO_POPUP_OFF, "Popups are disabled", SECT_POPUP, IDI_NOPOPUP, NULL, 0 },
- { ICO_FAV, "With \"favourite\" overlay", SECT_POPUP, IDI_PU_FAVOURITE, NULL, 0 },
- { ICO_FULLSCREEN, "With \"fullscreen\" overlay", SECT_POPUP, IDI_PU_FULLSCREEN, NULL, 0 },
- { ICO_HISTORY, "Popup History", SECT_POPUP, IDI_HISTORY, NULL, -1 },
+ { ICO_POPUP_ON, "Popups are enabled", IDI_POPUP },
+ { ICO_POPUP_OFF, "Popups are disabled", IDI_NOPOPUP },
+ { ICO_FAV, "With \"favourite\" overlay", IDI_PU_FAVOURITE },
+ { ICO_FULLSCREEN, "With \"fullscreen\" overlay", IDI_PU_FULLSCREEN },
+ { ICO_HISTORY, "Popup History", IDI_HISTORY },
//option
- { ICO_OPT_RELOAD, "Refresh skin list", SECT_POPUP SECT_POPUP_OPT, IDI_RELOAD, NULL, 0 },
- { ICO_OPT_RESIZE, "Popup Placement", SECT_POPUP SECT_POPUP_OPT, IDI_RESIZE, NULL, 0 },
- { ICO_OPT_OK, "OK", SECT_POPUP SECT_POPUP_OPT, IDI_ACT_OK, NULL, 0 },
- { ICO_OPT_CANCEL, "Cancel", SECT_POPUP SECT_POPUP_OPT, IDI_ACT_CLOSE, NULL, 0 },
- { ICO_OPT_GROUP, "Popup Group", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_GROUP, NULL, 0 },
- { ICO_OPT_DEF, "Show default", SECT_POPUP SECT_POPUP_OPT, IDI_ACT_OK, NULL, 0 },
- { ICO_OPT_FAV, "Favorite Contact", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_FAVORITE, NULL, 0 },
- { ICO_OPT_FULLSCREEN, "Show in Fullscreen", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_FULLSCREEN, NULL, 0 },
- { ICO_OPT_BLOCK, "Blocked Contact", SECT_POPUP SECT_POPUP_OPT, IDI_OPT_BLOCK, NULL, 0 },
+ { ICO_OPT_RELOAD, "Refresh skin list", IDI_RELOAD },
+ { ICO_OPT_RESIZE, "Popup Placement", IDI_RESIZE },
+ { ICO_OPT_OK, "OK", IDI_ACT_OK },
+ { ICO_OPT_CANCEL, "Cancel", IDI_ACT_CLOSE },
+ { ICO_OPT_GROUP, "Popup Group", IDI_OPT_GROUP },
+ { ICO_OPT_DEF, "Show default", IDI_ACT_OK },
+ { ICO_OPT_FAV, "Favorite Contact", IDI_OPT_FAVORITE },
+ { ICO_OPT_FULLSCREEN, "Show in Fullscreen", IDI_OPT_FULLSCREEN },
+ { ICO_OPT_BLOCK, "Blocked Contact", IDI_OPT_BLOCK },
//action
- { ICO_ACT_REPLY, "Quick Reply", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_REPLY, NULL, -1 },
- { ICO_ACT_PIN, "Pin Popup", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_PIN, NULL, -1 },
- { ICO_ACT_PINNED, "Pinned Popup", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_PINNED, NULL, -1 },
- { ICO_ACT_MESS, "Send Message", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_MESSAGE, NULL, -1 },
- { ICO_ACT_INFO, "User Details", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_INFO, NULL, -1 },
- { ICO_ACT_MENU, "Contact Menu", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_MENU, NULL, -1 },
- { ICO_ACT_ADD, "Add Contact Permanently", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_ADD, NULL, -1 },
- { ICO_ACT_CLOSE, "Dismiss Popup", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_CLOSE, NULL, -1 },
- { ICO_ACT_COPY, "Copy to clipboard", SECT_POPUP SECT_POPUP_ACT, IDI_ACT_COPY, NULL, -1 }
+ { ICO_ACT_REPLY, "Quick Reply", IDI_ACT_REPLY },
+ { ICO_ACT_PIN, "Pin Popup", IDI_ACT_PIN },
+ { ICO_ACT_PINNED, "Pinned Popup", IDI_ACT_PINNED },
+ { ICO_ACT_MESS, "Send Message", IDI_ACT_MESSAGE },
+ { ICO_ACT_INFO, "User Details", IDI_ACT_INFO },
+ { ICO_ACT_MENU, "Contact Menu", IDI_ACT_MENU },
+ { ICO_ACT_ADD, "Add Contact Permanently", IDI_ACT_ADD },
+ { ICO_ACT_CLOSE, "Dismiss Popup", IDI_ACT_CLOSE },
+ { ICO_ACT_COPY, "Copy to clipboard", IDI_ACT_COPY }
};
@@ -84,6 +75,7 @@ static icoDesc[] = * @param big - bool big icon (default = false)
* @return: HICON if the icon is loaded, NULL otherwise
**/
+
HICON IcoLib_GetIcon(LPCSTR pszIcon, bool big)
{
return (pszIcon) ? Skin_GetIcon(pszIcon, big) : NULL;
@@ -91,40 +83,8 @@ HICON IcoLib_GetIcon(LPCSTR pszIcon, bool big) void InitIcons()
{
- TCHAR selfDLL[MAX_PATH];
- GetModuleFileName(hInst, selfDLL, SIZEOF(selfDLL));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = selfDLL;
-
- for(int i=0; i < SIZEOF(icoDesc); i++) {
- sid.pszName = icoDesc[i].pszName;
- sid.pszDescription = icoDesc[i].ptszDesc; // [TRANSLATED-BY-CORE]
- sid.pszSection = icoDesc[i].ptszSection; //must be always untranslatet !!!!!
- sid.iDefaultIndex = -icoDesc[i].idResource;
-
- switch (icoDesc[i].size){
- // small and big icons
- case -1:
- sid.cx = sid.cy = 0;
- break;
-
- // small icons (16x16)
- case 0:
- sid.cx = sid.cy = 16;
- break;
-
- // normal icons (32x32)
- case 1:
- sid.cx = sid.cy = 32;
- break;
-
- // custom icon size
- default:
- sid.cx = sid.cy = icoDesc[i].size;
- break;
- }
- Skin_AddIcon(&sid);
- }
+ Icon_Register(hInst, SECT_TOLBAR, iconList, 2);
+ Icon_Register(hInst, SECT_POPUP, iconList+2, 5);
+ Icon_Register(hInst, SECT_POPUP SECT_POPUP_OPT, iconList+7, 9);
+ Icon_Register(hInst, SECT_POPUP SECT_POPUP_ACT, iconList+16, 9);
}
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 5729ee29cb..4185aea730 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -32,6 +32,8 @@ INT_PTR QuickRepliesService(WPARAM, LPARAM) return TRUE;
}
+static IconItem icon = { LPGEN("Button"), "qr_button", IDI_QICON };
+
int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
UnhookEvent(hOnModulesLoaded);
@@ -47,22 +49,10 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) hOnButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed);
if ( ServiceExists(MS_BB_ADDBUTTON)) {
+ Icon_Register(hInstance, "TabSRMM/Quick Replies", &icon, 1);
+
char buttonNameTranslated[32], buttonName[32];
- mir_snprintf(buttonName, SIZEOF(buttonName), "Button %x", iNumber + 1);
mir_snprintf(buttonNameTranslated, SIZEOF(buttonNameTranslated), "%s %x",Translate("Button"), iNumber + 1);
-
- TCHAR tszPath[MAX_PATH];
- GetModuleFileName(hInstance, tszPath, SIZEOF(tszPath));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = "TabSRMM/Quick Replies";
- sid.cx = sid.cy = 16;
- sid.pszDescription = buttonNameTranslated;
- sid.pszName = buttonName;
- sid.ptszDefaultFile = tszPath;
- sid.iDefaultIndex = -IDI_QICON;
- HANDLE hIcon = Skin_AddIcon(&sid);
-
mir_snprintf(buttonName, SIZEOF(buttonName), MODULE_NAME" %x", iNumber + 1);
BBButton bbd = {0};
@@ -70,7 +60,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISLSIDEBUTTON;
bbd.pszModuleName = buttonName;
bbd.ptszTooltip = _T("Quick Replies\r\nLeft button - open menu\r\nRight button - options page");
- bbd.hIcon = hIcon;
+ bbd.hIcon = icon.hIcolib;
bbd.dwButtonID = iNumber;
bbd.dwDefPos = 220;
diff --git a/plugins/Quotes/src/IconLib.cpp b/plugins/Quotes/src/IconLib.cpp index e7caa1fd36..ce7ad5cddc 100644 --- a/plugins/Quotes/src/IconLib.cpp +++ b/plugins/Quotes/src/IconLib.cpp @@ -3,7 +3,6 @@ #include <m_icolib.h>
#include "resource.h"
#include "EconomicRateInfo.h"
-// #include <newpluginapi.h>
#include <m_langpack.h>
#include <sstream>
#pragma warning (disable:4996)
@@ -11,52 +10,24 @@ #pragma warning (default:4996)
#include "ModuleInfo.h"
-// extern HMODULE g_hInstance;
-
-namespace
+static IconItem iconList[] =
{
- struct CIconList
- {
- char* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
- };
-
- CIconList iconList[] =
- {
- { LPGEN("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN },
- { LPGEN("Quote/Rate up"), ICON_STR_QUOTE_UP, IDI_ICON_UP },
- { LPGEN("Quote/Rate down"), ICON_STR_QUOTE_DOWN, IDI_ICON_DOWN },
- { LPGEN("Quote/Rate not changed"), ICON_STR_QUOTE_NOT_CHANGED, IDI_ICON_NOTCHANGED },
- { LPGEN("Quote Section"), ICON_STR_SECTION, IDI_ICON_SECTION },
- { LPGEN("Quote"), ICON_STR_QUOTE, IDI_ICON_QUOTE },
- { LPGEN("Currency Converter"), ICON_STR_CURRENCY_CONVERTER, IDI_ICON_CURRENCY_CONVERTER },
- { LPGEN("Refresh"), ICON_STR_REFRESH, IDI_ICON_REFRESH },
- { LPGEN("Export"), ICON_STR_EXPORT, IDI_ICON_EXPORT },
- { LPGEN("Swap button"), ICON_STR_SWAP, IDI_ICON_SWAP },
- { LPGEN("Import"), ICON_STR_IMPORT, IDI_ICON_IMPORT }
- };
-}
+ { LPGEN("Protocol icon"), ICON_STR_MAIN, IDI_ICON_MAIN },
+ { LPGEN("Quote/Rate up"), ICON_STR_QUOTE_UP, IDI_ICON_UP },
+ { LPGEN("Quote/Rate down"), ICON_STR_QUOTE_DOWN, IDI_ICON_DOWN },
+ { LPGEN("Quote/Rate not changed"), ICON_STR_QUOTE_NOT_CHANGED, IDI_ICON_NOTCHANGED },
+ { LPGEN("Quote Section"), ICON_STR_SECTION, IDI_ICON_SECTION },
+ { LPGEN("Quote"), ICON_STR_QUOTE, IDI_ICON_QUOTE },
+ { LPGEN("Currency Converter"), ICON_STR_CURRENCY_CONVERTER, IDI_ICON_CURRENCY_CONVERTER },
+ { LPGEN("Refresh"), ICON_STR_REFRESH, IDI_ICON_REFRESH },
+ { LPGEN("Export"), ICON_STR_EXPORT, IDI_ICON_EXPORT },
+ { LPGEN("Swap button"), ICON_STR_SWAP, IDI_ICON_SWAP },
+ { LPGEN("Import"), ICON_STR_IMPORT, IDI_ICON_IMPORT }
+};
void Quotes_IconsInit()
{
- TCHAR szFile[MAX_PATH];
- ::GetModuleFileName(g_hInstance, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.flags = SIDF_PATH_TCHAR;
- sid.pszSection = QUOTES_PROTOCOL_NAME;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- std::string sName = Quotes_MakeIconName( iconList[i].szName);
- sid.pszName = const_cast<char*>(sName.c_str());
- sid.pszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIconLibItem = Skin_AddIcon(&sid);
- }
+ ::Icon_Register(g_hInstance, QUOTES_PROTOCOL_NAME, iconList, SIZEOF(iconList), QUOTES_PROTOCOL_NAME);
}
std::string Quotes_MakeIconName(const char* name)
@@ -78,14 +49,9 @@ HICON Quotes_LoadIconEx(const char* name,bool bBig /*= false*/) HANDLE Quotes_GetIconHandle(int iconId)
{
- for(int i=0;i < SIZEOF(iconList);i++)
- {
+ for (int i=0; i < SIZEOF(iconList); i++)
if(iconList[i].defIconID == iconId)
- {
- return iconList[i].hIconLibItem;
- }
- }
+ return iconList[i].hIcolib;
return NULL;
}
-
diff --git a/plugins/Rate/src/main.cpp b/plugins/Rate/src/main.cpp index c1c7af1d93..0d00e56a9b 100644 --- a/plugins/Rate/src/main.cpp +++ b/plugins/Rate/src/main.cpp @@ -69,40 +69,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda ///////////////////////////////////////////////////////////////////////////////
-struct
-{
- char* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
-}
-static iconList[] =
-{
- { LPGEN("Rate high"), "rate_high", IDI_RATEHI },
- { LPGEN("Rate medium"), "rate_medium", IDI_RATEME },
- { LPGEN("Rate low"), "rate_low", IDI_RATELO },
-};
-
-static void init_icolib (void)
-{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = LPGEN("Contact Rate");
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_ALL_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++ ) {
- sid.pszName = iconList[i].szName;
- sid.pszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIconLibItem = Skin_AddIcon(&sid);
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
static void setExtraIcon(HANDLE hContact, int bRate = -1, BOOL clear = TRUE)
{
if (hContact == NULL)
@@ -122,10 +88,19 @@ static void setExtraIcon(HANDLE hContact, int bRate = -1, BOOL clear = TRUE) ExtraIcon_SetIcon(hExtraIcon, hContact, icon);
}
+///////////////////////////////////////////////////////////////////////////////
+
+static IconItem iconList[] =
+{
+ { LPGEN("Rate high"), "rate_high", IDI_RATEHI },
+ { LPGEN("Rate medium"), "rate_medium", IDI_RATEME },
+ { LPGEN("Rate low"), "rate_low", IDI_RATELO },
+};
+
int onModulesLoaded(WPARAM wParam,LPARAM lParam)
{
// IcoLib support
- init_icolib();
+ Icon_Register(g_hInst, LPGEN("Contact Rate"), iconList, SIZEOF(iconList));
// Extra icon support
hExtraIcon = ExtraIcon_Register("contact_rate", "Contact rate", "rate_high");
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index ae5c15546b..acfa00b7e1 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -15,10 +15,8 @@ HANDLE hTopToolbarButtonShowList; HANDLE hMsgWndEvent;
HANDLE hWindowList;
HANDLE hMenuItemRemove;
-HANDLE hIcon;
const INT_PTR boo = 0;
-LIST<void> ServiceList(10,boo), HookList(10,boo);
BOOL IsMessageAPI = FALSE;
@@ -50,6 +48,8 @@ PLUGININFOEX pluginInfo = /* 0e5f3b9d-ebcd-44d7-9374-d8e5d88df4e3 */
};
+static IconItem icon = { LPGEN("Main icon"), "recent_main", IDI_SHOWRECENT };
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfo;
@@ -451,7 +451,7 @@ int Create_TopToolbarShowList(WPARAM wParam, LPARAM lParam) {
TTBButton ttbb = {0};
ttbb.cbSize = sizeof(ttbb);
- ttbb.hIconHandleUp = hIcon;
+ ttbb.hIconHandleUp = icon.hIcolib;
ttbb.pszService = msLastUC_ShowList;
ttbb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttbb.name = ttbb.pszTooltipUp = LPGEN(msLastUC_ShowListName);
@@ -461,19 +461,17 @@ int Create_TopToolbarShowList(WPARAM wParam, LPARAM lParam) int Create_MenuitemShowList(void)
{
- // !!!!!!!! check it later
CLISTMENUITEM mi = { sizeof(mi) };
- mi.hIcon = Skin_GetIcon("recent_main");
+ mi.flags = CMIF_ICONFROMICOLIB;
+ mi.icolibItem = icon.hIcolib;
mi.pszName = msLastUC_ShowListName;
mi.pszService = msLastUC_ShowList;
Menu_AddMainMenuItem(&mi);
- ZeroMemory( &mi, sizeof( mi ));
- mi.cbSize = sizeof( mi );
mi.position = 0xFFFFF;
- mi.hIcon = Skin_GetIcon("recent_main");
- mi.ptszName = _T("Toggle Ignore");
- mi.pszService = V_RECENTCONTACTS_TOGGLE_IGNORE;
+ mi.icolibItem = icon.hIcolib;
+ mi.pszName = "Toggle Ignore";
+ mi.pszService = V_RECENTCONTACTS_TOGGLE_IGNORE;
hMenuItemRemove = Menu_AddContactMenuItem(&mi);
return 0;
}
@@ -503,22 +501,6 @@ int OnMsgEvent(WPARAM wParam, LPARAM lParam) return 0;
}
-static void iconsInit(void)
-{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_UNICODE;
- sid.pszSection = Translate(msLastUC_ShowListName);
- sid.ptszDefaultFile = szFile;
-
- sid.pszDescription = LPGEN("Main icon");
- sid.pszName = "recent_main";
- sid.iDefaultIndex = -IDI_SHOWRECENT;
- hIcon = Skin_AddIcon(&sid);
-}
-
static int OnPrebuildContactMenu (WPARAM wParam, LPARAM lParam)
{
CLISTMENUITEM clmi = { sizeof(clmi) };
@@ -535,39 +517,10 @@ static int OnPrebuildContactMenu (WPARAM wParam, LPARAM lParam) int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- iconsInit();
Create_MenuitemShowList();
IsMessageAPI = (CallService(MS_MSG_GETWINDOWAPI, 0, 0) != CALLSERVICE_NOTFOUND);
- //maxShownContacts = ;
LoadDBSettings();
- /*
- if (ServiceExists(MS_FONT_REGISTERT)) {
- FontIDT fid={0};
-
- fid.cbSize=sizeof(fid);
- fid.group = _T("Console");
- fid.name,TranslateT = "Text";
- fid.dbSettingsGroup = "Console";
- fid.prefix = "ConsoleFont";
-
- fid.backgroundGroup = _T("Console");
- fid.backgroundName = _T("Background");
-
- fid.flags = FIDF_DEFAULTVALID;
-
- fid.deffontsettings.charset = DEFAULT_CHARSET;
- fid.deffontsettings.colour = RGB(0, 0, 0);
- fid.deffontsettings.size = 10;
- fid.deffontsettings.style = 0;
- _tcsncpy(fid.deffontsettings.szFace, _T("Tahoma"), LF_FACESIZE);
-
- CallService(MS_FONT_REGISTERT,(WPARAM)&fid,0);
-
- hHooks[i++] = HookEvent(ME_FONT_RELOAD,OnFontChange);
- }
- */
-
// hotkeys
HOTKEYDESC hk = {0};
hk.cbSize = sizeof(hk);
@@ -597,21 +550,22 @@ INT_PTR ToggleIgnore (WPARAM wParam, LPARAM lParam) extern "C" __declspec(dllexport) int Load(void)
{
-
mir_getLP( &pluginInfo );
CoInitialize(NULL);
hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
- ServiceList.insert( CreateServiceFunction(msLastUC_ShowList, OnMenuCommandShowList));
- ServiceList.insert( CreateServiceFunction(V_RECENTCONTACTS_TOGGLE_IGNORE, ToggleIgnore));
+ Icon_Register(hInst, msLastUC_ShowListName, &icon, 1);
+
+ CreateServiceFunction(msLastUC_ShowList, OnMenuCommandShowList);
+ CreateServiceFunction(V_RECENTCONTACTS_TOGGLE_IGNORE, ToggleIgnore);
- HookList.insert( HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded));
- HookList.insert( HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu ));
- HookList.insert( HookEvent(ME_TTB_MODULELOADED, Create_TopToolbarShowList));
- HookList.insert( HookEvent(ME_MSG_WINDOWEVENT, OnMsgEvent));
- HookList.insert( HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged ));
- HookList.insert( HookEvent(ME_OPT_INITIALISE, onOptInitialise));
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu);
+ HookEvent(ME_TTB_MODULELOADED, Create_TopToolbarShowList);
+ HookEvent(ME_MSG_WINDOWEVENT, OnMsgEvent);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged );
+ HookEvent(ME_OPT_INITIALISE, onOptInitialise);
return 0;
}
@@ -619,14 +573,6 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
- int i;
-
- for (i=0; i < ServiceList.getCount(); ++i)
- DestroyServiceFunction( ServiceList[i] );
-
- for (i=0; i < HookList.getCount(); ++i)
- UnhookEvent( HookList[i] );
-
CoUninitialize();
return 0;
}
diff --git a/plugins/Restart/src/restart.cpp b/plugins/Restart/src/restart.cpp index c4215794a2..ef3dfd383c 100644 --- a/plugins/Restart/src/restart.cpp +++ b/plugins/Restart/src/restart.cpp @@ -12,7 +12,7 @@ HINSTANCE hInst;
int hLangpack;
-HANDLE hIconHandle, hRestartMe;
+HANDLE hRestartMe;
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
@@ -53,28 +53,21 @@ static INT_PTR RestartMe(WPARAM wParam, LPARAM lParam) return 0;
}
+static IconItem icon = { LPGEN("Restart"), "rst_restart_icon", IDI_RESTARTICON };
+
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP( &pluginInfo );
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
// IcoLib support
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszSection = _T("Restart Plugin");
- sid.ptszDescription = _T("Restart");
- sid.pszName = "rst_restart_icon";
- sid.iDefaultIndex = -IDI_RESTARTICON;
- hIconHandle = Skin_AddIcon(&sid);
+ Icon_Register(hInst, "Restart Plugin", &icon, 1);
hRestartMe = CreateServiceFunction("System/RestartMe", RestartMe);
+
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = -0x7FFFFFFF;
mi.flags = CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- mi.icolibItem = hIconHandle;
+ mi.icolibItem = icon.hIcolib;
mi.ptszName = _T("Restart");
mi.pszService = "System/RestartMe";
Menu_AddMainMenuItem(&mi);
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 8fe9d37619..50dcdb68c2 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -26,8 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct GlobalMessageData *g_dat=NULL;
extern PSLWA pSetLayeredWindowAttributes;
-HANDLE hEventSkin2IconsChanged;
-
static int ackevent(WPARAM wParam, LPARAM lParam);
extern int Chat_ModulesLoaded(WPARAM wParam,LPARAM lParam);
@@ -43,81 +41,86 @@ static const char *chatButtonIcons[] = {"scriver_CLOSEX", "chat_smiley", "chat_history",
"chat_filter", "chat_settings", "chat_nicklist", "scriver_SEND"};
-typedef struct IconDefStruct
+static IconItem iconList[] =
{
- char* section;
- char *name;
- int defaultIndex;
- char *description;
- int size;
-} IconDef;
-
-static const IconDef iconList[] = {
- {LPGEN("Single Messaging"), "scriver_ADD", IDI_ADDCONTACT, LPGEN("Add contact")},
- {LPGEN("Single Messaging"), "scriver_USERDETAILS", IDI_USERDETAILS, LPGEN("User's details")},
- {LPGEN("Single Messaging"), "scriver_HISTORY", IDI_HISTORY, LPGEN("User's history")},
- {LPGEN("Single Messaging"), "scriver_SEND", IDI_SEND, LPGEN("Send message")},
- {LPGEN("Single Messaging"), "scriver_SMILEY", IDI_SMILEY, LPGEN("Smiley button")},
- {LPGEN("Single Messaging"), "scriver_TYPING", IDI_TYPING, LPGEN("User is typing")},
- {LPGEN("Single Messaging"), "scriver_TYPINGOFF", IDI_TYPINGOFF, LPGEN("Typing notification off")},
- {LPGEN("Single Messaging"), "scriver_UNICODEON", IDI_UNICODEON, LPGEN("Unicode is on")},
- {LPGEN("Single Messaging"), "scriver_UNICODEOFF", IDI_UNICODEOFF, LPGEN("Unicode is off")},
- {LPGEN("Single Messaging"), "scriver_DELIVERING", IDI_TIMESTAMP, LPGEN("Sending")},
- {LPGEN("Single Messaging"), "scriver_QUOTE", IDI_QUOTE, LPGEN("Quote button")},
- {LPGEN("Single Messaging"), "scriver_CLOSEX", IDI_CLOSEX, LPGEN("Close button")},
- {LPGEN("Single Messaging"), "scriver_OVERLAY", IDI_OVERLAY, LPGEN("Icon overlay")},
- {LPGEN("Single Messaging"), "scriver_INCOMING", IDI_INCOMING, LPGEN("Incoming message (10x10)"),10},
- {LPGEN("Single Messaging"), "scriver_OUTGOING", IDI_OUTGOING, LPGEN("Outgoing message (10x10)"),10},
- {LPGEN("Single Messaging"), "scriver_NOTICE", IDI_NOTICE, LPGEN("Notice (10x10)"),10},
- {LPGEN("Group Chats"), "chat_window", IDI_CHANMGR, LPGEN("Window Icon")},
- {LPGEN("Group Chats"), "chat_fgcol", IDI_COLOR, LPGEN("Text colour")},
- {LPGEN("Group Chats"), "chat_bkgcol", IDI_BKGCOLOR, LPGEN("Background colour")},
- {LPGEN("Group Chats"), "chat_bold", IDI_BBOLD, LPGEN("Bold")},
- {LPGEN("Group Chats"), "chat_italics", IDI_BITALICS, LPGEN("Italics")},
- {LPGEN("Group Chats"), "chat_underline", IDI_BUNDERLINE, LPGEN("Underlined")},
- {LPGEN("Group Chats"), "chat_smiley", IDI_SMILEY, LPGEN("Smiley button")},
- {LPGEN("Group Chats"), "chat_history", IDI_HISTORY, LPGEN("Room history")},
- {LPGEN("Group Chats"), "chat_settings", IDI_TOPICBUT, LPGEN("Room settings")},
- {LPGEN("Group Chats"), "chat_filter", IDI_FILTER, LPGEN("Event filter disabled")},
- {LPGEN("Group Chats"), "chat_filter2", IDI_FILTER2, LPGEN("Event filter enabled")},
- {LPGEN("Group Chats"), "chat_nicklist", IDI_NICKLIST, LPGEN("Hide userlist")},
- {LPGEN("Group Chats"), "chat_nicklist2", IDI_NICKLIST2, LPGEN("Show userlist")},
- {LPGEN("Group Chats"), "chat_overlay", IDI_OVERLAY, LPGEN("Icon overlay")},
- {LPGEN("Group Chats"), "chat_status0", IDI_STATUS0, LPGEN("Status 1 (10x10)"),10},
- {LPGEN("Group Chats"), "chat_status1", IDI_STATUS1, LPGEN("Status 2 (10x10"),10},
- {LPGEN("Group Chats"), "chat_status2", IDI_STATUS2, LPGEN("Status 3 (10x10)"),10},
- {LPGEN("Group Chats"), "chat_status3", IDI_STATUS3, LPGEN("Status 4 (10x10)"),10},
- {LPGEN("Group Chats"), "chat_status4", IDI_STATUS4, LPGEN("Status 5 (10x10)"),10},
- {LPGEN("Group Chats"), "chat_status5", IDI_STATUS5, LPGEN("Status 6 (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_message_in", IDI_INCOMING, LPGEN("Message in (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_message_out", IDI_OUTGOING, LPGEN("Message out (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_action", IDI_ACTION, LPGEN("Action (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_addstatus", IDI_ADDSTATUS, LPGEN("Add Status (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_removestatus", IDI_REMSTATUS, LPGEN("Remove status (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_join", IDI_JOIN, LPGEN("Join (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_part", IDI_PART, LPGEN("Leave (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_quit", IDI_QUIT, LPGEN("Quit (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_kick", IDI_KICK, LPGEN("Kick (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_nick", IDI_NICK, LPGEN("Nickchange (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_notice", IDI_CHAT_NOTICE, LPGEN("Notice (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_topic", IDI_TOPIC, LPGEN("Topic (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_highlight", IDI_NOTICE, LPGEN("Highlight (10x10)"),10},
- {LPGEN("Group Chats Log"), "chat_log_info", IDI_INFO, LPGEN("Information (10x10)"),10}
+ { LPGEN("Add contact"), "scriver_ADD", IDI_ADDCONTACT }, // 1
+ { LPGEN("User's details"), "scriver_USERDETAILS", IDI_USERDETAILS }, // 2
+ { LPGEN("User's history"), "scriver_HISTORY", IDI_HISTORY }, // 3
+ { LPGEN("Send message"), "scriver_SEND", IDI_SEND }, // 4
+ { LPGEN("Smiley button"), "scriver_SMILEY", IDI_SMILEY }, // 5
+ { LPGEN("User is typing"), "scriver_TYPING", IDI_TYPING }, // 6
+ { LPGEN("Typing notification off"), "scriver_TYPINGOFF", IDI_TYPINGOFF }, // 7
+ { LPGEN("Unicode is on"), "scriver_UNICODEON", IDI_UNICODEON }, // 8
+ { LPGEN("Unicode is off"), "scriver_UNICODEOFF", IDI_UNICODEOFF }, // 9
+ { LPGEN("Sending"), "scriver_DELIVERING", IDI_TIMESTAMP }, // 10
+ { LPGEN("Quote button"), "scriver_QUOTE", IDI_QUOTE }, // 11
+ { LPGEN("Close button"), "scriver_CLOSEX", IDI_CLOSEX }, // 12
+ { LPGEN("Icon overlay"), "scriver_OVERLAY", IDI_OVERLAY }, // 13
+ { LPGEN("Incoming message (10x10)"),"scriver_INCOMING", IDI_INCOMING, 10}, // 14
+ { LPGEN("Outgoing message (10x10)"),"scriver_OUTGOING", IDI_OUTGOING, 10}, // 15
+ { LPGEN("Notice (10x10)"), "scriver_NOTICE", IDI_NOTICE, 10}, // 16
+
+ { LPGEN("Window Icon"), "chat_window", IDI_CHANMGR }, // 1
+ { LPGEN("Text colour"), "chat_fgcol", IDI_COLOR }, // 2
+ { LPGEN("Background colour"), "chat_bkgcol", IDI_BKGCOLOR }, // 3
+ { LPGEN("Bold"), "chat_bold", IDI_BBOLD }, // 4
+ { LPGEN("Italics"), "chat_italics", IDI_BITALICS }, // 5
+ { LPGEN("Underlined"), "chat_underline", IDI_BUNDERLINE }, // 6
+ { LPGEN("Smiley button"), "chat_smiley", IDI_SMILEY }, // 7
+ { LPGEN("Room history"), "chat_history", IDI_HISTORY }, // 8
+ { LPGEN("Room settings"), "chat_settings", IDI_TOPICBUT }, // 9
+ { LPGEN("Event filter disabled"), "chat_filter", IDI_FILTER }, // 10
+ { LPGEN("Event filter enabled"), "chat_filter2", IDI_FILTER2 }, // 11
+ { LPGEN("Hide userlist"), "chat_nicklist", IDI_NICKLIST }, // 12
+ { LPGEN("Show userlist"), "chat_nicklist2", IDI_NICKLIST2 }, // 13
+ { LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY }, // 14
+ { LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0, 10}, // 15
+ { LPGEN("Status 2 (10x10"), "chat_status1", IDI_STATUS1, 10}, // 16
+ { LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2, 10}, // 17
+ { LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3, 10}, // 18
+ { LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4, 10}, // 19
+ { LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5, 10}, // 20
+
+ { LPGEN("Message in (10x10)"), "chat_log_message_in", IDI_INCOMING, 10}, // 1
+ { LPGEN("Message out (10x10)"), "chat_log_message_out", IDI_OUTGOING, 10}, // 2
+ { LPGEN("Action (10x10)"), "chat_log_action", IDI_ACTION, 10}, // 3
+ { LPGEN("Add Status (10x10)"), "chat_log_addstatus", IDI_ADDSTATUS,10}, // 4
+ { LPGEN("Remove status (10x10)"), "chat_log_removestatus", IDI_REMSTATUS,10}, // 5
+ { LPGEN("Join (10x10)"), "chat_log_join", IDI_JOIN, 10}, // 6
+ { LPGEN("Leave (10x10)"), "chat_log_part", IDI_PART, 10}, // 7
+ { LPGEN("Quit (10x10)"), "chat_log_quit", IDI_QUIT, 10}, // 8
+ { LPGEN("Kick (10x10)"), "chat_log_kick", IDI_KICK, 10}, // 9
+ { LPGEN("Nickchange (10x10)"), "chat_log_nick", IDI_NICK, 10}, // 10
+ { LPGEN("Notice (10x10)"), "chat_log_notice", IDI_CHAT_NOTICE, 10}, // 11
+ { LPGEN("Topic (10x10)"), "chat_log_topic", IDI_TOPIC, 10}, // 12
+ { LPGEN("Highlight (10x10)"), "chat_log_highlight", IDI_NOTICE, 10}, // 13
+ { LPGEN("Information (10x10)"), "chat_log_info", IDI_INFO, 10}, // 14
};
+void RegisterIcons(void)
+{
+ HookEvent_Ex(ME_SKIN2_ICONSCHANGED, IconsChanged);
+
+ Icon_Register(g_hInst, LPGEN("Single Messaging"), iconList, 16);
+ Icon_Register(g_hInst, LPGEN("Group Chats"), iconList+16, 20);
+ Icon_Register(g_hInst, LPGEN("Single Messaging"), iconList+36, 14);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
HICON hIconList[SIZEOF(iconList)];
BOOL IsStaticIcon(HICON hIcon) {
int i;
- for (i = 0; i < SIZEOF(hIconList); i++) {
- if (hIcon == hIconList[i]) {
+ for (i = 0; i < SIZEOF(hIconList); i++)
+ if (hIcon == hIconList[i])
return TRUE;
- }
- }
+
return FALSE;
}
-void ReleaseIconSmart(HICON hIcon) {
+void ReleaseIconSmart(HICON hIcon)
+{
if (!IsStaticIcon(hIcon))
Skin_ReleaseIcon(hIcon);
}
@@ -149,28 +152,6 @@ int ImageList_AddIcon_ProtoEx(HIMAGELIST hIml, const char* szProto, int status) return res;
}
-void RegisterIcons(void)
-{
- hEventSkin2IconsChanged = HookEvent_Ex(ME_SKIN2_ICONSCHANGED, IconsChanged);
-
- TCHAR path[MAX_PATH];
- char szSection[200];
- GetModuleFileName(g_hInst, path, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = path;
- sid.pszSection = szSection;
- for (int i = 0; i < SIZEOF(iconList); i++) {
- mir_snprintf(szSection, SIZEOF(szSection), "%s/%s", LPGEN("Messaging"), iconList[i].section);
- sid.pszName = (char*)iconList[i].name;
- sid.cx = sid.cy = iconList[i].size;
- sid.iDefaultIndex = -iconList[i].defaultIndex;
- sid.pszDescription = iconList[i].description;
- Skin_AddIcon(&sid);
- }
-}
-
void ReleaseIcons()
{
for (int i = 0; i < SIZEOF(hIconList); i++)
@@ -184,12 +165,10 @@ void ReleaseIcons() HICON GetCachedIcon(const char *name)
{
- int i;
- for (i = 0; i < SIZEOF(iconList); i++) {
- if (!strcmp(iconList[i].name, name)) {
+ for (int i = 0; i < SIZEOF(iconList); i++)
+ if (!strcmp(iconList[i].szName, name))
return hIconList[i];
- }
- }
+
return NULL;
}
@@ -197,7 +176,7 @@ void LoadGlobalIcons() { int i;
int overlayIcon;
for (i = 0; i < SIZEOF(iconList); i++)
- hIconList[i] = Skin_GetIcon(iconList[i].name);
+ hIconList[i] = Skin_GetIcon(iconList[i].szName);
g_dat->hMsgIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
g_dat->hMsgIconBig = LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE);
@@ -231,28 +210,28 @@ static BOOL CALLBACK LangAddCallback(CHAR * str) { int i, count;
UINT cp;
static struct { UINT cpId; const TCHAR *cpName; } cpTable[] = {
- { 874, _T("Thai") },
- { 932, _T("Japanese") },
- { 936, _T("Simplified Chinese") },
- { 949, _T("Korean") },
- { 950, _T("Traditional Chinese") },
- { 1250, _T("Central European") },
- { 1251, _T("Cyrillic") },
- { 1252, _T("Latin I") },
- { 1253, _T("Greek") },
- { 1254, _T("Turkish") },
- { 1255, _T("Hebrew") },
- { 1256, _T("Arabic") },
- { 1257, _T("Baltic") },
- { 1258, _T("Vietnamese") },
+ { 874, _T("Thai") }, //
+ { 932, _T("Japanese") }, //
+ { 936, _T("Simplified Chinese") }, //
+ { 949, _T("Korean") }, //
+ { 950, _T("Traditional Chinese") }, //
+ { 1250, _T("Central European") }, //
+ { 1251, _T("Cyrillic") }, //
+ { 1252, _T("Latin I") }, //
+ { 1253, _T("Greek") }, //
+ { 1254, _T("Turkish") }, //
+ { 1255, _T("Hebrew") }, //
+ { 1256, _T("Arabic") }, //
+ { 1257, _T("Baltic") }, //
+ { 1258, _T("Vietnamese") }, //
{ 1361, _T("Korean (Johab)") }
};
- cp = atoi(str);
+ cp = atoi(str);
count = sizeof(cpTable)/sizeof(cpTable[0]);
for (i=0; i<count && cpTable[i].cpId!=cp; i++);
- if (i < count) {
+ if (i < count)
AppendMenu(g_dat->hMenuANSIEncoding, MF_STRING, cp, TranslateTS(cpTable[i].cpName));
- }
+
return TRUE;
}
@@ -261,9 +240,9 @@ void LoadInfobarFonts() LOGFONT lf;
LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL, FALSE);
g_dat->minInputAreaHeight = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES) * abs(lf.lfHeight) * g_dat->logPixelSY / 72;
- if (g_dat->hInfobarBrush != NULL) {
+ if (g_dat->hInfobarBrush != NULL)
DeleteObject(g_dat->hInfobarBrush);
- }
+
g_dat->hInfobarBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR));
}
@@ -323,14 +302,10 @@ void ReloadGlobals() { g_dat->ieviewInstalled = ServiceExists(MS_IEVIEW_WINDOW);
g_dat->flags = 0;
g_dat->flags2 = 0;
-// if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDBUTTON, SRMSGDEFSET_SENDBUTTON))
-// g_dat->flags |= SMF_SENDBTN;
- if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE)) {
+ if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE))
g_dat->flags |= SMF_AVATAR;
- }
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS))
g_dat->flags |= SMF_SHOWPROGRESS;
-
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS))
g_dat->flags |= SMF_SHOWICONS;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME))
@@ -431,7 +406,6 @@ void ReloadGlobals() { g_dat->limitNamesLength = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN);
g_dat->limitTabsNum = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM);
g_dat->limitChatsTabsNum = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM);
-
}
static int ackevent(WPARAM wParam, LPARAM lParam) {
@@ -482,9 +456,8 @@ static int ackevent(WPARAM wParam, LPARAM lParam) { dbei.pBlob = (PBYTE) item->sendBuffer;
hNewEvent = (HANDLE) CallService(MS_DB_EVENT_ADD, (WPARAM) item->hContact, (LPARAM) & dbei);
- if (item->hwndErrorDlg != NULL) {
+ if (item->hwndErrorDlg != NULL)
DestroyWindow(item->hwndErrorDlg);
- }
if (RemoveSendQueueItem(item) && DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)) {
if (hwndSender != NULL) {
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 77c67ec4a0..b6706cbfab 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -40,14 +40,13 @@ typedef struct TabDefStruct { } TabDef;
static const TabDef tabPages[] = {
- {DlgProcOptions, IDD_OPT_MSGDLG, LPGEN("General")},
- {DlgProcTabsOptions, IDD_OPT_MSGTABS, LPGEN("Tabs")},
- {DlgProcLayoutOptions, IDD_OPT_LAYOUT, LPGEN("Layout")},
- {DlgProcLogOptions, IDD_OPT_MSGLOG, LPGEN("Event Log")},
- {DlgProcOptions1, IDD_OPTIONS1, LPGEN("Group Chat")},
- {DlgProcOptions2, IDD_OPTIONS2, LPGEN("Group Chat Log")}
- };
-
+ {DlgProcOptions, IDD_OPT_MSGDLG, LPGEN("General")},
+ {DlgProcTabsOptions, IDD_OPT_MSGTABS, LPGEN("Tabs")},
+ {DlgProcLayoutOptions, IDD_OPT_LAYOUT, LPGEN("Layout")},
+ {DlgProcLogOptions, IDD_OPT_MSGLOG, LPGEN("Event Log")},
+ {DlgProcOptions1, IDD_OPTIONS1, LPGEN("Group Chat")},
+ {DlgProcOptions2, IDD_OPTIONS2, LPGEN("Group Chat Log")}
+};
#define FONTF_BOLD 1
#define FONTF_ITALIC 2
@@ -63,46 +62,46 @@ typedef struct FontOptionsListStruct }FontOptionsList;
static const FontOptionsList fontOptionsList[] = {
- {LPGENT("Outgoing messages"), RGB(106, 106, 106), _T("Arial"), 0, -12, LPGENT("Outgoing background")},
- {LPGENT("Incoming messages"), RGB(0, 0, 0), _T("Arial"), 0, -12, LPGENT("Incoming background")},
- {LPGENT("Outgoing name"), RGB(89, 89, 89), _T("Arial"), FONTF_BOLD, -12, LPGENT("Outgoing background")},
- {LPGENT("Outgoing time"), RGB(0, 0, 0), _T("Terminal"), FONTF_BOLD, -9, LPGENT("Outgoing background")},
- {LPGENT("Outgoing colon"), RGB(89, 89, 89), _T("Arial"), 0, -11, LPGENT("Outgoing background")},
- {LPGENT("Incoming name"), RGB(215, 0, 0), _T("Arial"), FONTF_BOLD, -12, LPGENT("Incoming background")},
- {LPGENT("Incoming time"), RGB(0, 0, 0), _T("Terminal"), FONTF_BOLD, -9, LPGENT("Incoming background")},
- {LPGENT("Incoming colon"), RGB(215, 0, 0), _T("Arial"), 0, -11, LPGENT("Incoming background")},
- {LPGENT("Message area"), RGB(0, 0, 0), _T("Arial"), 0, -12, LPGENT("Input area background")},
- {LPGENT("Notices"), RGB(90, 90, 160), _T("Arial"), 0, -12, LPGENT("Incoming background")},
- {LPGENT("Outgoing URL"), RGB(0, 0, 255), _T("Arial"), 0, -12, LPGENT("Outgoing background")},
- {LPGENT("Incoming URL"), RGB(0, 0, 255), _T("Arial"), 0, -12, LPGENT("Incoming background")},
- {LPGENT("Infobar contact name"), RGB(0, 0, 0), _T("Arial"), FONTF_BOLD, -19, LPGENT("Infobar background")},
- {LPGENT("Infobar status message"), RGB(50, 50, 50), _T("Arial"), FONTF_ITALIC, -11, LPGENT("Infobar background")}
+ { LPGENT("Outgoing messages"), RGB(106, 106, 106), _T("Arial"), 0, -12, LPGENT("Outgoing background")},
+ { LPGENT("Incoming messages"), RGB(0, 0, 0), _T("Arial"), 0, -12, LPGENT("Incoming background")},
+ { LPGENT("Outgoing name"), RGB(89, 89, 89), _T("Arial"), FONTF_BOLD, -12, LPGENT("Outgoing background")},
+ { LPGENT("Outgoing time"), RGB(0, 0, 0), _T("Terminal"), FONTF_BOLD, -9, LPGENT("Outgoing background")},
+ { LPGENT("Outgoing colon"), RGB(89, 89, 89), _T("Arial"), 0, -11, LPGENT("Outgoing background")},
+ { LPGENT("Incoming name"), RGB(215, 0, 0), _T("Arial"), FONTF_BOLD, -12, LPGENT("Incoming background")},
+ { LPGENT("Incoming time"), RGB(0, 0, 0), _T("Terminal"), FONTF_BOLD, -9, LPGENT("Incoming background")},
+ { LPGENT("Incoming colon"), RGB(215, 0, 0), _T("Arial"), 0, -11, LPGENT("Incoming background")},
+ { LPGENT("Message area"), RGB(0, 0, 0), _T("Arial"), 0, -12, LPGENT("Input area background")},
+ { LPGENT("Notices"), RGB(90, 90, 160), _T("Arial"), 0, -12, LPGENT("Incoming background")},
+ { LPGENT("Outgoing URL"), RGB(0, 0, 255), _T("Arial"), 0, -12, LPGENT("Outgoing background")},
+ { LPGENT("Incoming URL"), RGB(0, 0, 255), _T("Arial"), 0, -12, LPGENT("Incoming background")},
+ { LPGENT("Infobar contact name"), RGB(0, 0, 0), _T("Arial"), FONTF_BOLD, -19, LPGENT("Infobar background")},
+ { LPGENT("Infobar status message"), RGB(50, 50, 50), _T("Arial"), FONTF_ITALIC, -11, LPGENT("Infobar background")}
};
int fontOptionsListSize = SIZEOF(fontOptionsList);
//remeber to put these in the Translate( ) template file too
static const FontOptionsList chatFontOptionsList[] = {
- {LPGENT("Timestamp"), RGB(50, 50, 240), _T("Terminal"), 0, -8, LPGENT("Background")},
- {LPGENT("Others nicknames"), RGB(0, 0, 0), _T("Verdana"), FONTF_BOLD, -13, LPGENT("Background")},
- {LPGENT("Your nickname"), RGB(0, 0, 0), _T("Verdana"), FONTF_BOLD, -13, LPGENT("Background")},
- {LPGENT("User has joined"), RGB(90, 160, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("User has left"), RGB(160, 160, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("User has disconnected"), RGB(160, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("User kicked ..."), RGB(100, 100, 100), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("User is now known as ..."), RGB(90, 90, 160), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("Notice from user"), RGB(160, 130, 60), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("Incoming message"), RGB(90, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("Outgoing message"), RGB(90, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("The topic is ..."), RGB(70, 70, 160), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("Information messages"), RGB(130, 130, 195), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("User enables status for ..."), RGB(70, 150, 70), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("User disables status for ..."), RGB(150, 70, 70), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("Action message"), RGB(160, 90, 160), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("Highlighted message"), RGB(180, 150, 80), _T("Verdana"), 0, -13, LPGENT("Background")},
- {LPGENT("Message typing area"), RGB(0, 0, 40), _T("Verdana"), 0, -14, LPGENT("Message background")},
- {LPGENT("User list members (online)"), RGB(0,0, 0), _T("Verdana"), 0, -12, LPGENT("User list background")},
- {LPGENT("User list members (away)"), RGB(170, 170, 170), _T("Verdana"), 0, -12, LPGENT("User list background")},
+ { LPGENT("Timestamp"), RGB(50, 50, 240), _T("Terminal"), 0, -8, LPGENT("Background")},
+ { LPGENT("Others nicknames"), RGB(0, 0, 0), _T("Verdana"), FONTF_BOLD, -13, LPGENT("Background")},
+ { LPGENT("Your nickname"), RGB(0, 0, 0), _T("Verdana"), FONTF_BOLD, -13, LPGENT("Background")},
+ { LPGENT("User has joined"), RGB(90, 160, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("User has left"), RGB(160, 160, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("User has disconnected"), RGB(160, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("User kicked ..."), RGB(100, 100, 100), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("User is now known as ..."), RGB(90, 90, 160), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("Notice from user"), RGB(160, 130, 60), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("Incoming message"), RGB(90, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("Outgoing message"), RGB(90, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("The topic is ..."), RGB(70, 70, 160), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("Information messages"), RGB(130, 130, 195), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("User enables status for ..."), RGB(70, 150, 70), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("User disables status for ..."), RGB(150, 70, 70), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("Action message"), RGB(160, 90, 160), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("Highlighted message"), RGB(180, 150, 80), _T("Verdana"), 0, -13, LPGENT("Background")},
+ { LPGENT("Message typing area"), RGB(0, 0, 40), _T("Verdana"), 0, -14, LPGENT("Message background")},
+ { LPGENT("User list members (online)"), RGB(0,0, 0), _T("Verdana"), 0, -12, LPGENT("User list background")},
+ { LPGENT("User list members (away)"), RGB(170, 170, 170), _T("Verdana"), 0, -12, LPGENT("User list background")},
};
struct ColourOptionsList
@@ -114,11 +113,11 @@ struct ColourOptionsList }
static const colourOptionsList[] = {
- {LPGENT("Background"), SRMSGSET_BKGCOLOUR, 0, COLOR_WINDOW},
- {LPGENT("Input area background"), SRMSGSET_INPUTBKGCOLOUR, 0, COLOR_WINDOW},
- {LPGENT("Incoming background"), SRMSGSET_INCOMINGBKGCOLOUR, 0, COLOR_WINDOW},
- {LPGENT("Outgoing background"), SRMSGSET_OUTGOINGBKGCOLOUR, 0, COLOR_WINDOW},
- {LPGENT("Infobar background"), SRMSGSET_INFOBARBKGCOLOUR, 0, COLOR_3DLIGHT},
+ { LPGENT("Background"), SRMSGSET_BKGCOLOUR, 0, COLOR_WINDOW},
+ { LPGENT("Input area background"), SRMSGSET_INPUTBKGCOLOUR, 0, COLOR_WINDOW},
+ { LPGENT("Incoming background"), SRMSGSET_INCOMINGBKGCOLOUR, 0, COLOR_WINDOW},
+ { LPGENT("Outgoing background"), SRMSGSET_OUTGOINGBKGCOLOUR, 0, COLOR_WINDOW},
+ { LPGENT("Infobar background"), SRMSGSET_INFOBARBKGCOLOUR, 0, COLOR_3DLIGHT},
};
@@ -364,7 +363,7 @@ static void MarkChanges(int i, HWND hWnd) { static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
int limitLength;
int bChecked;
@@ -396,7 +395,7 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMES), bChecked );
EnableWindow(GetDlgItem(hwndDlg, IDC_SEPARATECHATSCONTAINERS), bChecked );
EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABS), bChecked );
- bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES);
+ bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES);
EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMESLEN), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHARS), bChecked);
bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS);
@@ -407,85 +406,83 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABSNUM), bChecked );
return TRUE;
}
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_USETABS:
- {
- int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SWITCHTOACTIVE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TABSATBOTTOM), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMES), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSSHOWTABS), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TABCLOSEBUTTON), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SEPARATECHATSCONTAINERS), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABS), bChecked);
- }
- case IDC_LIMITTABS:
- {
- int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABSNUM), bChecked);
- }
- case IDC_SEPARATECHATSCONTAINERS:
- {
- int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABS), bChecked);
- }
- case IDC_LIMITCHATSTABS:
- {
- int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS) &&
- IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABSNUM), bChecked);
- }
- case IDC_LIMITNAMES:
- {
- int bChecked = IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES) && IsDlgButtonChecked(hwndDlg, IDC_USETABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMESLEN), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHARS), bChecked);
- }
- break;
- case IDC_LIMITNAMESLEN:
- case IDC_LIMITTABSNUM:
- case IDC_LIMITCHATSTABSNUM:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return 0;
- break;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_USETABS:
+ {
+ int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SWITCHTOACTIVE), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TABSATBOTTOM), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMES), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSSHOWTABS), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TABCLOSEBUTTON), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SEPARATECHATSCONTAINERS), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABS), bChecked);
}
- MarkChanges(8, hwndDlg);
- break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- {
- int limitLength;
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USETABS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABSATBOTTOM));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES));
- (limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE)) >= SRMSGSET_LIMITNAMESLEN_MIN ? GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE) : SRMSGSET_LIMITNAMESLEN_MIN;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, limitLength);
-
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS));
- limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) : 1;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, limitLength);
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS));
- limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) : 1;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, limitLength);
-
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, (BYTE) !IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSHOWTABS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SWITCHTOACTIVE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABCLOSEBUTTON));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS));
-
- ApplyChanges(8);
- return TRUE;
- }
- }
- break;
+ case IDC_LIMITTABS:
+ {
+ int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABSNUM), bChecked);
+ }
+ case IDC_SEPARATECHATSCONTAINERS:
+ {
+ int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABS), bChecked);
+ }
+ case IDC_LIMITCHATSTABS:
+ {
+ int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS) &&
+ IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABSNUM), bChecked);
+ }
+ case IDC_LIMITNAMES:
+ {
+ int bChecked = IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES) && IsDlgButtonChecked(hwndDlg, IDC_USETABS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMESLEN), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHARS), bChecked);
}
break;
- case WM_DESTROY:
+ case IDC_LIMITNAMESLEN:
+ case IDC_LIMITTABSNUM:
+ case IDC_LIMITCHATSTABSNUM:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ return 0;
break;
+ }
+ MarkChanges(8, hwndDlg);
+ break;
+ case WM_NOTIFY:
+ switch (((LPNMHDR) lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ {
+ int limitLength;
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USETABS));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABSATBOTTOM));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES));
+ (limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE)) >= SRMSGSET_LIMITNAMESLEN_MIN ? GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE) : SRMSGSET_LIMITNAMESLEN_MIN;
+ DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, limitLength);
+
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS));
+ limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) : 1;
+ DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, limitLength);
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS));
+ limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) : 1;
+ DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, limitLength);
+
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, (BYTE) !IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSHOWTABS));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SWITCHTOACTIVE));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABCLOSEBUTTON));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS));
+
+ ApplyChanges(8);
+ return TRUE;
+ }
+ }
+ break;
+ }
+ break;
}
return FALSE;
}
@@ -493,7 +490,7 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
char str[10];
int bChecked;
@@ -536,73 +533,75 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar CheckDlgButton(hwndDlg, IDC_STATUSWIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON));
CheckDlgButton(hwndDlg, IDC_SHOWPROGRESS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS));
CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat->flags&SMF_AVATAR);
- return TRUE;
+ return TRUE;
}
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_TRANSPARENCY:
- if (pSetLayeredWindowAttributes != NULL) {
- int bChecked = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYVALUE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYPERC), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYVALUE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYPERC), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT1), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT2), bChecked);
- }
- break;
-
- case IDC_INPUTLINES:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return 0;
- break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_TRANSPARENCY:
+ if (pSetLayeredWindowAttributes != NULL) {
+ int bChecked = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYVALUE), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYPERC), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYVALUE), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYPERC), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT1), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT2), bChecked);
}
- MarkChanges(16, hwndDlg);
break;
- case WM_HSCROLL:
- { char str[10];
- sprintf(str,"%d%%",(int)(100*SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0)/256));
- SetDlgItemTextA(hwndDlg, IDC_ATRANSPARENCYPERC, str);
- sprintf(str,"%d%%",(int)(100*SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0)/256));
- SetDlgItemTextA(hwndDlg, IDC_ITRANSPARENCYPERC, str);
- MarkChanges(16, hwndDlg);
- }
+
+ case IDC_INPUTLINES:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ return 0;
break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- {
- UINT lines;
-
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSBAR));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTOOLBAR));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOBAR));
-
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY));
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0));
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0));
-
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWPROGRESS));
-
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT));
-
- lines = GetDlgItemInt(hwndDlg, IDC_INPUTLINES, NULL, FALSE);
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, lines ? lines : SRMSGDEFSET_AUTORESIZELINES);
- LoadInfobarFonts();
-
- ApplyChanges(16);
- return TRUE;
- }
- }
- break;
+ }
+ MarkChanges(16, hwndDlg);
+ break;
+
+ case WM_HSCROLL:
+ {
+ char str[10];
+ sprintf(str,"%d%%",(int)(100*SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0)/256));
+ SetDlgItemTextA(hwndDlg, IDC_ATRANSPARENCYPERC, str);
+ sprintf(str,"%d%%",(int)(100*SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0)/256));
+ SetDlgItemTextA(hwndDlg, IDC_ITRANSPARENCYPERC, str);
+ MarkChanges(16, hwndDlg);
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR) lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ {
+ UINT lines;
+
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSBAR));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTOOLBAR));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOBAR));
+
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY));
+ DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0));
+ DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0));
+
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWPROGRESS));
+
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT));
+
+ lines = GetDlgItemInt(hwndDlg, IDC_INPUTLINES, NULL, FALSE);
+ DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, lines ? lines : SRMSGDEFSET_AUTORESIZELINES);
+ LoadInfobarFonts();
+
+ ApplyChanges(16);
+ return TRUE;
+ }
}
break;
- case WM_DESTROY:
- break;
+ }
+ break;
}
return FALSE;
}
@@ -610,13 +609,13 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
{
DWORD msgTimeout;
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE, (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE) & ~WS_BORDER) | TVS_NOHSCROLL | TVS_CHECKBOXES);
FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, sizeof(statusValues) / sizeof(statusValues[0]),
- DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
+ DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
CheckDlgButton(hwndDlg, IDC_AUTOPOPUP, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP));
CheckDlgButton(hwndDlg, IDC_STAYMINIMIZED, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED));
CheckDlgButton(hwndDlg, IDC_AUTOMIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN));
@@ -626,311 +625,308 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP msgTimeout = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
SetDlgItemInt(hwndDlg, IDC_SECONDS, msgTimeout >= SRMSGSET_MSGTIMEOUT_MIN ? msgTimeout / 1000 : SRMSGDEFSET_MSGTIMEOUT / 1000, FALSE);
- CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT));
+ CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT));
CheckDlgButton(hwndDlg, IDC_CASCADE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE));
CheckDlgButton(hwndDlg, IDC_SENDONENTER, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER));
CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER));
CheckDlgButton(hwndDlg, IDC_STATUSWIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON));
- CheckDlgButton(hwndDlg, IDC_HIDECONTAINERS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, SRMSGDEFSET_HIDECONTAINERS));
+ CheckDlgButton(hwndDlg, IDC_HIDECONTAINERS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, SRMSGDEFSET_HIDECONTAINERS));
EnableWindow(GetDlgItem(hwndDlg, IDC_STAYMINIMIZED), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
EnableWindow(GetDlgItem(hwndDlg, IDC_POPLIST), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
- return TRUE;
+ return TRUE;
}
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_AUTOPOPUP:
- EnableWindow(GetDlgItem(hwndDlg, IDC_STAYMINIMIZED), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
- EnableWindow(GetDlgItem(hwndDlg, IDC_POPLIST), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
- break;
- case IDC_AUTOMIN:
- break;
- case IDC_SECONDS:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return 0;
- break;
- case IDC_SENDONENTER:
- CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, BST_UNCHECKED);
- break;
- case IDC_SENDONDBLENTER:
- CheckDlgButton(hwndDlg, IDC_SENDONENTER, BST_UNCHECKED);
- break;
- case IDC_CASCADE:
- CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, BST_UNCHECKED);
- break;
- case IDC_SAVEPERCONTACT:
- CheckDlgButton(hwndDlg, IDC_CASCADE, BST_UNCHECKED);
- break;
- }
- MarkChanges(2, hwndDlg);
- break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case IDC_POPLIST:
- if (((LPNMHDR) lParam)->code == NM_CLICK) {
- TVHITTESTINFO hti;
- hti.pt.x = (short) LOWORD(GetMessagePos());
- hti.pt.y = (short) HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR) lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR) lParam)->hwndFrom, &hti))
- if (hti.flags & TVHT_ONITEMSTATEICON) {
- TVITEM tvi;
- tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvi.hItem = hti.hItem;
- TreeView_GetItem(((LPNMHDR) lParam)->hwndFrom, &tvi);
- tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1;
- TreeView_SetItem(((LPNMHDR) lParam)->hwndFrom, &tvi);
- MarkChanges(2, hwndDlg);
- }
- } else if (((LPNMHDR) lParam)->code == TVN_KEYDOWN) {
- if (((LPNMTVKEYDOWN) lParam)->wVKey == VK_SPACE) {
- MarkChanges(2, hwndDlg);
- }
- }
- break;
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- {
- DWORD msgTimeout;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST)));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STAYMINIMIZED));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEDRAFTS));
-
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_DELTEMP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DELTEMP));
- msgTimeout = GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) >= SRMSGSET_MSGTIMEOUT_MIN / 1000 ? GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) * 1000 : SRMSGDEFSET_MSGTIMEOUT;
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout);
-
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_CASCADE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CASCADE));
-
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDECONTAINERS));
-
- ApplyChanges(2);
-
- return TRUE;
- }
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_AUTOPOPUP:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STAYMINIMIZED), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_POPLIST), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
+ break;
+ case IDC_AUTOMIN:
+ break;
+ case IDC_SECONDS:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ return 0;
+ break;
+ case IDC_SENDONENTER:
+ CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, BST_UNCHECKED);
+ break;
+ case IDC_SENDONDBLENTER:
+ CheckDlgButton(hwndDlg, IDC_SENDONENTER, BST_UNCHECKED);
+ break;
+ case IDC_CASCADE:
+ CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, BST_UNCHECKED);
+ break;
+ case IDC_SAVEPERCONTACT:
+ CheckDlgButton(hwndDlg, IDC_CASCADE, BST_UNCHECKED);
+ break;
+ }
+ MarkChanges(2, hwndDlg);
+ break;
+ case WM_NOTIFY:
+ switch (((LPNMHDR) lParam)->idFrom) {
+ case IDC_POPLIST:
+ if (((LPNMHDR) lParam)->code == NM_CLICK) {
+ TVHITTESTINFO hti;
+ hti.pt.x = (short) LOWORD(GetMessagePos());
+ hti.pt.y = (short) HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR) lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR) lParam)->hwndFrom, &hti))
+ if (hti.flags & TVHT_ONITEMSTATEICON) {
+ TVITEM tvi;
+ tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ tvi.hItem = hti.hItem;
+ TreeView_GetItem(((LPNMHDR) lParam)->hwndFrom, &tvi);
+ tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1;
+ TreeView_SetItem(((LPNMHDR) lParam)->hwndFrom, &tvi);
+ MarkChanges(2, hwndDlg);
}
- break;
+ } else if (((LPNMHDR) lParam)->code == TVN_KEYDOWN) {
+ if (((LPNMTVKEYDOWN) lParam)->wVKey == VK_SPACE) {
+ MarkChanges(2, hwndDlg);
+ }
}
break;
- case WM_DESTROY:
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ {
+ DWORD msgTimeout;
+ DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST)));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STAYMINIMIZED));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEDRAFTS));
+
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_DELTEMP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DELTEMP));
+ msgTimeout = GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) >= SRMSGSET_MSGTIMEOUT_MIN / 1000 ? GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) * 1000 : SRMSGDEFSET_MSGTIMEOUT;
+ DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout);
+
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_CASCADE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CASCADE));
+
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDECONTAINERS));
+
+ ApplyChanges(2);
+
+ return TRUE;
+ }
+ }
break;
+ }
+ break;
}
return FALSE;
}
static void ShowPreview(HWND hwndDlg)
{
- struct GlobalMessageData gdat = { 0 };
+ struct GlobalMessageData gdat = { 0 };
PARAFORMAT2 pf2;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_SHOWLOGICONS) ? SMF_SHOWICONS : 0;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES) ? 0 : SMF_HIDENAMES;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES) ? SMF_SHOWTIME : 0;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_SHOWSECONDS) ? SMF_SHOWSECONDS : 0;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) ? SMF_SHOWDATE : 0;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_USELONGDATE) ? SMF_LONGDATE : 0;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_USERELATIVEDATE) ? SMF_RELATIVEDATE : 0;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES) ? SMF_GROUPMESSAGES : 0;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_MARKFOLLOWUPS) ? SMF_MARKFOLLOWUPS : 0;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_MESSAGEONNEWLINE) ? SMF_MSGONNEWLINE : 0;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES) ? SMF_DRAWLINES : 0;
- gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT) ? SMF_INDENTTEXT : 0;
- gdat.logLineColour = SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_GETCOLOUR, 0, 0);
- gdat.indentSize = (int) SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_GETPOS, 0, 0);
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_SHOWLOGICONS) ? SMF_SHOWICONS : 0;
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES) ? 0 : SMF_HIDENAMES;
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES) ? SMF_SHOWTIME : 0;
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_SHOWSECONDS) ? SMF_SHOWSECONDS : 0;
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) ? SMF_SHOWDATE : 0;
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_USELONGDATE) ? SMF_LONGDATE : 0;
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_USERELATIVEDATE) ? SMF_RELATIVEDATE : 0;
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES) ? SMF_GROUPMESSAGES : 0;
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_MARKFOLLOWUPS) ? SMF_MARKFOLLOWUPS : 0;
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_MESSAGEONNEWLINE) ? SMF_MSGONNEWLINE : 0;
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES) ? SMF_DRAWLINES : 0;
+ gdat.flags |= IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT) ? SMF_INDENTTEXT : 0;
+ gdat.logLineColour = SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_GETCOLOUR, 0, 0);
+ gdat.indentSize = (int) SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_GETPOS, 0, 0);
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_OFFSET;
pf2.dxOffset = (gdat.flags & SMF_INDENTTEXT) ? gdat.indentSize * 1440 /g_dat->logPixelSX : 0;
SetDlgItemText(hwndDlg, IDC_LOG, _T(""));
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- StreamInTestEvents(GetDlgItem(hwndDlg, IDC_LOG), &gdat);
+ StreamInTestEvents(GetDlgItem(hwndDlg, IDC_LOG), &gdat);
}
static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_LOG));
- switch (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
- case LOADHISTORY_UNREAD:
- CheckDlgButton(hwndDlg, IDC_LOADUNREAD, BST_CHECKED);
- break;
- case LOADHISTORY_COUNT:
- CheckDlgButton(hwndDlg, IDC_LOADCOUNT, BST_CHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTN), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTSPIN), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTTEXT2), TRUE);
- break;
- case LOADHISTORY_TIME:
- CheckDlgButton(hwndDlg, IDC_LOADTIME, BST_CHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMEN), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMESPIN), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STMINSOLD), TRUE);
- break;
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_LOG));
+ switch (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
+ case LOADHISTORY_UNREAD:
+ CheckDlgButton(hwndDlg, IDC_LOADUNREAD, BST_CHECKED);
+ break;
+ case LOADHISTORY_COUNT:
+ CheckDlgButton(hwndDlg, IDC_LOADCOUNT, BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTN), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTSPIN), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTTEXT2), TRUE);
+ break;
+ case LOADHISTORY_TIME:
+ CheckDlgButton(hwndDlg, IDC_LOADTIME, BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMEN), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMESPIN), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STMINSOLD), TRUE);
+ break;
+ }
+ SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
+ SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT));
+ SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(12 * 60, 0));
+ SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME));
+
+ CheckDlgButton(hwndDlg, IDC_SHOWLOGICONS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS));
+ CheckDlgButton(hwndDlg, IDC_SHOWNAMES, !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES));
+ CheckDlgButton(hwndDlg, IDC_SHOWTIMES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME));
+ CheckDlgButton(hwndDlg, IDC_SHOWSECONDS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, SRMSGDEFSET_SHOWSECONDS));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSECONDS), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWDATES), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
+ CheckDlgButton(hwndDlg, IDC_SHOWDATES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE));
+ CheckDlgButton(hwndDlg, IDC_USELONGDATE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USELONGDATE, SRMSGDEFSET_USELONGDATE));
+ CheckDlgButton(hwndDlg, IDC_USERELATIVEDATE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, SRMSGDEFSET_USERELATIVEDATE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_USELONGDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_USERELATIVEDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
+
+ if (!ServiceExists(MS_IEVIEW_WINDOW)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_USEIEVIEW), FALSE);
+ }
+ CheckDlgButton(hwndDlg, IDC_USEIEVIEW, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW));
+
+ CheckDlgButton(hwndDlg, IDC_GROUPMESSAGES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MARKFOLLOWUPS), IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES));
+ CheckDlgButton(hwndDlg, IDC_MARKFOLLOWUPS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, SRMSGDEFSET_MARKFOLLOWUPS));
+ CheckDlgButton(hwndDlg, IDC_MESSAGEONNEWLINE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, SRMSGDEFSET_MESSAGEONNEWLINE));
+ CheckDlgButton(hwndDlg, IDC_DRAWLINES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_DRAWLINES, SRMSGDEFSET_DRAWLINES));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LINECOLOUR), IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES));
+
+ CheckDlgButton(hwndDlg, IDC_INDENTTEXT, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_INDENTSIZE), IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_INDENTSPIN), IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
+ SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
+ SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE));
+
+ CheckDlgButton(hwndDlg, IDC_SHOWSTATUSCHANGES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH));
+
+ SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR));
+ {
+ PARAFORMAT2 pf2;
+ ZeroMemory((void *)&pf2, sizeof(pf2));
+ pf2.cbSize = sizeof(pf2);
+ pf2.dwMask = PFM_OFFSETINDENT | PFM_RIGHTINDENT;
+ pf2.dxStartIndent = 30;
+ pf2.dxRightIndent = 30;
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0,0));
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, (WPARAM) TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM) & reOleCallback);
+ }
+ ShowPreview(hwndDlg);
+ return TRUE;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_FONTSCOLORS:
+ {
+ OPENOPTIONSDIALOG ood;
+ ood.cbSize = sizeof(ood);
+ ood.pszGroup = "Customize";
+ ood.pszPage = "Fonts & Colors";
+ ood.pszTab = NULL;
+ Options_Open(&ood);
}
- SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0));
- SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT));
- SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(12 * 60, 0));
- SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME));
-
- CheckDlgButton(hwndDlg, IDC_SHOWLOGICONS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS));
- CheckDlgButton(hwndDlg, IDC_SHOWNAMES, !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES));
- CheckDlgButton(hwndDlg, IDC_SHOWTIMES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME));
- CheckDlgButton(hwndDlg, IDC_SHOWSECONDS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, SRMSGDEFSET_SHOWSECONDS));
+ break;
+ case IDC_LOADCOUNT:
+ case IDC_LOADTIME:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTN), IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTSPIN), IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTTEXT2), IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMEN), IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STMINSOLD), IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
+ break;
+ case IDC_SHOWTIMES:
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSECONDS), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWDATES), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- CheckDlgButton(hwndDlg, IDC_SHOWDATES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE));
- CheckDlgButton(hwndDlg, IDC_USELONGDATE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USELONGDATE, SRMSGDEFSET_USELONGDATE));
- CheckDlgButton(hwndDlg, IDC_USERELATIVEDATE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, SRMSGDEFSET_USERELATIVEDATE));
+ case IDC_SHOWDATES:
EnableWindow(GetDlgItem(hwndDlg, IDC_USELONGDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
EnableWindow(GetDlgItem(hwndDlg, IDC_USERELATIVEDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
-
- if (!ServiceExists(MS_IEVIEW_WINDOW)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_USEIEVIEW), FALSE);
- }
- CheckDlgButton(hwndDlg, IDC_USEIEVIEW, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW));
-
- CheckDlgButton(hwndDlg, IDC_GROUPMESSAGES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES));
+ case IDC_SHOWNAMES:
+ case IDC_SHOWSECONDS:
+ case IDC_USELONGDATE:
+ case IDC_USERELATIVEDATE:
+ case IDC_LINECOLOUR:
+ case IDC_MARKFOLLOWUPS:
+ case IDC_SHOWLOGICONS:
+ case IDC_MESSAGEONNEWLINE:
+ ShowPreview(hwndDlg);
+ break;
+ case IDC_GROUPMESSAGES:
EnableWindow(GetDlgItem(hwndDlg, IDC_MARKFOLLOWUPS), IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES));
- CheckDlgButton(hwndDlg, IDC_MARKFOLLOWUPS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, SRMSGDEFSET_MARKFOLLOWUPS));
- CheckDlgButton(hwndDlg, IDC_MESSAGEONNEWLINE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, SRMSGDEFSET_MESSAGEONNEWLINE));
- CheckDlgButton(hwndDlg, IDC_DRAWLINES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_DRAWLINES, SRMSGDEFSET_DRAWLINES));
+ ShowPreview(hwndDlg);
+ break;
+ case IDC_DRAWLINES:
EnableWindow(GetDlgItem(hwndDlg, IDC_LINECOLOUR), IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES));
-
- CheckDlgButton(hwndDlg, IDC_INDENTTEXT, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT));
+ ShowPreview(hwndDlg);
+ break;
+ case IDC_INDENTTEXT:
EnableWindow(GetDlgItem(hwndDlg, IDC_INDENTSIZE), IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
EnableWindow(GetDlgItem(hwndDlg, IDC_INDENTSPIN), IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
- SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_SETRANGE, 0, MAKELONG(999, 0));
- SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE));
-
- CheckDlgButton(hwndDlg, IDC_SHOWSTATUSCHANGES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH));
-
- SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR));
- {
- PARAFORMAT2 pf2;
- ZeroMemory((void *)&pf2, sizeof(pf2));
- pf2.cbSize = sizeof(pf2);
- pf2.dwMask = PFM_OFFSETINDENT | PFM_RIGHTINDENT;
- pf2.dxStartIndent = 30;
- pf2.dxRightIndent = 30;
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0,0));
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_AUTOURLDETECT, (WPARAM) TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM) & reOleCallback);
- }
ShowPreview(hwndDlg);
- return TRUE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_FONTSCOLORS:
- {
- OPENOPTIONSDIALOG ood;
- ood.cbSize = sizeof(ood);
- ood.pszGroup = "Customize";
- ood.pszPage = "Fonts & Colors";
- ood.pszTab = NULL;
- Options_Open(&ood);
- }
- break;
- case IDC_LOADCOUNT:
- case IDC_LOADTIME:
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTN), IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTSPIN), IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTTEXT2), IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT));
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMEN), IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
- EnableWindow(GetDlgItem(hwndDlg, IDC_STMINSOLD), IsDlgButtonChecked(hwndDlg, IDC_LOADTIME));
- break;
- case IDC_SHOWTIMES:
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSECONDS), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWDATES), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- case IDC_SHOWDATES:
- EnableWindow(GetDlgItem(hwndDlg, IDC_USELONGDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- EnableWindow(GetDlgItem(hwndDlg, IDC_USERELATIVEDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- case IDC_SHOWNAMES:
- case IDC_SHOWSECONDS:
- case IDC_USELONGDATE:
- case IDC_USERELATIVEDATE:
- case IDC_LINECOLOUR:
- case IDC_MARKFOLLOWUPS:
- case IDC_SHOWLOGICONS:
- case IDC_MESSAGEONNEWLINE:
- ShowPreview(hwndDlg);
- break;
- case IDC_GROUPMESSAGES:
- EnableWindow(GetDlgItem(hwndDlg, IDC_MARKFOLLOWUPS), IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES));
- ShowPreview(hwndDlg);
- break;
- case IDC_DRAWLINES:
- EnableWindow(GetDlgItem(hwndDlg, IDC_LINECOLOUR), IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES));
- ShowPreview(hwndDlg);
- break;
- case IDC_INDENTTEXT:
- EnableWindow(GetDlgItem(hwndDlg, IDC_INDENTSIZE), IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
- EnableWindow(GetDlgItem(hwndDlg, IDC_INDENTSPIN), IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
- ShowPreview(hwndDlg);
- break;
- case IDC_INDENTSIZE:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return TRUE;
- ShowPreview(hwndDlg);
- break;
- case IDC_LOADCOUNTN:
- case IDC_LOADTIMEN:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
- return TRUE;
- break;
- }
- MarkChanges(4, hwndDlg);
break;
- case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR) lParam)->code) {
- case PSN_APPLY:
- if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT))
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
- else if (IsDlgButtonChecked(hwndDlg, IDC_LOADTIME))
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
- else
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
- DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWLOGICONS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSECONDS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USELONGDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USELONGDATE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USERELATIVEDATE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSCHANGES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MARKFOLLOWUPS));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MESSAGEONNEWLINE));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_DRAWLINES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES));
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_GETCOLOUR, 0, 0));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USEIEVIEW));
- DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
- DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, (WORD) SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_GETPOS, 0, 0));
-
- FreeMsgLogIcons();
- LoadMsgLogIcons();
- ApplyChanges(4);
- return TRUE;
- }
- break;
- }
+ case IDC_INDENTSIZE:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ return TRUE;
+ ShowPreview(hwndDlg);
break;
- case WM_DESTROY:
+ case IDC_LOADCOUNTN:
+ case IDC_LOADTIMEN:
+ if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ return TRUE;
break;
+ }
+ MarkChanges(4, hwndDlg);
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR) lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR) lParam)->code) {
+ case PSN_APPLY:
+ if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT))
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT);
+ else if (IsDlgButtonChecked(hwndDlg, IDC_LOADTIME))
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME);
+ else
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD);
+ DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0));
+ DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWLOGICONS));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSECONDS));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USELONGDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USELONGDATE));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USERELATIVEDATE));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSCHANGES));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MARKFOLLOWUPS));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MESSAGEONNEWLINE));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_DRAWLINES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES));
+ DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_GETCOLOUR, 0, 0));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USEIEVIEW));
+ DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_INDENTTEXT));
+ DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, (WORD) SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_GETPOS, 0, 0));
+
+ FreeMsgLogIcons();
+ LoadMsgLogIcons();
+ ApplyChanges(4);
+ return TRUE;
+ }
+ break;
+ }
+ break;
}
return FALSE;
}
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 31d5bdddac..05674e29a7 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -25,8 +25,7 @@ WNDPROC mainProc; HANDLE
hServiceOpenManager, hServiceShowFavMenu, hServiceCloseCurrentSession, hServiceSaveUserSession,
- hServiceLoadLastSession, hmSaveCurrentSession, hmLoadLastSession, hmLoadSession, hmSessionsManager,
- hibSessions, hibSessionsLoad, hibSessionsSave, hibSessionsLoadLast, hibChecked, hibNotChecked;
+ hServiceLoadLastSession, hmSaveCurrentSession, hmLoadLastSession, hmLoadSession, hmSessionsManager;
HANDLE hmTBButton[2],hiTBbutton[2],iTBbutton[2];
@@ -73,6 +72,15 @@ PLUGININFOEX pluginInfo = { { 0x60558872, 0x2aab, 0x45aa, { 0x88, 0x8d, 0x9, 0x76, 0x91, 0xc9, 0xb6, 0x83 } }
};
+IconItem iconList[] =
+{
+ { LPGEN("Sessions"), "Sessions", IDD_SESSION_CHECKED },
+ { LPGEN("Favorite Session"), "SessionMarked", IDD_SESSION_CHECKED },
+ { LPGEN("Not favorite Session"), "SessionUnMarked", IDD_SESSION_UNCHECKED },
+ { LPGEN("Load Session"), "SessionsLoad", IDI_SESSIONS_LOAD },
+ { LPGEN("Save Session"), "SessionsSave", IDD_SESSIONS_SAVE },
+ { LPGEN("Load last Session"), "SessionsLoadLast", IDD_SESSIONS_LOADLAST }
+};
INT_PTR CALLBACK ExitDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
@@ -849,22 +857,22 @@ static int CreateButtons(WPARAM wparam,LPARAM lparam) button.pszService = MS_SESSIONS_OPENMANAGER;
button.pszTooltipUp = button.name = LPGEN("Open Sessions Manager");
- button.hIconHandleUp = hibSessionsLoad;
+ button.hIconHandleUp = iconList[3].hIcolib;
TopToolbar_AddButton(&button);
button.pszService = MS_SESSIONS_SAVEUSERSESSION;
button.pszTooltipUp = button.name = LPGEN("Save Session");
- button.hIconHandleUp = hibSessionsSave;
+ button.hIconHandleUp = iconList[4].hIcolib;
TopToolbar_AddButton(&button);
button.pszService = MS_SESSIONS_RESTORELASTSESSION;
button.pszTooltipUp = button.name = LPGEN("Restore Last Session");
- button.hIconHandleUp = hibSessionsLoadLast;
+ button.hIconHandleUp = iconList[5].hIcolib;
TopToolbar_AddButton(&button);
button.pszService = MS_SESSIONS_SHOWFAVORITESMENU;
button.pszTooltipUp = button.name = LPGEN("Show Favorite Sessions Menu");
- button.hIconHandleUp = hibChecked;
+ button.hIconHandleUp = iconList[1].hIcolib;
TopToolbar_AddButton(&button);
return 0;
}
@@ -951,12 +959,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) Hotkey_Register(&hkd);
// Icons
- hibSessions = AddIcon("Sessions", LPGEN("Sessions"), IDD_SESSION_CHECKED);
- hibChecked = AddIcon("SessionMarked", LPGEN("Favorite Session"), IDD_SESSION_CHECKED);
- hibNotChecked = AddIcon("SessionUnMarked", LPGEN("Not favorite Session"), IDD_SESSION_UNCHECKED);
- hibSessionsLoad = AddIcon("SessionsLoad", LPGEN("Load Session"), IDI_SESSIONS_LOAD);
- hibSessionsSave = AddIcon("SessionsSave", LPGEN("Save Session"), IDD_SESSIONS_SAVE);
- hibSessionsLoadLast = AddIcon("SessionsLoadLast", LPGEN("Load last Session"), IDD_SESSIONS_LOADLAST);
+ Icon_Register(hinstance, __INTERNAL_NAME, iconList, SIZEOF(iconList));
// Main menu
CLISTMENUITEM cl = { sizeof(cl) };
@@ -965,13 +968,13 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) cl.ptszName = _T("Save session...");
cl.ptszPopupName = _T("Sessions Manager");
- cl.icolibItem = hibSessions;
+ cl.icolibItem = iconList[0].hIcolib;
cl.pszService = MS_SESSIONS_SAVEUSERSESSION;
hmSaveCurrentSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Load session...");
cl.pszService = MS_SESSIONS_OPENMANAGER;
- cl.icolibItem = hibSessionsLoad;
+ cl.icolibItem = iconList[3].hIcolib;
hmLoadLastSession = Menu_AddMainMenuItem(&cl);
cl.ptszName = _T("Close session");
@@ -981,14 +984,14 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) cl.ptszName = _T("Load last session");
cl.pszService = MS_SESSIONS_RESTORELASTSESSION;
- cl.icolibItem = hibSessionsLoadLast;
+ cl.icolibItem = iconList[5].hIcolib;
cl.position = 10100000;
hmLoadSession = Menu_AddMainMenuItem(&cl);
ZeroMemory(&cl, sizeof(cl));
cl.cbSize = sizeof(cl);
cl.flags = CMIM_ICON;
- cl.icolibItem = hibSessionsSave;
+ cl.icolibItem = iconList[4].hIcolib;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hmSaveCurrentSession, (LPARAM)&cl);
return 0;
diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index 7c6d545225..d5295453fb 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "sessions.h"
HICON hIcon;
@@ -177,8 +176,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) g_opHdlg=hdlg;
bOptionsInit=TRUE;
TranslateDialogDefault(hdlg);
- hMarked = Skin_GetIconByHandle(hibChecked);
- hNotMarked = Skin_GetIconByHandle(hibNotChecked);
+ hMarked = Skin_GetIconByHandle(iconList[1].hIcolib);
+ hNotMarked = Skin_GetIconByHandle(iconList[2].hIcolib);
hIcon=(bChecked=IsMarkedUserDefSession(opses_count))?hMarked:hNotMarked;
diff --git a/plugins/Sessions/Src/Sessions.h b/plugins/Sessions/Src/Sessions.h index 11883cae42..f775892dea 100644 --- a/plugins/Sessions/Src/Sessions.h +++ b/plugins/Sessions/Src/Sessions.h @@ -46,8 +46,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "Version.h"
#include "Resource.h"
-extern HANDLE hibChecked;
-extern HANDLE hibNotChecked;
+extern IconItem iconList[];
#define MIIM_STRING 0x00000040
@@ -75,7 +74,6 @@ extern BOOL g_bIncompletedSave; #define TIMERID_SHOW 11
#define TIMERID_REBUILDAFTER 14
-
#define SESSIONS_NAME "sessions"
diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index 97c1d7dc95..dada08333d 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -526,22 +526,6 @@ BYTE IsMarkedUserDefSession(int ses_count) return DBGetContactSettingByte(NULL, __INTERNAL_NAME, szSessionName, 0);
}
-HANDLE AddIcon(char *name, char *description, int idx)
-{
- TCHAR tszPath[MAX_PATH];
- GetModuleFileName(hinstance, tszPath, SIZEOF(tszPath));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.pszSection = __INTERNAL_NAME;
- sid.cx = sid.cy = 16;
- sid.pszDescription = description;
- sid.pszName = name;
- sid.ptszDefaultFile = tszPath;
- sid.iDefaultIndex = -idx;
- return Skin_AddIcon( &sid);
-}
-
void SavePosition(HWND hwnd, char *wndName)
{
RECT rc;
diff --git a/plugins/Sessions/Src/Utils.h b/plugins/Sessions/Src/Utils.h index 3e044a4d17..2dc9cbb733 100644 --- a/plugins/Sessions/Src/Utils.h +++ b/plugins/Sessions/Src/Utils.h @@ -33,7 +33,6 @@ int CheckForDuplicate(DWORD contact_list[],DWORD lparam); BOOL ResaveSettings(char* szName,int iFirst,int iLimit,TCHAR* pszPrevSetting);
void OffsetWindow(HWND parent, HWND hwnd, int dx, int dy);
int LoadSessionToCombobox (HWND hdlg,BOOL mode,int iLimit,char* pszSetting,int iFirstNum);
-HANDLE AddIcon(char *name, char *description, int idx);
int MarkUserDefSession(int ses_count,BYTE bCheck);
BYTE IsMarkedUserDefSession(int ses_count);
void SavePosition(HWND hWnd, char *wndName);
diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index 0f50b6d15a..c4954e77dd 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -462,32 +462,32 @@ int LoadAwayMsgModule(void) CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_TCHAR;
- CreateServiceFunctionEx(MS_AWAYMSG_SHOWAWAYMSG, GetMessageCommand);
+ CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetMessageCommand);
mi.position = -2000005000;
mi.ptszName = LPGENT("Re&ad Away Message");
mi.pszService = MS_AWAYMSG_SHOWAWAYMSG;
hAwayMsgMenuItem = Menu_AddContactMenuItem(&mi);
mi.flags |= CMIF_ICONFROMICOLIB;
- CreateServiceFunctionEx(MS_SIMPLESTATUSMSG_COPYMSG, CopyAwayMsgCommand);
+ CreateServiceFunction(MS_SIMPLESTATUSMSG_COPYMSG, CopyAwayMsgCommand);
mi.position = -2000006000;
mi.icolibItem = GetIconHandle(IDI_COPY);
mi.ptszName = LPGENT("Copy Away Message");
mi.pszService = MS_SIMPLESTATUSMSG_COPYMSG;
hCopyMsgMenuItem = Menu_AddContactMenuItem(&mi);
- CreateServiceFunctionEx(MS_SIMPLESTATUSMSG_GOTOURLMSG, GoToURLMsgCommand);
+ CreateServiceFunction(MS_SIMPLESTATUSMSG_GOTOURLMSG, GoToURLMsgCommand);
mi.position = -2000007000;
mi.icolibItem = GetIconHandle(IDI_GOTOURL);
mi.ptszName = LPGENT("&Go to URL in Away Message");
mi.pszService = MS_SIMPLESTATUSMSG_GOTOURLMSG;
hGoToURLMenuItem = Menu_AddContactMenuItem(&mi);
- HookEventEx(ME_CLIST_PREBUILDCONTACTMENU, AwayMsgPreBuildMenu);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, AwayMsgPreBuildMenu);
// Deprecated SimpleAway services
- CreateServiceFunctionEx(MS_SA_COPYAWAYMSG, CopyAwayMsgCommand);
- CreateServiceFunctionEx(MS_SA_GOTOURLMSG, GoToURLMsgCommand);
+ CreateServiceFunction(MS_SA_COPYAWAYMSG, CopyAwayMsgCommand);
+ CreateServiceFunction(MS_SA_GOTOURLMSG, GoToURLMsgCommand);
return 0;
}
diff --git a/plugins/SimpleStatusMsg/src/commonheaders.h b/plugins/SimpleStatusMsg/src/commonheaders.h index 2fd1426354..843a3555fa 100644 --- a/plugins/SimpleStatusMsg/src/commonheaders.h +++ b/plugins/SimpleStatusMsg/src/commonheaders.h @@ -40,7 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <m_clist.h>
#include <m_clistint.h>
#include <m_skin.h>
-#include <m_system.h>
+#include <m_system_cpp.h>
#include <m_options.h>
#include <m_langpack.h>
#include <m_protosvc.h>
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index bbac07d69a..acabd42297 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -1970,16 +1970,16 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) LoadAwayMsgModule();
- HookEventEx(ME_TTB_MODULELOADED, AddTopToolbarButton);
+ HookEvent(ME_TTB_MODULELOADED, AddTopToolbarButton);
RegisterHotkey();
- HookEventEx(ME_OPT_INITIALISE, InitOptions);
+ HookEvent(ME_OPT_INITIALISE, InitOptions);
h_statusmodechange = HookEvent(ME_CLIST_STATUSMODECHANGE, ChangeStatusMessage);
- HookEventEx(ME_PROTO_ACK, ProcessProtoAck);
- HookEventEx(ME_IDLE_CHANGED, OnIdleChanged);
+ HookEvent(ME_PROTO_ACK, ProcessProtoAck);
+ HookEvent(ME_IDLE_CHANGED, OnIdleChanged);
- HookEventEx(ME_CLIST_PREBUILDSTATUSMENU, ChangeStatusMsgPrebuild);
+ HookEvent(ME_CLIST_PREBUILDSTATUSMENU, ChangeStatusMsgPrebuild);
ChangeStatusMsgPrebuild(0, 0);
if (ServiceExists(MS_VARS_REGISTERTOKEN))
@@ -2020,7 +2020,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) g_uUpdateMsgTimer = SetTimer(NULL, 0, DBGetContactSettingWord(NULL, "SimpleStatusMsg", "UpdateMsgInt", 10) * 1000, (TIMERPROC)UpdateMsgTimerProc);
if (ServiceExists(MS_CS_SETSTATUSEX))
- HookEventEx(ME_CS_STATUSCHANGEEX, CSStatusChange);
+ HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChange);
if (accounts->statusCount == 0)
return 0;
@@ -2122,48 +2122,47 @@ extern "C" int __declspec(dllexport) Load(void) accounts = (PROTOACCOUNTS *)mir_alloc(sizeof(PROTOACCOUNTS));
DBWriteContactSettingWord(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
- HookEventEx(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- HookEventEx(ME_PROTO_ACCLISTCHANGED, OnAccListChanged);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccListChanged);
- CreateServiceFunctionEx(MS_AWAYMSG_GETSTATUSMSG, sttGetAwayMessage);
- CreateServiceFunctionEx(MS_AWAYMSG_GETSTATUSMSGW, sttGetAwayMessageT);
+ CreateServiceFunction(MS_AWAYMSG_GETSTATUSMSG, sttGetAwayMessage);
+ CreateServiceFunction(MS_AWAYMSG_GETSTATUSMSGW, sttGetAwayMessageT);
- CreateServiceFunctionEx(MS_SIMPLESTATUSMSG_SETSTATUS, SetStatusModeFromExtern);
- CreateServiceFunctionEx(MS_SIMPLESTATUSMSG_SHOWDIALOG, ShowStatusMessageDialog);
- CreateServiceFunctionEx(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, ChangeStatusMsg);
- CreateServiceFunctionEx(MS_SIMPLESTATUSMSG_SHOWDIALOGINT, ShowStatusMessageDialogInternal); // internal use ONLY
+ CreateServiceFunction(MS_SIMPLESTATUSMSG_SETSTATUS, SetStatusModeFromExtern);
+ CreateServiceFunction(MS_SIMPLESTATUSMSG_SHOWDIALOG, ShowStatusMessageDialog);
+ CreateServiceFunction(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, ChangeStatusMsg);
+ CreateServiceFunction(MS_SIMPLESTATUSMSG_SHOWDIALOGINT, ShowStatusMessageDialogInternal); // internal use ONLY
// Deprecated SimpleAway services
- CreateServiceFunctionEx(MS_SA_ISSARUNNING, IsSARunning);
- CreateServiceFunctionEx(MS_SA_CHANGESTATUSMSG, ChangeStatusMsg);
- CreateServiceFunctionEx(MS_SA_TTCHANGESTATUSMSG, ShowStatusMessageDialogInternal);
- CreateServiceFunctionEx(MS_SA_SHOWSTATUSMSGDIALOG, ShowStatusMessageDialog);
- CreateServiceFunctionEx(MS_SA_SETSTATUSMODE, SetStatusModeFromExtern);
-
- CreateServiceFunctionEx(MS_SA_SETOFFLINESTATUS, SetOfflineStatus);
- CreateServiceFunctionEx(MS_SA_SETONLINESTATUS, SetOnlineStatus);
- CreateServiceFunctionEx(MS_SA_SETAWAYSTATUS, SetAwayStatus);
- CreateServiceFunctionEx(MS_SA_SETDNDSTATUS, SetDNDStatus);
- CreateServiceFunctionEx(MS_SA_SETNASTATUS, SetNAStatus);
- CreateServiceFunctionEx(MS_SA_SETOCCUPIEDSTATUS, SetOccupiedStatus);
- CreateServiceFunctionEx(MS_SA_SETFREECHATSTATUS, SetFreeChatStatus);
- CreateServiceFunctionEx(MS_SA_SETINVISIBLESTATUS, SetInvisibleStatus);
- CreateServiceFunctionEx(MS_SA_SETONTHEPHONESTATUS, SetOnThePhoneStatus);
- CreateServiceFunctionEx(MS_SA_SETOUTTOLUNCHSTATUS, SetOutToLunchStatus);
-
- HookEventEx(ME_SYSTEM_OKTOEXIT, OnOkToExit);
- HookEventEx(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
+ CreateServiceFunction(MS_SA_ISSARUNNING, IsSARunning);
+ CreateServiceFunction(MS_SA_CHANGESTATUSMSG, ChangeStatusMsg);
+ CreateServiceFunction(MS_SA_TTCHANGESTATUSMSG, ShowStatusMessageDialogInternal);
+ CreateServiceFunction(MS_SA_SHOWSTATUSMSGDIALOG, ShowStatusMessageDialog);
+ CreateServiceFunction(MS_SA_SETSTATUSMODE, SetStatusModeFromExtern);
+
+ CreateServiceFunction(MS_SA_SETOFFLINESTATUS, SetOfflineStatus);
+ CreateServiceFunction(MS_SA_SETONLINESTATUS, SetOnlineStatus);
+ CreateServiceFunction(MS_SA_SETAWAYSTATUS, SetAwayStatus);
+ CreateServiceFunction(MS_SA_SETDNDSTATUS, SetDNDStatus);
+ CreateServiceFunction(MS_SA_SETNASTATUS, SetNAStatus);
+ CreateServiceFunction(MS_SA_SETOCCUPIEDSTATUS, SetOccupiedStatus);
+ CreateServiceFunction(MS_SA_SETFREECHATSTATUS, SetFreeChatStatus);
+ CreateServiceFunction(MS_SA_SETINVISIBLESTATUS, SetInvisibleStatus);
+ CreateServiceFunction(MS_SA_SETONTHEPHONESTATUS, SetOnThePhoneStatus);
+ CreateServiceFunction(MS_SA_SETOUTTOLUNCHSTATUS, SetOutToLunchStatus);
+
+ HookEvent(ME_SYSTEM_OKTOEXIT, OnOkToExit);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
- UnhookEvents();
UnhookEvent(h_statusmodechange);
UnhookProtoEvents();
- DestroyServiceFunctionsEx();
+
mir_free(accounts);
#ifdef _DEBUG
diff --git a/plugins/SimpleStatusMsg/src/simplestatusmsg.h b/plugins/SimpleStatusMsg/src/simplestatusmsg.h index d66aba197c..95b3311273 100644 --- a/plugins/SimpleStatusMsg/src/simplestatusmsg.h +++ b/plugins/SimpleStatusMsg/src/simplestatusmsg.h @@ -90,12 +90,8 @@ void IconsInit(void); HICON LoadIconEx(const char* name);
HANDLE GetIconHandle(int iconId);
void ReleaseIconEx(const char* name);
-HANDLE HookEventEx(const char *szEvent, MIRANDAHOOK hookProc);
-void UnhookEvents(void);
HANDLE HookProtoEvent(const char *szModule, const char *szEvent, MIRANDAHOOKPARAM hookProc);
void UnhookProtoEvents(void);
-HANDLE CreateServiceFunctionEx(const char *name, MIRANDASERVICE serviceProc);
-void DestroyServiceFunctionsEx(void);
int GetRandom(int from, int to);
const TCHAR *GetDefaultMessage(int status);
const char *StatusModeToDbSetting(int status, const char *suffix);
diff --git a/plugins/SimpleStatusMsg/src/utils.cpp b/plugins/SimpleStatusMsg/src/utils.cpp index 7c706e7818..a6ff747867 100644 --- a/plugins/SimpleStatusMsg/src/utils.cpp +++ b/plugins/SimpleStatusMsg/src/utils.cpp @@ -20,49 +20,23 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "commonheaders.h"
#include "simplestatusmsg.h"
-static HANDLE *hHookList = NULL;
-static HANDLE *hProtoHookList = NULL;
-static HANDLE *hServiceList = NULL;
-static int HookCount = 0;
-static int ProtoHookCount = 0;
-static int ServiceCount = 0;
-
-struct
-{
- TCHAR *szDescr;
- char *szName;
- int defIconID;
- HANDLE hIcolib;
-}
-static iconList[] =
-{
- { LPGENT("Delete Selected"), "cross", IDI_CROSS },
- { LPGENT("Recent Message"), "recent", IDI_HISTORY },
- { LPGENT("Predefined Message"), "predef", IDI_MESSAGE },
- { LPGENT("Add to Predefined"), "add", IDI_PLUS },
- { LPGENT("Clear History"), "clear", IDI_CHIST },
- { LPGENT("Copy Away Message"), "copy", IDI_COPY },
- { LPGENT("Change Status Message"), "csmsg", IDI_CSMSG, },
- { LPGENT("Go to URL in Away Message"), "gotourl", IDI_GOTOURL }
+static LIST<void> arProtoHooks(5);
+
+static IconItem iconList[] =
+{
+ { LPGEN("Delete Selected"), "cross", IDI_CROSS },
+ { LPGEN("Recent Message"), "recent", IDI_HISTORY },
+ { LPGEN("Predefined Message"), "predef", IDI_MESSAGE },
+ { LPGEN("Add to Predefined"), "add", IDI_PLUS },
+ { LPGEN("Clear History"), "clear", IDI_CHIST },
+ { LPGEN("Copy Away Message"), "copy", IDI_COPY },
+ { LPGEN("Change Status Message"), "csmsg", IDI_CSMSG, },
+ { LPGEN("Go to URL in Away Message"), "gotourl", IDI_GOTOURL }
};
void IconsInit(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInst, szFile, SIZEOF(szFile));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszDefaultFile = szFile;
- sid.ptszSection = _T("Simple Status Message");
- for (int i = 0; i < SIZEOF(iconList); i++) {
- char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "SimpleStatusMsg_%s", iconList[i].szName);
- sid.pszName = szSettingName;
- sid.ptszDescription = (TCHAR*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIcolib = Skin_AddIcon(&sid);
- }
+ Icon_Register(g_hInst, "Simple Status Message", iconList, SIZEOF(iconList), "SimpleStatusMsg");
}
HICON LoadIconEx(const char* name)
@@ -88,55 +62,20 @@ void ReleaseIconEx(const char* name) Skin_ReleaseIcon(szSettingName);
}
-HANDLE HookEventEx(const char *szEvent, MIRANDAHOOK hookProc)
-{
- HookCount++;
- hHookList = (HANDLE *)mir_realloc(hHookList, sizeof(HANDLE) * HookCount);
- return hHookList[HookCount - 1] = HookEvent(szEvent, hookProc);
-}
-
-void UnhookEvents(void)
-{
- if (hHookList == NULL) return;
- for (int i = 0; i < HookCount; ++i)
- if (hHookList[i] != NULL) UnhookEvent(hHookList[i]);
- mir_free(hHookList);
- hHookList = NULL;
- HookCount = 0;
-}
-
HANDLE HookProtoEvent(const char *szModule, const char *szEvent, MIRANDAHOOKPARAM hookProc)
{
char szProtoEvent[MAXMODULELABELLENGTH];
mir_snprintf(szProtoEvent, sizeof(szProtoEvent), "%s%s", szModule, szEvent);
- ProtoHookCount++;
- hProtoHookList = (HANDLE *)mir_realloc(hProtoHookList, sizeof(HANDLE) * ProtoHookCount);
- return hProtoHookList[ProtoHookCount - 1] = HookEventParam(szProtoEvent, hookProc, (LPARAM)szModule);
+ HANDLE res = HookEventParam(szProtoEvent, hookProc, (LPARAM)szModule);
+ arProtoHooks.insert(res);
+ return res;
}
void UnhookProtoEvents(void)
{
- if (hProtoHookList == NULL) return;
- for (int i = 0; i < ProtoHookCount; ++i)
- if (hProtoHookList[i] != NULL) UnhookEvent(hProtoHookList[i]);
- mir_free(hProtoHookList);
- hProtoHookList = NULL;
- ProtoHookCount = 0;
-}
-
-HANDLE CreateServiceFunctionEx(const char *name, MIRANDASERVICE serviceProc)
-{
- ServiceCount++;
- hServiceList = (HANDLE *)mir_realloc(hServiceList, sizeof(HANDLE) * ServiceCount);
- return hServiceList[ServiceCount - 1] = CreateServiceFunction(name, serviceProc);
-}
-
-void DestroyServiceFunctionsEx(void)
-{
- for (int i = 0; i < ServiceCount; ++i)
- if (hServiceList[i] != NULL) DestroyServiceFunction(hServiceList[i]);
- mir_free(hServiceList);
- ServiceCount = 0;
+ for (int i = 0; i < arProtoHooks.getCount(); ++i)
+ UnhookEvent( arProtoHooks[i] );
+ arProtoHooks.destroy();
}
// Generate random number in a specified range
diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index 61e4b2bbb8..723cad3473 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -58,18 +58,13 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD /* mira // MirandaInterfaces - returns the protocol interface to the core
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_SMILEY, MIID_LAST};
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static IconItem icon = { LPGEN("Button Smiley"), "SmileyAdd_ButtonSmiley", IDI_SMILINGICON };
+
static int ModulesLoaded(WPARAM, LPARAM)
{
- char path[MAX_PATH];
- GetModuleFileNameA(g_hInst, path, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(SKINICONDESC) };
- sid.pszName = "SmileyAdd_ButtonSmiley";
- sid.pszSection = "SmileyAdd";
- sid.pszDescription = LPGEN("Button Smiley");
- sid.pszDefaultFile = path;
- sid.iDefaultIndex = -IDI_SMILINGICON;
- HANDLE hSkinIcon = Skin_AddIcon(&sid);
+ Icon_Register(g_hInst, "SmileyAdd", &icon, 1);
INT_PTR temp = CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
metaProtoName = mir_strdup(temp == CALLSERVICE_NOTFOUND ? NULL : (char*)temp);
@@ -78,7 +73,7 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB;
mi.popupPosition = 2000070050;
mi.position = 2000070050;
- mi.icolibItem = hSkinIcon;
+ mi.icolibItem = icon.hIcolib;
mi.pszPopupName = (char*)-1;
mi.pszName = "Assign Smiley Category";
hContactMenuItem = Menu_AddContactMenuItem(&mi);
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 6fb39c5831..f06de84fad 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -259,14 +259,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) //////////////////////////////////////////////////////////////////////////////////////// -struct -{ - char* szDescr; - char* szName; - int defIconID; - HANDLE hIcolib; -} -static iconList[] = +static IconItem iconList[] = { { LPGEN("Enabled"), "spellchecker_enabled", IDI_CHECK }, { LPGEN("Disabled"), "spellchecker_disabled", IDI_NO_CHECK } @@ -277,20 +270,7 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo); // icons - TCHAR path[MAX_PATH]; - GetModuleFileName(hInst, path, MAX_PATH); - - SKINICONDESC sid = { sizeof(sid) }; - sid.flags = SIDF_PATH_TCHAR; - sid.pszSection = LPGEN("Spell Checker"); - sid.ptszDefaultFile = path; - - for (int i = 0; i < SIZEOF(iconList); ++i) { - sid.pszDescription = iconList[i].szDescr; - sid.pszName = iconList[i].szName; - sid.iDefaultIndex = -iconList[i].defIconID; - iconList[i].hIcolib = Skin_AddIcon(&sid); - } + Icon_Register(hInst, LPGEN("Spell Checker"), iconList, SIZEOF(iconList)); // hooks HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp index ba90cfb1a3..6d9c62ea1d 100644 --- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp +++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp @@ -25,10 +25,14 @@ #define MAX_MMITEMS 6
-static HANDLE hTtbDown = 0, hTtbUp = 0;
-
static LIST<void> ttbButtons(1);
+static IconItem iconList[] =
+{
+ { LPGEN("Pressed toolbar icon"), "StartupStatus/TtbDown", IDI_TTBDOWN },
+ { LPGEN("Released toolbar icon"), "StartupStatus/TtbUp", IDI_TTBUP },
+};
+
/////////////////////////////////////////////////////////////////////////////////////////
void RemoveTopToolbarButtons()
@@ -57,8 +61,8 @@ int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam) if (DBGetContactSetting(NULL, MODULENAME, setting, &dbv))
continue;
- ttb.hIconHandleDn = hTtbDown;
- ttb.hIconHandleUp = hTtbUp;
+ ttb.hIconHandleDn = iconList[0].hIcolib;
+ ttb.hIconHandleUp = iconList[1].hIcolib;
ttb.wParamDown = ttb.wParamUp = i;
ttb.name = ttb.pszTooltipUp = dbv.pszVal;
HANDLE ttbAddResult = TopToolbar_AddButton(&ttb);
@@ -73,20 +77,5 @@ int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam) void RegisterButtons()
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszSection = "Toolbar/StartupStatus";
- sid.pszName = "StartupStatus/TtbDown";
- sid.pszDescription = "Pressed toolbar icon";
- sid.iDefaultIndex = -IDI_TTBDOWN;
- sid.flags = SIDF_PATH_TCHAR;
- hTtbDown = Skin_AddIcon(&sid);
-
- sid.pszName = "StartupStatus/TtbUp";
- sid.pszDescription = "Released toolbar icon";
- sid.iDefaultIndex = -IDI_TTBUP;
- hTtbUp = Skin_AddIcon(&sid);
+ Icon_Register(hInst, "Toolbar/StartupStatus", iconList, SIZEOF(iconList));
}
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index aab81cf6dc..b259319a45 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -426,66 +426,42 @@ static void LoadLogFonts(void) LoadMsgDlgFont(FONTSECTION_CHAT, i, &aFonts[i].lf, &aFonts[i].color, CHAT_FONTMODULE);
}
-struct { char *szDesc; char *szName; int id; UINT size;} static _icons[] =
+static IconItem _icons[] =
{
- { LPGEN("Window Icon"), "chat_window", IDI_CHANMGR, 16 },
- { LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY, 16 },
-
- { LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0, 16 },
- { LPGEN("Status 2 (10x10)"), "chat_status1", IDI_STATUS1, 16 },
- { LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2, 16 },
- { LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3, 16 },
- { LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4, 16 },
- { LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5, 16 },
+ { LPGEN("Window Icon"), "chat_window", IDI_CHANMGR },
+ { LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY },
+
+ { LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0 },
+ { LPGEN("Status 2 (10x10)"), "chat_status1", IDI_STATUS1 },
+ { LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2 },
+ { LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3 },
+ { LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4 },
+ { LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5 }
};
-struct { char *szDesc; char *szName; int id; UINT size;} static _logicons[] =
+static IconItem _logicons[] =
{
- { LPGEN("Message in (10x10)"), "chat_log_message_in", IDI_MESSAGE, 16 },
- { LPGEN("Message out (10x10)"), "chat_log_message_out", IDI_MESSAGEOUT, 16 },
- { LPGEN("Action (10x10)"), "chat_log_action", IDI_ACTION, 16 },
- { LPGEN("Add Status (10x10)"), "chat_log_addstatus", IDI_ADDSTATUS, 16 },
- { LPGEN("Remove Status (10x10)"), "chat_log_removestatus", IDI_REMSTATUS, 16 },
- { LPGEN("Join (10x10)"), "chat_log_join", IDI_JOIN, 16 },
- { LPGEN("Leave (10x10)"), "chat_log_part", IDI_PART, 16 },
- { LPGEN("Quit (10x10)"), "chat_log_quit", IDI_QUIT, 16 },
- { LPGEN("Kick (10x10)"), "chat_log_kick", IDI_KICK, 16 },
- { LPGEN("Notice (10x10)"), "chat_log_notice", IDI_NOTICE, 16 },
- { LPGEN("Nickchange (10x10)"), "chat_log_nick", IDI_NICK, 16 },
- { LPGEN("Topic (10x10)"), "chat_log_topic", IDI_TOPIC, 16 },
- { LPGEN("Highlight (10x10)"), "chat_log_highlight", IDI_HIGHLIGHT, 16 },
- { LPGEN("Information (10x10)"), "chat_log_info", IDI_INFO, 16 }
+ { LPGEN("Message in (10x10)"), "chat_log_message_in", IDI_MESSAGE },
+ { LPGEN("Message out (10x10)"), "chat_log_message_out", IDI_MESSAGEOUT },
+ { LPGEN("Action (10x10)"), "chat_log_action", IDI_ACTION },
+ { LPGEN("Add Status (10x10)"), "chat_log_addstatus", IDI_ADDSTATUS },
+ { LPGEN("Remove Status (10x10)"), "chat_log_removestatus", IDI_REMSTATUS },
+ { LPGEN("Join (10x10)"), "chat_log_join", IDI_JOIN },
+ { LPGEN("Leave (10x10)"), "chat_log_part", IDI_PART },
+ { LPGEN("Quit (10x10)"), "chat_log_quit", IDI_QUIT },
+ { LPGEN("Kick (10x10)"), "chat_log_kick", IDI_KICK },
+ { LPGEN("Notice (10x10)"), "chat_log_notice", IDI_NOTICE },
+ { LPGEN("Nickchange (10x10)"), "chat_log_nick", IDI_NICK },
+ { LPGEN("Topic (10x10)"), "chat_log_topic", IDI_TOPIC },
+ { LPGEN("Highlight (10x10)"), "chat_log_highlight", IDI_HIGHLIGHT },
+ { LPGEN("Information (10x10)"), "chat_log_info", IDI_INFO }
};
// add icons to the skinning module
void Chat_AddIcons(void)
{
- int i;
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hIconDLL, szFile, SIZEOF(szFile));
-
- // 16x16 icons
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = "TabSRMM/Group chat windows";
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (i=0; i < SIZEOF(_icons); i++) {
- sid.cx = sid.cy = _icons[i].size;
- sid.pszDescription = _icons[i].szDesc;
- sid.pszName = _icons[i].szName;
- sid.iDefaultIndex = -_icons[i].id;
- Skin_AddIcon(&sid);
- }
-
- sid.pszSection = "TabSRMM/Group chat log";
- for (i=0; i < SIZEOF(_logicons); i++) {
- sid.cx = sid.cy = _logicons[i].size;
- sid.pszDescription = _logicons[i].szDesc;
- sid.pszName = _logicons[i].szName;
- sid.iDefaultIndex = -_logicons[i].id;
- Skin_AddIcon(&sid);
- }
+ Icon_Register(g_hIconDLL, "TabSRMM/Group chat windows", _icons, SIZEOF(_icons));
+ Icon_Register(g_hIconDLL, "TabSRMM/Group chat log", _logicons, SIZEOF(_logicons));
}
/*
diff --git a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp index 1e934a070a..194ae5d7c4 100644 --- a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp +++ b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp @@ -21,7 +21,6 @@ Boston, MA 02111-1307, USA. HINSTANCE hInst = NULL;
-HANDLE hOnButtonPressed;
int hLangpack;
PLUGININFOEX pluginInfoEx = {
@@ -37,8 +36,12 @@ PLUGININFOEX pluginInfoEx = { MIID_TS
};
-HANDLE hHook;
-HANDLE hService, hService2, hService3;
+static IconItem iconList[] =
+{
+ { LPGEN("Switch Layout and Send"), "Switch Layout and Send", IDI_SWITCHSEND },
+ { LPGEN("Translit and Send"), "Translit and Send", IDI_TRANSLITSEND },
+ { LPGEN("Invert Case and Send"), "Invert Case and Send", IDI_INVERTSEND },
+};
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
@@ -75,9 +78,9 @@ INT_PTR ServiceInvert(WPARAM wParam, LPARAM lParam) int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- hService = CreateServiceFunction(MS_TS_SWITCHLAYOUT, ServiceSwitch);
- hService2 = CreateServiceFunction(MS_TS_TRANSLITLAYOUT, ServiceTranslit);
- hService3 = CreateServiceFunction(MS_TS_INVERTCASE, ServiceInvert);
+ CreateServiceFunction(MS_TS_SWITCHLAYOUT, ServiceSwitch);
+ CreateServiceFunction(MS_TS_TRANSLITLAYOUT, ServiceTranslit);
+ CreateServiceFunction(MS_TS_INVERTCASE, ServiceInvert);
HOTKEYDESC hkd = {0};
hkd.cbSize = sizeof(hkd);
@@ -129,51 +132,30 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) Hotkey_Register(&hkd);
- hOnButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed);
+ HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed);
if (ServiceExists(MS_BB_ADDBUTTON)) {
- TCHAR tszPath[MAX_PATH];
- GetModuleFileName(hInst, tszPath, SIZEOF(tszPath));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_ALL_TCHAR;
- sid.ptszSection = _T("TabSRMM/TranslitSwitcher");
- sid.cx = sid.cy = 16;
- sid.ptszDescription = _T("Switch Layout and Send");
- sid.pszName = "Switch Layout and Send";
- sid.ptszDefaultFile = tszPath;
- sid.iDefaultIndex = -IDI_SWITCHSEND;
- HANDLE hSwitchIcon = Skin_AddIcon(&sid);
-
- sid.ptszDescription = _T("Translit and Send");
- sid.pszName = "Translit and Send";
- sid.iDefaultIndex = -IDI_TRANSLITSEND;
- HANDLE hTranslitIcon = Skin_AddIcon(&sid);
-
- sid.ptszDescription = _T("Invert Case and Send");
- sid.pszName = "Invert Case and Send";
- sid.iDefaultIndex = -IDI_INVERTSEND;
- HANDLE hInvertIcon = Skin_AddIcon(&sid);
+ Icon_Register(hInst, "TabSRMM/TranslitSwitcher", iconList, SIZEOF(iconList));
BBButton bbd = {0};
bbd.cbSize = sizeof(BBButton);
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
bbd.pszModuleName = "SwitchLayout and Send";
bbd.ptszTooltip = TranslateT("SwitchLayout and Send");
- bbd.hIcon = (HANDLE)hSwitchIcon;
+ bbd.hIcon = iconList[0].hIcolib;
bbd.dwButtonID = 1;
bbd.dwDefPos = 30;
CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
bbd.pszModuleName = "Translit and Send";
bbd.ptszTooltip = TranslateT("Translit and Send");
- bbd.hIcon = (HANDLE)hTranslitIcon;
+ bbd.hIcon = iconList[1].hIcolib;
bbd.dwButtonID = 1;
bbd.dwDefPos = 40;
CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
bbd.pszModuleName = "Invert Case and Send";
bbd.ptszTooltip = TranslateT("Invert Case and Send");
- bbd.hIcon = (HANDLE)hInvertIcon;
+ bbd.hIcon = iconList[2].hIcolib;
bbd.dwButtonID = 1;
bbd.dwDefPos = 50;
CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
@@ -185,21 +167,13 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) extern "C" __declspec(dllexport) int Load(void)
{
-
mir_getLP(&pluginInfoEx);
- hHook = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
-
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
return 0;
}
extern "C" __declspec(dllexport) int Unload(void)
{
- DestroyServiceFunction(hService);
- DestroyServiceFunction(hService2);
- DestroyServiceFunction(hService3);
- UnhookEvent(hHook);
- UnhookEvent(hOnButtonPressed);
-
return 0;
}
\ No newline at end of file diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp index 56546828ce..8bce78de58 100644 --- a/plugins/Variables/src/variables.cpp +++ b/plugins/Variables/src/variables.cpp @@ -550,6 +550,8 @@ int setParseOptions(struct ParseOptions *po) { return 0;
}
+static IconItem icon = { LPGEN("Help"), "vars_help", IDI_V };
+
int LoadVarModule()
{
if (initTokenRegister() != 0 || initContactModule() != 0)
@@ -567,21 +569,11 @@ int LoadVarModule() if (hUxTheme)
pfnEnableThemeDialogTexture = (BOOL (WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
}
+
hShowHelpService = CreateServiceFunction(MS_VARS_SHOWHELP, showHelpService);
hShowHelpExService = CreateServiceFunction(MS_VARS_SHOWHELPEX, showHelpExService);
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszSection = TranslateT("Variables");
- sid.ptszDescription = TranslateT("Help");
- sid.pszName = "vars_help";
- sid.ptszDefaultFile = szFile;
- sid.iDefaultIndex = -IDI_V;
- sid.cx = sid.cy = 16;
- sid.flags = SIDF_ALL_TCHAR;
- Skin_AddIcon(&sid);
+ Icon_Register(hInst, LPGEN("Variables"), &icon, 1);
hIconsChangedHook = HookEvent(ME_SKIN2_ICONSCHANGED, iconsChanged);
diff --git a/plugins/Weather/src/weather_icons.cpp b/plugins/Weather/src/weather_icons.cpp index 119d826859..5cc7f5b907 100644 --- a/plugins/Weather/src/weather_icons.cpp +++ b/plugins/Weather/src/weather_icons.cpp @@ -22,14 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. HANDLE hIcoLibIconsChanged = NULL;
-struct _tag_iconList
-{
- char* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
-}
-static iconList[] =
+static IconItem iconList[] =
{
{ LPGEN("Protocol icon"), "main", IDI_ICON },
{ LPGEN("Update Disabled"), "disabled", IDI_DISABLED },
@@ -46,23 +39,8 @@ static iconList[] = void InitIcons(void)
{
- char szSettingName[100];
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszName = szSettingName;
- sid.pszSection = WEATHERPROTONAME;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- mir_snprintf(szSettingName, SIZEOF( szSettingName ), "%s_%s", WEATHERPROTONAME, iconList[i].szName);
-
- sid.pszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIconLibItem = Skin_AddIcon(&sid);
-} }
+ Icon_Register(hInst, WEATHERPROTONAME, iconList, SIZEOF(iconList), WEATHERPROTONAME);
+}
HICON LoadIconEx(const char* name, BOOL big)
{
@@ -73,10 +51,10 @@ HICON LoadIconEx(const char* name, BOOL big) HANDLE GetIconHandle(const char* name)
{
- unsigned i;
- for (i=0; i < SIZEOF(iconList); i++)
+ for (int i=0; i < SIZEOF(iconList); i++)
if (strcmp(iconList[i].szName, name) == 0)
- return iconList[i].hIconLibItem;
+ return iconList[i].hIcolib;
+
return NULL;
}
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index b935f2134f..c2083ab9f7 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -241,46 +241,24 @@ int SystemModulesLoaded(WPARAM, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
-struct TIconListItem
+static IconItem iconList[] =
{
- char* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIcon;
-};
-
-static TIconListItem iconList[] =
-{
-
- { LPGEN("Check mail"), "YAMN_Check", IDI_CHECKMAIL, 0 },
- { LPGEN("Launch application"), "YAMN_Launch", IDI_LAUNCHAPP, 0 },
- { LPGEN("New Mail"), "YAMN_NewMail", IDI_NEWMAIL, 0 },
- { LPGEN("Connect Fail"), "YAMN_ConnectFail", IDI_BADCONNECT, 0 },
+ { LPGEN("Check mail"), "YAMN_Check", IDI_CHECKMAIL },
+ { LPGEN("Launch application"), "YAMN_Launch", IDI_LAUNCHAPP },
+ { LPGEN("New Mail"), "YAMN_NewMail", IDI_NEWMAIL },
+ { LPGEN("Connect Fail"), "YAMN_ConnectFail", IDI_BADCONNECT },
};
static void LoadIcons()
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(YAMNVar.hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = szFile;
- sid.pszSection = "YAMN";
-
- for (int i = 0, k = 0; i < SIZEOF(iconList); i++) {
- sid.pszName = iconList[i].szName;
- sid.pszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIcon = Skin_AddIcon(&sid);
- }
+ Icon_Register(YAMNVar.hInst, "YAMN", iconList, SIZEOF(iconList));
}
HANDLE WINAPI g_GetIconHandle( int idx )
{
if ( idx >= SIZEOF(iconList))
return NULL;
- return iconList[idx].hIcon;
+ return iconList[idx].hIcolib;
}
HICON WINAPI g_LoadIconEx( int idx, bool big )
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index 69fbe08a0f..45bb443376 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -26,15 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /////////////////////////////////////////////////////////////////////////////////////////
// Icons init
-struct _tag_iconList
-{
- const char* szDescr;
- const char* szName;
- int defIconID;
- const char* szSection;
- HANDLE hIcolib;
-}
-static iconList[] =
+static IconItem iconList[] =
{
{ LPGEN("ICQ"), "icq", IDI_ICQ },
{ LPGEN("Add"), "add", IDI_ADD },
@@ -51,48 +43,26 @@ static iconList[] = { LPGEN("Idle"), "idle", IDI_IDLE },
{ LPGEN("AOL"), "aol", IDI_AOL },
- { LPGEN("Foreground Color"), "foreclr", IDI_FOREGROUNDCOLOR, LPGEN("Profile Editor") },
- { LPGEN("Background Color"), "backclr", IDI_BACKGROUNDCOLOR, LPGEN("Profile Editor") },
- { LPGEN("Bold"), "bold", IDI_BOLD, LPGEN("Profile Editor") },
- { LPGEN("Not Bold"), "nbold", IDI_NBOLD, LPGEN("Profile Editor") },
- { LPGEN("Italic"), "italic", IDI_ITALIC, LPGEN("Profile Editor") },
- { LPGEN("Not Italic"), "nitalic", IDI_NITALIC, LPGEN("Profile Editor") },
- { LPGEN("Underline"), "undrln", IDI_UNDERLINE, LPGEN("Profile Editor") },
- { LPGEN("Not Underline"), "nundrln", IDI_NUNDERLINE, LPGEN("Profile Editor") },
- { LPGEN("Subscript"), "sub_scrpt", IDI_SUBSCRIPT, LPGEN("Profile Editor") },
- { LPGEN("Not Subscript"), "nsub_scrpt", IDI_NSUBSCRIPT, LPGEN("Profile Editor") },
- { LPGEN("Superscript"), "sup_scrpt", IDI_SUPERSCRIPT, LPGEN("Profile Editor") },
- { LPGEN("Not Superscript"), "nsup_scrpt", IDI_NSUPERSCRIPT, LPGEN("Profile Editor") },
- { LPGEN("Normal Script"), "norm_scrpt", IDI_NORMALSCRIPT, LPGEN("Profile Editor") },
- { LPGEN("Not Normal Script"), "nnorm_scrpt", IDI_NNORMALSCRIPT, LPGEN("Profile Editor") },
+ { LPGEN("Foreground Color"), "foreclr", IDI_FOREGROUNDCOLOR },
+ { LPGEN("Background Color"), "backclr", IDI_BACKGROUNDCOLOR },
+ { LPGEN("Bold"), "bold", IDI_BOLD },
+ { LPGEN("Not Bold"), "nbold", IDI_NBOLD },
+ { LPGEN("Italic"), "italic", IDI_ITALIC },
+ { LPGEN("Not Italic"), "nitalic", IDI_NITALIC },
+ { LPGEN("Underline"), "undrln", IDI_UNDERLINE },
+ { LPGEN("Not Underline"), "nundrln", IDI_NUNDERLINE },
+ { LPGEN("Subscript"), "sub_scrpt", IDI_SUBSCRIPT },
+ { LPGEN("Not Subscript"), "nsub_scrpt", IDI_NSUBSCRIPT },
+ { LPGEN("Superscript"), "sup_scrpt", IDI_SUPERSCRIPT },
+ { LPGEN("Not Superscript"), "nsup_scrpt", IDI_NSUPERSCRIPT },
+ { LPGEN("Normal Script"), "norm_scrpt", IDI_NORMALSCRIPT },
+ { LPGEN("Not Normal Script"), "nnorm_scrpt", IDI_NNORMALSCRIPT }
};
void InitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInstance, szFile, SIZEOF(szFile));
-
- char szSettingName[100];
- char szSectionName[100];
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszName = szSettingName;
- sid.pszSection = szSectionName;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- mir_snprintf(szSettingName, sizeof(szSettingName), "AIM_%s", iconList[i].szName);
-
- if (iconList[i].szSection)
- mir_snprintf(szSectionName, sizeof(szSectionName), "%s/%s/%s", LPGEN("Protocols"), LPGEN("AIM"), iconList[i].szSection);
- else
- mir_snprintf(szSectionName, sizeof(szSectionName), "%s/%s", LPGEN("Protocols"), LPGEN("AIM"));
-
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIcolib = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInstance, "Protocols/AIM", iconList, 14, "AIM");
+ Icon_Register(hInstance, "Protocols/AIM/Profile Editor", iconList+14, 14, "AIM");
}
HICON LoadIconEx(const char* name, bool big)
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index 78e21a18f1..e29f5f727d 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -24,85 +24,41 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. extern OBJLIST<FacebookProto> g_Instances;
-struct
+static IconItem icons[] =
{
- const char* name;
- char* descr;
- int defIconID;
- const char* section;
-}
-static const icons[] =
-{
- { "facebook", LPGEN("Facebook Icon"), IDI_FACEBOOK },
- { "mind", LPGEN("Mind"), IDI_MIND },
+ { LPGEN("Facebook Icon"), "facebook", IDI_FACEBOOK },
+ { LPGEN("Mind"), "mind", IDI_MIND },
- { "authRevoke", LPGEN("Cancel friendship"), IDI_AUTH_REVOKE },
- { "authRevokeReq", LPGEN("Cancel friendship request"), IDI_AUTH_REVOKE },
- { "authAsk", LPGEN("Request friendship"), IDI_AUTH_ASK },
- { "authGrant", LPGEN("Approve friendship"), IDI_AUTH_GRANT },
+ { LPGEN("Cancel friendship"), "authRevoke", IDI_AUTH_REVOKE },
+ { LPGEN("Cancel friendship request"), "authRevokeReq", IDI_AUTH_REVOKE },
+ { LPGEN("Request friendship"), "authAsk", IDI_AUTH_ASK },
+ { LPGEN("Approve friendship"), "authGrant", IDI_AUTH_GRANT },
- { "homepage", LPGEN("Visit Profile"), 0, "core_main_2" },
+ { LPGEN("Visit Profile"), "homepage", 0 },
};
-static HANDLE hIconLibItem[SIZEOF(icons)];
-
// TODO: uninit
void InitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInstance, szFile, SIZEOF(szFile));
-
- char setting_name[100];
- char section_name[100];
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.pszName = setting_name;
- sid.pszSection = section_name;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i=0; i<SIZEOF(icons); i++)
- {
- if(icons[i].defIconID)
- {
- mir_snprintf(setting_name,sizeof(setting_name),"%s_%s","Facebook",icons[i].name);
-
- if (icons[i].section)
- {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s/%s",LPGEN("Protocols"),
- LPGEN("Facebook"), icons[i].section);
- } else {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s",LPGEN("Protocols"),
- LPGEN("Facebook"));
- }
-
- sid.pszDescription = (char*)icons[i].descr;
- sid.iDefaultIndex = -icons[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- } else { // External icons
- hIconLibItem[i] = Skin_GetIconHandle(icons[i].section);
- }
- }
+ Icon_Register(g_hInstance, "Protocols/Facebook", icons, SIZEOF(icons)-1, "Facebook");
+ icons[ SIZEOF(icons)-1 ].hIcolib = Skin_GetIconHandle("core_main_2");
}
HANDLE GetIconHandle(const char* name)
{
for(size_t i=0; i<SIZEOF(icons); i++)
- {
- if(strcmp(icons[i].name,name) == 0)
- return hIconLibItem[i];
- }
+ if(strcmp(icons[i].szName, name) == 0)
+ return icons[i].hIcolib;
+
return 0;
}
char *GetIconDescription(const char* name)
{
for(size_t i=0; i<SIZEOF(icons); i++)
- {
- if(strcmp(icons[i].name,name) == 0)
- return icons[i].descr;
- }
+ if(strcmp(icons[i].szName, name) == 0)
+ return icons[i].szDescr;
+
return "";
}
diff --git a/protocols/Gadu-Gadu/src/icolib.cpp b/protocols/Gadu-Gadu/src/icolib.cpp index e353dcdb17..c260942c33 100644 --- a/protocols/Gadu-Gadu/src/icolib.cpp +++ b/protocols/Gadu-Gadu/src/icolib.cpp @@ -20,13 +20,7 @@ #include "gg.h"
-struct tagiconList
-{
- char* szDescr;
- char* szName;
- int defIconID;
-}
-static const iconList[] =
+static IconItem iconList[] =
{
{ LPGEN("Protocol icon"), "main", IDI_GG },
{ LPGEN("Import list from server"), "importserver", IDI_IMPORT_SERVER },
@@ -51,25 +45,7 @@ HANDLE hIconLibItem[SIZEOF(iconList)]; void gg_icolib_init()
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInstance, szFile, MAX_PATH);
-
- char szSectionName[100];
- mir_snprintf(szSectionName, sizeof( szSectionName ), "%s/%s", LPGEN("Protocols"), LPGEN(GGDEF_PROTO));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszSection = szSectionName;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- char szSettingName[100];
- mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s", GGDEF_PROTO, iconList[i].szName);
- sid.pszName = szSettingName;
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInstance, "Protocols/" GGDEF_PROTO, iconList, SIZEOF(iconList), GGDEF_PROTO);
}
HICON LoadIconEx(const char* name, BOOL big)
@@ -81,8 +57,7 @@ HICON LoadIconEx(const char* name, BOOL big) HANDLE GetIconHandle(int iconId)
{
- int i;
- for(i = 0; i < SIZEOF(iconList); i++)
+ for(int i = 0; i < SIZEOF(iconList); i++)
if (iconList[i].defIconID == iconId)
return hIconLibItem[i];
return NULL;
diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h index 9fe6584d87..6928d21dda 100644 --- a/protocols/IRCG/src/irc.h +++ b/protocols/IRCG/src/irc.h @@ -697,8 +697,7 @@ void UninitContactMenus(void); void WindowSetIcon(HWND hWnd, int iconId);
void WindowFreeIcon(HWND hWnd);
-void AddIcons(void);
-void UninitIcons(void);
+void InitIcons(void);
HICON LoadIconEx(int iIndex, bool big = false);
HANDLE GetIconHandle(int iconId);
void ReleaseIconEx(HICON hIcon);
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 3331c9aa93..0c384234c0 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -78,7 +78,6 @@ CIrcProto::CIrcProto( const char* szModuleName, const TCHAR* tszUserName ) : CallService( MS_DB_SETSETTINGRESIDENT, TRUE, ( LPARAM )text );
CList_SetAllOffline(true);
- AddIcons();
IRC_MAP_ENTRY("PING", PING)
IRC_MAP_ENTRY("JOIN", JOIN)
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp index 0a2a5d70df..f6265a1c2b 100644 --- a/protocols/IRCG/src/main.cpp +++ b/protocols/IRCG/src/main.cpp @@ -89,10 +89,9 @@ static int ircProtoUninit( CIrcProto* ppro ) extern "C" int __declspec(dllexport) Load( )
{
-
mir_getLP( &pluginInfo );
- AddIcons();
+ InitIcons();
InitTimers();
InitServers();
InitContactMenus();
@@ -112,7 +111,6 @@ extern "C" int __declspec(dllexport) Load( ) extern "C" int __declspec(dllexport) Unload(void)
{
UninitContactMenus();
- UninitIcons();
UninitTimers();
g_Instances.destroy();
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index d7ed8753cc..a01e34822b 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -27,8 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static WNDPROC OldProc;
static WNDPROC OldListViewProc;
-static HANDLE* hIconLibItems;
-
static const CIrcProto* pZero = NULL;
void CIrcProto::ReadSettings( TDbSetting* sets, int count )
@@ -191,66 +189,36 @@ static void removeSpaces( TCHAR* p ) /////////////////////////////////////////////////////////////////////////////////////////
// add icons to the skinning module
-struct
-{
- char* szDescr;
- char* szName;
- int iSize;
- int defIconID;
-}
-static iconList[] =
-{
- { LPGEN("Main"), "main", 0, IDI_MAIN },
- { LPGEN("Add"), "add", 0, IDI_ADD },
- { LPGEN("Apply"), "apply", 0, IDI_APPLY },
- { LPGEN("Rename"), "rename", 0, IDI_RENAME },
- { LPGEN("Edit"), "edit", 0, IDI_EDIT },
- { LPGEN("Cancel"), "delete", 0, IDI_DELETE },
- { LPGEN("Ignore"), "block", 0, IDI_BLOCK },
- { LPGEN("Channel list"), "list", 0, IDI_LIST },
- { LPGEN("Channel manager"), "manager", 0, IDI_MANAGER },
- { LPGEN("Quick connect"), "quick", 0, IDI_QUICK },
- { LPGEN("Server window"), "server", 0, IDI_SERVER },
- { LPGEN("Show channel"), "show", 0, IDI_SHOW },
- { LPGEN("Question"), "question", 0, IDI_IRCQUESTION},
- { LPGEN("WhoIs"), "whois", 0, IDI_WHOIS },
- { LPGEN("Incoming DCC Chat"), "dcc", 0, IDI_DCC },
- { LPGEN("Logo (48x48)"), "logo", 48, IDI_LOGO }
+static IconItem iconList[] =
+{
+ { LPGEN("Main"), "main", IDI_MAIN, 0 },
+ { LPGEN("Add"), "add", IDI_ADD, 0 },
+ { LPGEN("Apply"), "apply", IDI_APPLY, 0 },
+ { LPGEN("Rename"), "rename", IDI_RENAME, 0 },
+ { LPGEN("Edit"), "edit", IDI_EDIT, 0 },
+ { LPGEN("Cancel"), "delete", IDI_DELETE, 0 },
+ { LPGEN("Ignore"), "block", IDI_BLOCK, 0 },
+ { LPGEN("Channel list"), "list", IDI_LIST, 0 },
+ { LPGEN("Channel manager"), "manager", IDI_MANAGER, 0 },
+ { LPGEN("Quick connect"), "quick", IDI_QUICK, 0 },
+ { LPGEN("Server window"), "server", IDI_SERVER, 0 },
+ { LPGEN("Show channel"), "show", IDI_SHOW, 0 },
+ { LPGEN("Question"), "question",IDI_IRCQUESTION, 0 },
+ { LPGEN("WhoIs"), "whois", IDI_WHOIS, 0 },
+ { LPGEN("Incoming DCC Chat"), "dcc", IDI_DCC, 0 },
+ { LPGEN("Logo (48x48)"), "logo", IDI_LOGO, 48 }
};
-void AddIcons(void)
-{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = "Protocols/IRC";
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_PATH_TCHAR;
- hIconLibItems = new HANDLE[ SIZEOF(iconList) ];
-
- // add them one by one
- for ( int i=0; i < SIZEOF(iconList); i++ ) {
- char szTemp[255];
- mir_snprintf(szTemp, sizeof(szTemp), "IRC_%s", iconList[i].szName );
- sid.pszName = szTemp;
- sid.pszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- sid.cx = sid.cy = iconList[i].iSize;
- hIconLibItems[i] = Skin_AddIcon(&sid );
- }
-}
-
-void UninitIcons(void)
+void InitIcons(void)
{
- delete[] hIconLibItems;
+ Icon_Register(hInst, "Protocols/IRC", iconList, SIZEOF(iconList), "IRC");
}
HICON LoadIconEx( int iconId, bool big )
{
for ( int i=0; i < SIZEOF(iconList); i++ )
if ( iconList[i].defIconID == iconId )
- return Skin_GetIconByHandle(hIconLibItems[i], big);
+ return Skin_GetIconByHandle(iconList[i].hIcolib, big);
return NULL;
}
@@ -259,7 +227,7 @@ HANDLE GetIconHandle( int iconId ) {
for ( int i=0; i < SIZEOF(iconList); i++ )
if ( iconList[i].defIconID == iconId )
- return hIconLibItems[i];
+ return iconList[i].hIcolib;
return NULL;
}
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 490a8b1377..d8f08e22ba 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -174,82 +174,29 @@ CIconPool::CPoolItem *CIconPool::FindItemByName(const char *name) /////////////////////////////////////////////////////////////////////////////////////////
// Icons init
-struct TIconListItem
+static IconItem iconList[] =
{
- char* szDescr;
- char* szName;
- int defIconID;
- char* szSection;
- HANDLE hIcon;
-};
-
-static TIconListItem iconList[] =
-{
- { LPGEN("%s"), "main", IDI_JABBER, NULL },
+ { LPGEN("%s"), "main", IDI_JABBER },
};
void CJabberProto::IconsInit(void)
{
- int i;
-
m_transportProtoTableStartIndex = (int *)mir_alloc(sizeof(int) * SIZEOF(TransportProtoTable));
- for (i = 0; i < SIZEOF(TransportProtoTable); ++i)
+ for (int i = 0; i < SIZEOF(TransportProtoTable); ++i)
m_transportProtoTableStartIndex[i] = -1;
- char szFile[MAX_PATH];
- GetModuleFileNameA(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszDefaultFile = szFile;
- sid.flags = SIDF_TCHAR;
-
- char szSettingName[100];
- TCHAR szSectionName[100];
- TCHAR szDescription[100];
- TCHAR szRootSection[100];
-
- sid.pszName = szSettingName;
- sid.ptszSection = szSectionName;
- sid.ptszDescription = szDescription;
-
- m_phIconLibItems = (HANDLE*)mir_alloc(sizeof(HANDLE)*SIZEOF(iconList));
-
- mir_sntprintf(szRootSection, SIZEOF(szRootSection), _T("%s/%s/%s"), LPGENT("Protocols"), LPGENT("Jabber"), LPGENT("Accounts"));
-
- for (i = 0; i < SIZEOF(iconList); i++) {
- TCHAR tmp[100];
-
- if (iconList[i].szSection) {
- mir_sntprintf(szSectionName, SIZEOF(szSectionName), _T("%s/") _T(TCHAR_STR_PARAM), szRootSection, iconList[i].szSection);
- if (_tcsstr(szSectionName, _T("%s"))) {
- mir_sntprintf(tmp, SIZEOF(tmp), szSectionName, m_tszUserName);
- lstrcpy(szSectionName, tmp);
- }
- }
- else {
- mir_sntprintf(szSectionName, SIZEOF(szSectionName), _T("%s"), szRootSection);
- }
-
- if (strstr(iconList[i].szDescr, "%s")) {
- mir_sntprintf(tmp, SIZEOF(tmp), _T(TCHAR_STR_PARAM), iconList[i].szDescr);
- mir_sntprintf(szDescription, SIZEOF(szDescription), tmp, m_tszUserName);
- }
- else mir_sntprintf(szDescription, SIZEOF(szDescription), _T(TCHAR_STR_PARAM), iconList[i].szDescr);
-
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", m_szModuleName, iconList[i].szName);
-
- sid.iDefaultIndex = -iconList[i].defIconID;
- m_phIconLibItems[i] = Skin_AddIcon(&sid);
-} }
+ IconItemT protoIcon = { m_tszUserName, "main", IDI_JABBER };
+ Icon_RegisterT(hInst, _T("Protocols/Jabber/Accounts"), &protoIcon, 1, m_szModuleName);
+ m_hProtoIcon = protoIcon.hIcolib;
+}
HANDLE CJabberProto::GetIconHandle(int iconId)
{
if (HANDLE result = g_GetIconHandle(iconId))
return result;
- for (int i=0; i < SIZEOF(iconList); i++)
- if (iconList[i].defIconID == iconId)
- return m_phIconLibItems[i];
+ if (iconId == IDI_JABBER)
+ return m_hProtoIcon;
return NULL;
}
@@ -550,91 +497,68 @@ void CJabberProto::CheckAllContactsAreTransported() /////////////////////////////////////////////////////////////////////////////////////////
// Cross-instance shared icons
-static TIconListItem sharedIconList[] =
-{
- { LPGEN("Privacy Lists"), "privacylists", IDI_PRIVACY_LISTS, NULL },
- { LPGEN("Bookmarks"), "bookmarks", IDI_BOOKMARKS, NULL },
- { LPGEN("Notes"), "notes", IDI_NOTES, NULL },
- { LPGEN("Multi-User Conference"), "group", IDI_GROUP, NULL },
- { LPGEN("Agents list"), "Agents", IDI_AGENTS, NULL },
-
- { LPGEN("Transports"), "transport", IDI_TRANSPORT, NULL },
- { LPGEN("Registered transports"), "transport_loc", IDI_TRANSPORTL, NULL },
- { LPGEN("Change password"), "key", IDI_KEYS, NULL },
- { LPGEN("Personal vCard"), "vcard", IDI_VCARD, NULL },
- { LPGEN("Request authorization"), "Request", IDI_REQUEST, NULL },
- { LPGEN("Grant authorization"), "Grant", IDI_GRANT, NULL },
- { LPGEN("Revoke authorization"), "Revoke", IDI_AUTHREVOKE, NULL },
- { LPGEN("Convert to room"), "convert", IDI_USER2ROOM, NULL },
- { LPGEN("Add to roster"), "addroster", IDI_ADDROSTER, NULL },
- { LPGEN("Login/logout"), "trlogonoff", IDI_LOGIN, NULL },
- { LPGEN("Resolve nicks"), "trresolve", IDI_REFRESH, NULL },
- { LPGEN("Send note"), "sendnote", IDI_SEND_NOTE, NULL },
- { LPGEN("Service Discovery"), "servicediscovery", IDI_SERVICE_DISCOVERY, NULL },
- { LPGEN("AdHoc Command"), "adhoc", IDI_COMMAND, NULL },
- { LPGEN("XML Console"), "xmlconsole", IDI_CONSOLE, NULL },
- { LPGEN("OpenID Request"), "openid", IDI_HTTP_AUTH, NULL },
-
- { LPGEN("Discovery succeeded"), "disco_ok", IDI_DISCO_OK, LPGEN("Dialogs") },
- { LPGEN("Discovery failed"), "disco_fail", IDI_DISCO_FAIL, LPGEN("Dialogs") },
- { LPGEN("Discovery in progress"), "disco_progress", IDI_DISCO_PROGRESS, LPGEN("Dialogs") },
- { LPGEN("View as tree"), "sd_view_tree", IDI_VIEW_TREE, LPGEN("Dialogs") },
- { LPGEN("View as list"), "sd_view_list", IDI_VIEW_LIST, LPGEN("Dialogs") },
- { LPGEN("Apply filter"), "sd_filter_apply", IDI_FILTER_APPLY, LPGEN("Dialogs") },
- { LPGEN("Reset filter"), "sd_filter_reset", IDI_FILTER_RESET, LPGEN("Dialogs") },
-
- { LPGEN("Navigate home"), "sd_nav_home", IDI_NAV_HOME, LPGEN("Dialogs/Discovery") },
- { LPGEN("Refresh node"), "sd_nav_refresh", IDI_NAV_REFRESH, LPGEN("Dialogs/Discovery") },
- { LPGEN("Browse node"), "sd_browse", IDI_BROWSE, LPGEN("Dialogs/Discovery") },
- { LPGEN("RSS service"), "node_rss", IDI_NODE_RSS, LPGEN("Dialogs/Discovery") },
- { LPGEN("Server"), "node_server", IDI_NODE_SERVER, LPGEN("Dialogs/Discovery") },
- { LPGEN("Storage service"), "node_store", IDI_NODE_STORE, LPGEN("Dialogs/Discovery") },
- { LPGEN("Weather service"), "node_weather", IDI_NODE_WEATHER, LPGEN("Dialogs/Discovery") },
-
- { LPGEN("Generic privacy list"), "pl_list_any", IDI_PL_LIST_ANY, LPGEN("Dialogs/Privacy") },
- { LPGEN("Active privacy list"), "pl_list_active", IDI_PL_LIST_ACTIVE, LPGEN("Dialogs/Privacy") },
- { LPGEN("Default privacy list"), "pl_list_default", IDI_PL_LIST_DEFAULT, LPGEN("Dialogs/Privacy") },
- { LPGEN("Move up"), "arrow_up", IDI_ARROW_UP, LPGEN("Dialogs/Privacy") },
- { LPGEN("Move down"), "arrow_down", IDI_ARROW_DOWN, LPGEN("Dialogs/Privacy") },
- { LPGEN("Allow Messages"), "pl_msg_allow", IDI_PL_MSG_ALLOW, LPGEN("Dialogs/Privacy") },
- { LPGEN("Allow Presences (in)"), "pl_prin_allow", IDI_PL_PRIN_ALLOW, LPGEN("Dialogs/Privacy") },
- { LPGEN("Allow Presences (out)"), "pl_prout_allow", IDI_PL_PROUT_ALLOW, LPGEN("Dialogs/Privacy") },
- { LPGEN("Allow Queries"), "pl_iq_allow", IDI_PL_QUERY_ALLOW, LPGEN("Dialogs/Privacy") },
- { LPGEN("Deny Messages"), "pl_msg_deny", IDI_PL_MSG_DENY, LPGEN("Dialogs/Privacy") },
- { LPGEN("Deny Presences (in)"), "pl_prin_deny", IDI_PL_PRIN_DENY, LPGEN("Dialogs/Privacy") },
- { LPGEN("Deny Presences (out)"), "pl_prout_deny", IDI_PL_PROUT_DENY, LPGEN("Dialogs/Privacy") },
- { LPGEN("Deny Queries"), "pl_iq_deny", IDI_PL_QUERY_DENY, LPGEN("Dialogs/Privacy") },
+static IconItem sharedIconList[] =
+{
+ { LPGEN("Privacy Lists"), "privacylists", IDI_PRIVACY_LISTS },
+ { LPGEN("Bookmarks"), "bookmarks", IDI_BOOKMARKS },
+ { LPGEN("Notes"), "notes", IDI_NOTES },
+ { LPGEN("Multi-User Conference"), "group", IDI_GROUP },
+ { LPGEN("Agents list"), "Agents", IDI_AGENTS },
+ { LPGEN("Transports"), "transport", IDI_TRANSPORT },
+ { LPGEN("Registered transports"), "transport_loc", IDI_TRANSPORTL },
+ { LPGEN("Change password"), "key", IDI_KEYS, },
+ { LPGEN("Personal vCard"), "vcard", IDI_VCARD, },
+ { LPGEN("Request authorization"), "Request", IDI_REQUEST, },
+ { LPGEN("Grant authorization"), "Grant", IDI_GRANT, },
+ { LPGEN("Revoke authorization"), "Revoke", IDI_AUTHREVOKE, },
+ { LPGEN("Convert to room"), "convert", IDI_USER2ROOM, },
+ { LPGEN("Add to roster"), "addroster", IDI_ADDROSTER, },
+ { LPGEN("Login/logout"), "trlogonoff", IDI_LOGIN, },
+ { LPGEN("Resolve nicks"), "trresolve", IDI_REFRESH, },
+ { LPGEN("Send note"), "sendnote", IDI_SEND_NOTE, },
+ { LPGEN("Service Discovery"), "servicediscovery", IDI_SERVICE_DISCOVERY, },
+ { LPGEN("AdHoc Command"), "adhoc", IDI_COMMAND, },
+ { LPGEN("XML Console"), "xmlconsole", IDI_CONSOLE, },
+ { LPGEN("OpenID Request"), "openid", IDI_HTTP_AUTH, },
+
+ { LPGEN("Discovery succeeded"), "disco_ok", IDI_DISCO_OK, },
+ { LPGEN("Discovery failed"), "disco_fail", IDI_DISCO_FAIL, },
+ { LPGEN("Discovery in progress"), "disco_progress", IDI_DISCO_PROGRESS, },
+ { LPGEN("View as tree"), "sd_view_tree", IDI_VIEW_TREE, },
+ { LPGEN("View as list"), "sd_view_list", IDI_VIEW_LIST, },
+ { LPGEN("Apply filter"), "sd_filter_apply", IDI_FILTER_APPLY, },
+ { LPGEN("Reset filter"), "sd_filter_reset", IDI_FILTER_RESET, },
+
+ { LPGEN("Navigate home"), "sd_nav_home", IDI_NAV_HOME, },
+ { LPGEN("Refresh node"), "sd_nav_refresh", IDI_NAV_REFRESH, },
+ { LPGEN("Browse node"), "sd_browse", IDI_BROWSE, },
+ { LPGEN("RSS service"), "node_rss", IDI_NODE_RSS, },
+ { LPGEN("Server"), "node_server", IDI_NODE_SERVER, },
+ { LPGEN("Storage service"), "node_store", IDI_NODE_STORE, },
+ { LPGEN("Weather service"), "node_weather", IDI_NODE_WEATHER, },
+
+ { LPGEN("Generic privacy list"), "pl_list_any", IDI_PL_LIST_ANY, },
+ { LPGEN("Active privacy list"), "pl_list_active", IDI_PL_LIST_ACTIVE, },
+ { LPGEN("Default privacy list"), "pl_list_default", IDI_PL_LIST_DEFAULT, },
+ { LPGEN("Move up"), "arrow_up", IDI_ARROW_UP, },
+ { LPGEN("Move down"), "arrow_down", IDI_ARROW_DOWN, },
+ { LPGEN("Allow Messages"), "pl_msg_allow", IDI_PL_MSG_ALLOW, },
+ { LPGEN("Allow Presences (in)"), "pl_prin_allow", IDI_PL_PRIN_ALLOW, },
+ { LPGEN("Allow Presences (out)"), "pl_prout_allow", IDI_PL_PROUT_ALLOW, },
+ { LPGEN("Allow Queries"), "pl_iq_allow", IDI_PL_QUERY_ALLOW, },
+ { LPGEN("Deny Messages"), "pl_msg_deny", IDI_PL_MSG_DENY, },
+ { LPGEN("Deny Presences (in)"), "pl_prin_deny", IDI_PL_PRIN_DENY, },
+ { LPGEN("Deny Presences (out)"), "pl_prout_deny", IDI_PL_PROUT_DENY, },
+ { LPGEN("Deny Queries"), "pl_iq_deny", IDI_PL_QUERY_DENY, },
};
static void sttProcessIcons(int iAmount)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_PATH_TCHAR;
-
- char szRootSection[100];
- mir_snprintf(szRootSection, SIZEOF(szRootSection), "%s/%s", LPGEN("Protocols"), LPGEN("Jabber"));
-
- for (int i = 0; i < iAmount; i++) {
- char szSettingName[100], szSectionName[100];
-
- mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s",
- GLOBAL_SETTING_PREFIX, sharedIconList[i].szName);
-
- if (sharedIconList[i].szSection) {
- mir_snprintf(szSectionName, sizeof(szSectionName), "%s/%s", szRootSection, sharedIconList[i].szSection);
- sid.pszSection = szSectionName;
- }
- else sid.pszSection = szRootSection;
-
- sid.pszName = szSettingName;
- sid.pszDescription = sharedIconList[i].szDescr;
- sid.iDefaultIndex = -sharedIconList[i].defIconID;
- sharedIconList[i].hIcon = Skin_AddIcon(&sid);
-} }
+ Icon_Register(hInst, "Protocols/Jabber", iconList, 21, GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, "Protocols/Jabber/Dialogs", iconList+21, 7, GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, "Protocols/Dialogs/Discovery", iconList+28, 7, GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, "Protocols/Dialogs/Privacy", iconList+35, 13, GLOBAL_SETTING_PREFIX);
+}
void g_IconsInit()
{
@@ -645,7 +569,7 @@ HANDLE g_GetIconHandle(int iconId) {
for (int i=0; i < SIZEOF(sharedIconList); i++)
if (sharedIconList[i].defIconID == iconId)
- return sharedIconList[i].hIcon;
+ return sharedIconList[i].hIcolib;
return NULL;
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index fbb88dde49..4aaa085b52 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -232,7 +232,6 @@ CJabberProto::~CJabberProto() DeleteCriticalSection(&m_csLists);
mir_free(m_tszSelectedLang);
- mir_free(m_phIconLibItems);
mir_free(m_AuthMechs.m_gssapiHostName);
DeleteCriticalSection(&m_filterInfo.csPatternLock);
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 9ab3c99164..048e0370de 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -993,7 +993,7 @@ private: int m_nMenuResourceItems;
HANDLE* m_phMenuResourceItems;
- HANDLE* m_phIconLibItems;
+ HANDLE m_hProtoIcon;
};
extern LIST<CJabberProto> g_Instances;
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index bac6553e8f..30e74d4d36 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -27,52 +27,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /////////////////////////////////////////////////////////////////////////////////////////
// Icons init
-struct _tag_iconList
+static IconItem iconList[] =
{
- const char* szDescr;
- const char* szName;
- int defIconID;
-}
-static const iconList[] =
-{
- { LPGEN("Protocol icon"), "main", IDI_MSN },
- { LPGEN("Hotmail Inbox"), "inbox", IDI_INBOX },
- { LPGEN("Profile"), "profile", IDI_PROFILE },
- { LPGEN("MSN Services"), "services", IDI_SERVICES },
- { LPGEN("Block user"), "block", IDI_MSNBLOCK },
- { LPGEN("Invite to chat"), "invite", IDI_INVITE },
- { LPGEN("Start Netmeeting"), "netmeeting", IDI_NETMEETING },
- { LPGEN("Contact list"), "list_fl", IDI_LIST_FL },
- { LPGEN("Allowed list"), "list_al", IDI_LIST_AL },
- { LPGEN("Blocked list"), "list_bl", IDI_LIST_BL },
- { LPGEN("Relative list"), "list_rl", IDI_LIST_RL },
- { LPGEN("Local list"), "list_lc", IDI_LIST_LC },
+ { LPGEN("Protocol icon"), "main", IDI_MSN },
+ { LPGEN("Hotmail Inbox"), "inbox", IDI_INBOX },
+ { LPGEN("Profile"), "profile", IDI_PROFILE },
+ { LPGEN("MSN Services"), "services", IDI_SERVICES },
+ { LPGEN("Block user"), "block", IDI_MSNBLOCK },
+ { LPGEN("Invite to chat"), "invite", IDI_INVITE },
+ { LPGEN("Start Netmeeting"), "netmeeting", IDI_NETMEETING },
+ { LPGEN("Contact list"), "list_fl", IDI_LIST_FL },
+ { LPGEN("Allowed list"), "list_al", IDI_LIST_AL },
+ { LPGEN("Blocked list"), "list_bl", IDI_LIST_BL },
+ { LPGEN("Relative list"), "list_rl", IDI_LIST_RL },
+ { LPGEN("Local list"), "list_lc", IDI_LIST_LC },
};
-HANDLE hIconLibItem[SIZEOF(iconList)];
-
-
void MsnInitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
-
- char szSectionName[100];
- mir_snprintf(szSectionName, sizeof(szSectionName), "%s/%s", LPGEN("Protocols"), LPGEN("MSN"));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszSection = szSectionName;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++) {
- char szSettingName[100];
- mir_snprintf(szSettingName, sizeof(szSettingName), "MSN_%s", iconList[i].szName);
- sid.pszName = szSettingName;
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInst, "Protocols/MSN", iconList, SIZEOF(iconList), "MSN");
}
HICON LoadIconEx(const char* name, bool big)
@@ -86,7 +59,7 @@ HANDLE GetIconHandle(int iconId) {
for (unsigned i=0; i < SIZEOF(iconList); i++)
if (iconList[i].defIconID == iconId)
- return hIconLibItem[i];
+ return iconList[i].hIcolib;
return NULL;
}
diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp index 04ab200f66..202d58791e 100644 --- a/protocols/Omegle/src/theme.cpp +++ b/protocols/Omegle/src/theme.cpp @@ -24,63 +24,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. extern OBJLIST<OmegleProto> g_Instances;
-struct
-{
- const char* name;
- const char* descr;
- int defIconID;
- const char* section;
-}
-static const icons[] =
+static IconItem icons[] =
{
{ "omegle", LPGEN("Omegle Icon"), IDI_OMEGLE },
-// { "homepage", LPGEN("Visit Profile"), 0, "core_main_2" },
};
static HANDLE hIconLibItem[SIZEOF(icons)];
-// TODO: uninit
void InitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInstance, szFile, SIZEOF(szFile));
-
- char setting_name[100];
- char section_name[100];
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.pszName = setting_name;
- sid.pszSection = section_name;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i=0; i<SIZEOF(icons); i++) {
- if(icons[i].defIconID) {
- mir_snprintf(setting_name,sizeof(setting_name),"%s_%s","Omegle",icons[i].name);
-
- if (icons[i].section) {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s/%s",LPGEN("Protocols"),
- LPGEN("Omegle"), icons[i].section);
- } else {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s",LPGEN("Protocols"),
- LPGEN("Omegle"));
- }
-
- sid.pszDescription = (char*)icons[i].descr;
- sid.iDefaultIndex = -icons[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- } else { // External icons
- hIconLibItem[i] = Skin_GetIconHandle(icons[i].section);
- }
- }
+ Icon_Register(g_hInstance, "Protocols/Omegle", icons, SIZEOF(icons), "Omegle");
}
HANDLE GetIconHandle(const char* name)
{
for(size_t i=0; i<SIZEOF(icons); i++)
{
- if(strcmp(icons[i].name,name) == 0)
+ if(strcmp(icons[i].szName, name) == 0)
return hIconLibItem[i];
}
return 0;
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 8d6e8a5b0d..8fa54107fd 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -80,36 +80,31 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) return interfaces;
}
-struct
+static IconItem iconList[] =
{
- TCHAR* szDescr;
- char* szName;
- int defIconID;
- HANDLE hIconLibItem;
-}
-static iconList[] =
-{
- { LPGENT("Protocol icon"), "PROTO", IDI_TLEN },
- { LPGENT("Tlen inbox"), "MAIL", IDI_MAIL },
- { LPGENT("Group chats"), "MUC", IDI_MUC },
- { LPGENT("Tlen chats"), "CHATS", IDI_CHATS },
- { LPGENT("Grant authorization"), "GRANT", IDI_GRANT },
- { LPGENT("Request authorization"), "REQUEST", IDI_REQUEST },
- { LPGENT("Voice chat"), "VOICE", IDI_VOICE },
- { LPGENT("Microphone"), "MICROPHONE", IDI_MICROPHONE },
- { LPGENT("Speaker"), "SPEAKER", IDI_SPEAKER },
- { LPGENT("Send image"), "IMAGE", IDI_IMAGE }
+ { LPGEN("Protocol icon"), "PROTO", IDI_TLEN },
+ { LPGEN("Tlen inbox"), "MAIL", IDI_MAIL },
+ { LPGEN("Group chats"), "MUC", IDI_MUC },
+ { LPGEN("Tlen chats"), "CHATS", IDI_CHATS },
+ { LPGEN("Grant authorization"), "GRANT", IDI_GRANT },
+ { LPGEN("Request authorization"), "REQUEST", IDI_REQUEST },
+ { LPGEN("Voice chat"), "VOICE", IDI_VOICE },
+ { LPGEN("Microphone"), "MICROPHONE", IDI_MICROPHONE },
+ { LPGEN("Speaker"), "SPEAKER", IDI_SPEAKER },
+ { LPGEN("Send image"), "IMAGE", IDI_IMAGE }
};
-static HANDLE GetIconHandle(int iconId) {
- int i;
- for (i = 0; i < SIZEOF(iconList); i++)
+static HANDLE GetIconHandle(int iconId)
+{
+ for (int i = 0; i < SIZEOF(iconList); i++)
if (iconList[i].defIconID == iconId)
- return iconList[i].hIconLibItem;
+ return iconList[i].hIcolib;
+
return NULL;
}
-HICON GetIcolibIcon(int iconId) {
+HICON GetIcolibIcon(int iconId)
+{
HANDLE handle = GetIconHandle(iconId);
if (handle != NULL)
return Skin_GetIconByHandle(handle);
@@ -121,33 +116,9 @@ void ReleaseIcolibIcon(HICON hIcon) { Skin_ReleaseIcon(hIcon);
}
-/*
-static int TlenIconsChanged(void *ptr, WPARAM wParam, LPARAM lParam)
-{
- return 0;
-}
-*/
-
static void TlenRegisterIcons()
{
- TCHAR path[MAX_PATH], szSectionName[100];
- mir_sntprintf(szSectionName, SIZEOF( szSectionName ), _T("%s/%s"), _T("Protocols"), _T("Tlen"));
- GetModuleFileName(hInst, path, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.cx = sid.cy = 16;
- sid.ptszSection = szSectionName;
- sid.ptszDefaultFile = path;
- sid.flags = SIDF_ALL_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++ ) {
- char szSettingName[100];
- mir_snprintf( szSettingName, sizeof( szSettingName ), "TLEN_%s", iconList[i].szName );
- sid.pszName = szSettingName;
- sid.pszDescription = (char*)iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- iconList[i].hIconLibItem = Skin_AddIcon(&sid);;
- }
+ Icon_Register(hInst, "Protocols/Tlen", iconList, SIZEOF(iconList), "TLEN");
}
int TlenPrebuildContactMenu(void *ptr, WPARAM wParam, LPARAM lParam)
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index 3014c4523b..cb9dd71e9d 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -20,20 +20,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. extern OBJLIST<TwitterProto> g_Instances;
-struct
+static IconItem icons[] =
{
- const char* name;
- const char* descr;
- int defIconID;
- const char* section;
-}
-static const icons[] =
-{
- { "twitter", "Twitter Icon", IDI_TWITTER },
- { "tweet", "Tweet", IDI_TWITTER },
- { "reply", "Reply to Tweet", IDI_TWITTER },
+ { LPGEN("Twitter Icon"), "twitter", IDI_TWITTER },
+ { LPGEN("Tweet"), "tweet", IDI_TWITTER },
+ { LPGEN("Reply to Tweet"), "reply", IDI_TWITTER },
- { "homepage", "Visit Homepage", 0, "core_main_2" },
+ { LPGEN("Visit Homepage"), "homepage", 0 },
};
static HANDLE hIconLibItem[SIZEOF(icons)];
@@ -41,59 +34,19 @@ static HANDLE hIconLibItem[SIZEOF(icons)]; // TODO: uninit
void InitIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInstance, szFile, SIZEOF(szFile));
-
- char setting_name[100];
- char section_name[100];
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.pszName = setting_name;
- sid.pszSection = section_name;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i=0; i<SIZEOF(icons); i++)
- {
- if(icons[i].defIconID)
- {
- mir_snprintf(setting_name,sizeof(setting_name),"%s_%s","Twitter",icons[i].name);
-
- if (icons[i].section)
- {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s/%s",LPGEN("Protocols"),
- LPGEN("Twitter"), icons[i].section);
- }
- else
- {
- mir_snprintf(section_name,sizeof(section_name),"%s/%s",LPGEN("Protocols"),
- LPGEN("Twitter"));
- }
-
- sid.pszDescription = (char*)icons[i].descr;
- sid.iDefaultIndex = -icons[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
- else // External icons
- {
- hIconLibItem[i] = Skin_GetIconHandle(icons[i].section);
- }
- }
+ Icon_Register(g_hInstance, "Protocols/Twitter", icons, SIZEOF(icons), "Twitter");
+ icons[ SIZEOF(icons)-1 ].hIcolib = Skin_GetIconHandle("core_main_2");
}
HANDLE GetIconHandle(const char* name)
{
for(size_t i=0; i<SIZEOF(icons); i++)
- {
- if(strcmp(icons[i].name,name) == 0)
+ if(strcmp(icons[i].szName, name) == 0)
return hIconLibItem[i];
- }
+
return 0;
}
-
-
// Contact List menu stuff
static HANDLE g_hMenuItems[2];
static HANDLE g_hMenuEvts[3];
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 8bb1fe3397..808bc7dabc 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -142,6 +142,8 @@ PLUGININFOEX pluginInfoEx={ { 0x9b8e1735, 0x970d, 0x4ce0, { 0x93, 0xc, 0xa5, 0x61, 0x95, 0x6b, 0xdc, 0xa2 } }
};
+static IconItem icon = { LPGEN("Protocol icon"), "XFIRE_main", IDI_TM };
+
INT_PTR RecvMessage(WPARAM wParam, LPARAM lParam);
INT_PTR SendMessage(WPARAM wParam, LPARAM lParam);
@@ -1361,17 +1363,7 @@ extern "C" __declspec(dllexport) int Load(void) XFireLog("Wasn't able to get GetExtendedUdpTable function");
}
- char szFile[MAX_PATH];
- GetModuleFileNameA(hinstance, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszDefaultFile = szFile;
- sid.cx = sid.cy = 16;
- sid.ptszSection = LPGENT( "Protocols/XFire" );
- sid.pszName = "XFIRE_main";
- sid.ptszDescription = TranslateT("Protocol icon");
- sid.iDefaultIndex = -IDI_TM;
- Skin_AddIcon(&sid);
+ Icon_Register(hinstance, LPGENT("Protocols/XFire"), &icon, 1);
hExtraIcon1 = ExtraIcon_Register("xfire_game", "XFire game icon", "", ExtraListRebuild, ExtraImageApply);
hExtraIcon2 = ExtraIcon_Register("xfire_voice", "XFire voice icon", "", ExtraListRebuild, ExtraImageApply);
diff --git a/protocols/Yahoo/src/icolib.cpp b/protocols/Yahoo/src/icolib.cpp index 40ca82da25..eace62ab11 100644 --- a/protocols/Yahoo/src/icolib.cpp +++ b/protocols/Yahoo/src/icolib.cpp @@ -17,13 +17,8 @@ #include "resource.h"
-struct
+static IconItem iconList[] =
{
- const char* szDescr;
- const char* szName;
- int defIconID;
-}
-static iconList[] = {
{ LPGEN("Main"), "yahoo", IDI_YAHOO },
{ LPGEN("Mail"), "mail", IDI_INBOX },
{ LPGEN("Profile"), "profile", IDI_PROFILE },
@@ -37,26 +32,7 @@ HANDLE hIconLibItem[SIZEOF(iconList)]; void CYahooProto::IconsInit( void )
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInstance, szFile, SIZEOF(szFile));
-
- char szSectionName[100];
- mir_snprintf(szSectionName, sizeof(szSectionName), "%s/%s", LPGEN("Protocols"), LPGEN("YAHOO"));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszSection = szSectionName;
- sid.flags = SIDF_PATH_TCHAR;
-
- for ( int i = 0; i < SIZEOF(iconList); i++ ) {
- char szSettingName[100];
- mir_snprintf( szSettingName, sizeof( szSettingName ), "YAHOO_%s", iconList[i].szName );
-
- sid.pszName = szSettingName;
- sid.pszDescription = (char* )iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(hInstance, "Protocols/YAHOO", iconList, SIZEOF(iconList), "YAHOO");
}
HICON CYahooProto::LoadIconEx( const char* name, bool big )
diff --git a/src/core/miranda.h b/src/core/miranda.h index 3cfaab2b76..b89eeb3011 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -138,7 +138,6 @@ extern HANDLE hOkToExitEvent, hModulesLoadedEvent, hevLoadModule, hevUnloadModul /**** newplugins.cpp *******************************************************************/
char* GetPluginNameByInstance(HINSTANCE hInstance);
-int GetPluginLangByInstance(HINSTANCE hInstance);
int GetPluginFakeId(const MUUID &uuid, int hLangpack);
/**** utf.cpp **************************************************************************/
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index fae3bdd567..8ad41172ce 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -426,72 +426,52 @@ void RegisterFonts( void ) // add icons to the skinning module
-struct
+static IconItem iconList[] =
{
- int size;
- char* szSection;
- char* szDescr;
- char* szName;
- int defIconID;
-}
-static const iconList[] =
-{
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Window Icon"), "chat_window", IDI_CHANMGR },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Text colour"), "chat_fgcol", IDI_COLOR },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Background colour"), "chat_bkgcol", IDI_BKGCOLOR },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Bold"), "chat_bold", IDI_BBOLD },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Italics"), "chat_italics", IDI_BITALICS },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Underlined"), "chat_underline", IDI_BUNDERLINE },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Smiley button"), "chat_smiley", IDI_BSMILEY },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Room history"), "chat_history", IDI_HISTORY },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Room settings"), "chat_settings", IDI_TOPICBUT },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Event filter disabled"), "chat_filter", IDI_FILTER },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Event filter enabled"), "chat_filter2", IDI_FILTER2 },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Hide userlist"), "chat_nicklist", IDI_NICKLIST },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Show userlist"), "chat_nicklist2", IDI_NICKLIST2 },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY },
- { 0, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Close"), "chat_close", IDI_CLOSE },
-
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0 },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 2 (10x10)"), "chat_status1", IDI_STATUS1 },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2 },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3 },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4 },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats"), LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5 },
-
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Message in (10x10)"), "chat_log_message_in", IDI_MESSAGE },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Message out (10x10)"), "chat_log_message_out", IDI_MESSAGEOUT },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Action (10x10)"), "chat_log_action", IDI_ACTION },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Add Status (10x10)"), "chat_log_addstatus", IDI_ADDSTATUS },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Remove status (10x10)"), "chat_log_removestatus", IDI_REMSTATUS },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Join (10x10)"), "chat_log_join", IDI_JOIN },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Leave (10x10)"), "chat_log_part", IDI_PART },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Quit (10x10)"), "chat_log_quit", IDI_QUIT },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Kick (10x10)"), "chat_log_kick", IDI_KICK },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Nickchange (10x10)"), "chat_log_nick", IDI_NICK },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Notice (10x10)"), "chat_log_notice", IDI_NOTICE },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Topic (10x10)"), "chat_log_topic", IDI_TOPIC },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Highlight (10x10)"), "chat_log_highlight", IDI_HIGHLIGHT },
- { 10, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), LPGEN("Information (10x10)"), "chat_log_info", IDI_INFO }
+ { LPGEN("Window Icon"), "chat_window", IDI_CHANMGR, 0 },
+ { LPGEN("Text colour"), "chat_fgcol", IDI_COLOR, 0 },
+ { LPGEN("Background colour"), "chat_bkgcol", IDI_BKGCOLOR, 0 },
+ { LPGEN("Bold"), "chat_bold", IDI_BBOLD, 0 },
+ { LPGEN("Italics"), "chat_italics", IDI_BITALICS, 0 },
+ { LPGEN("Underlined"), "chat_underline", IDI_BUNDERLINE, 0 },
+ { LPGEN("Smiley button"), "chat_smiley", IDI_BSMILEY, 0 },
+ { LPGEN("Room history"), "chat_history", IDI_HISTORY, 0 },
+ { LPGEN("Room settings"), "chat_settings", IDI_TOPICBUT, 0 },
+ { LPGEN("Event filter disabled"), "chat_filter", IDI_FILTER, 0 },
+ { LPGEN("Event filter enabled"), "chat_filter2", IDI_FILTER2, 0 },
+ { LPGEN("Hide userlist"), "chat_nicklist", IDI_NICKLIST, 0 },
+ { LPGEN("Show userlist"), "chat_nicklist2", IDI_NICKLIST2, 0 },
+ { LPGEN("Icon overlay"), "chat_overlay", IDI_OVERLAY, 0 },
+ { LPGEN("Close"), "chat_close", IDI_CLOSE, 0 },
+
+ { LPGEN("Status 1 (10x10)"), "chat_status0", IDI_STATUS0, 10 },
+ { LPGEN("Status 2 (10x10)"), "chat_status1", IDI_STATUS1, 10 },
+ { LPGEN("Status 3 (10x10)"), "chat_status2", IDI_STATUS2, 10 },
+ { LPGEN("Status 4 (10x10)"), "chat_status3", IDI_STATUS3, 10 },
+ { LPGEN("Status 5 (10x10)"), "chat_status4", IDI_STATUS4, 10 },
+ { LPGEN("Status 6 (10x10)"), "chat_status5", IDI_STATUS5, 10 },
+
+ { LPGEN("Message in (10x10)"), "chat_log_message_in", IDI_MESSAGE, 10 },
+ { LPGEN("Message out (10x10)"), "chat_log_message_out", IDI_MESSAGEOUT, 10 },
+ { LPGEN("Action (10x10)"), "chat_log_action", IDI_ACTION, 10 },
+ { LPGEN("Add Status (10x10)"), "chat_log_addstatus", IDI_ADDSTATUS, 10 },
+ { LPGEN("Remove status (10x10)"), "chat_log_removestatus", IDI_REMSTATUS, 10 },
+ { LPGEN("Join (10x10)"), "chat_log_join", IDI_JOIN, 10 },
+ { LPGEN("Leave (10x10)"), "chat_log_part", IDI_PART, 10 },
+ { LPGEN("Quit (10x10)"), "chat_log_quit", IDI_QUIT, 10 },
+ { LPGEN("Kick (10x10)"), "chat_log_kick", IDI_KICK, 10 },
+ { LPGEN("Nickchange (10x10)"), "chat_log_nick", IDI_NICK, 10 },
+ { LPGEN("Notice (10x10)"), "chat_log_notice", IDI_NOTICE, 10 },
+ { LPGEN("Topic (10x10)"), "chat_log_topic", IDI_TOPIC, 10 },
+ { LPGEN("Highlight (10x10)"), "chat_log_highlight", IDI_HIGHLIGHT, 10 },
+ { LPGEN("Information (10x10)"), "chat_log_info", IDI_INFO, 10 }
};
void AddIcons(void)
{
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInst, szFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.flags = SIDF_PATH_TCHAR;
-
- for (int i = 0; i < SIZEOF(iconList); i++ ) {
- sid.cx = sid.cy = iconList[i].size;
- sid.pszSection = iconList[i].szSection;
- sid.pszDescription = iconList[i].szDescr;
- sid.pszName = iconList[i].szName;
- sid.iDefaultIndex = -iconList[i].defIconID;
- Skin_AddIcon(&sid);
-} }
+ Icon_Register(g_hInst, LPGEN("Messaging") "/" LPGEN("Group Chats"), iconList, 21);
+ Icon_Register(g_hInst, LPGEN("Messaging") "/" LPGEN("Group Chats Log"), iconList+21, 14);
+}
// load icons from the skinning module if available
HICON LoadIconEx( char* pszIcoLibName, BOOL big )
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index d60ce6d3fc..52e69a8860 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -26,43 +26,16 @@ static int dbaddedevent(WPARAM wParam, LPARAM lParam); static int ackevent(WPARAM wParam, LPARAM lParam);
static int AvatarChanged(WPARAM wParam, LPARAM lParam);
-typedef struct IconDefStruct
+IconItem iconList[] =
{
- char *szName;
- char *szDescr;
- int defIconID;
-} IconList;
-
-static const IconList iconList[] =
-{
- { "INCOMING", LPGEN("Incoming message (10x10)"), IDI_INCOMING },
- { "OUTGOING", LPGEN("Outgoing message (10x10)"), IDI_OUTGOING },
- { "NOTICE", LPGEN("Notice (10x10)"), IDI_NOTICE },
+ { LPGEN("Incoming message (10x10)"), "INCOMING", IDI_INCOMING, 10 },
+ { LPGEN("Outgoing message (10x10)"), "OUTGOING", IDI_OUTGOING, 10 },
+ { LPGEN("Notice (10x10)"), "NOTICE", IDI_NOTICE, 10 },
};
-
-HANDLE hIconLibItem[SIZEOF(iconList)];
-
static void InitIcons(void)
{
- char szSettingName[100];
-
- TCHAR szFile[MAX_PATH];
- GetModuleFileName(g_hInst, szFile, SIZEOF(szFile));
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.ptszDefaultFile = szFile;
- sid.pszName = szSettingName;
- sid.pszSection = LPGEN("Messaging");
- sid.flags = SIDF_PATH_TCHAR;
- sid.cx = 10; sid.cy = 10;
-
- for (int i=0; i < SIZEOF(iconList); i++) {
- mir_snprintf(szSettingName, sizeof(szSettingName), "SRMM_%s", iconList[i].szName);
- sid.pszDescription = iconList[i].szDescr;
- sid.iDefaultIndex = -iconList[i].defIconID;
- hIconLibItem[i] = Skin_AddIcon(&sid);
- }
+ Icon_Register(g_hInst, LPGEN("Messaging"), iconList, SIZEOF(iconList), "SRMM");
}
static int IconsChanged(WPARAM wParam, LPARAM lParam)
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 3596233975..89647cd226 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "commonheaders.h"
-extern HANDLE hIconLibItem[];
+extern IconItem iconList[];
static int logPixelSY;
#define LOGICON_MSG_IN 0
@@ -609,7 +609,7 @@ void LoadMsgLogIcons(void) pBmpBits = (PBYTE) mir_alloc(widthBytes * bih.biHeight);
for (i = 0; i < SIZEOF(pLogIconBmpBits); i++) {
- hIcon = Skin_GetIconByHandle(hIconLibItem[i]);
+ hIcon = Skin_GetIconByHandle(iconList[i].hIcolib);
pLogIconBmpBits[i] = (PBYTE) mir_alloc(RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2);
//I can't seem to get binary mode working. No matter.
rtfHeaderSize = sprintf((char*)pLogIconBmpBits[i], "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight);
diff --git a/src/core/stdplug.h b/src/core/stdplug.h index 00cecdbbfa..f7a6e49522 100644 --- a/src/core/stdplug.h +++ b/src/core/stdplug.h @@ -13,7 +13,7 @@ MIRANDA_EXE_FUNC(HANDLE) IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid); MIRANDA_EXE_FUNC(HICON) IcoLib_GetIcon(const char* pszIconName, bool big);
MIRANDA_EXE_FUNC(HICON) IcoLib_GetIconByHandle(HANDLE hItem, bool big);
MIRANDA_EXE_FUNC(HANDLE) IcoLib_IsManaged(HICON hIcon);
-MIRANDA_EXE_FUNC(int) IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big=false);
+MIRANDA_EXE_FUNC(int) IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big=false);
MIRANDA_EXE_FUNC(void) Button_SetIcon_IcoLib(HWND hDlg, int itemId, int iconId, const char* tooltip);
MIRANDA_EXE_FUNC(void) Button_FreeIcon_IcoLib(HWND hDlg, int itemId);
@@ -21,3 +21,5 @@ MIRANDA_EXE_FUNC(void) Button_FreeIcon_IcoLib(HWND hDlg, int itemId); MIRANDA_EXE_FUNC(void) Window_SetIcon_IcoLib(HWND hWnd, int iconId);
MIRANDA_EXE_FUNC(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char* szProto, int iconId);
MIRANDA_EXE_FUNC(void) Window_FreeIcon_IcoLib(HWND hWnd);
+
+MIRANDA_EXE_FUNC(int) GetPluginLangByInstance(HINSTANCE hInstance);
diff --git a/src/mir_core/icons.cpp b/src/mir_core/icons.cpp new file mode 100644 index 0000000000..74ba02c07c --- /dev/null +++ b/src/mir_core/icons.cpp @@ -0,0 +1,77 @@ +/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright 2012 Miranda NG project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "commonheaders.h"
+
+#include <m_icolib.h>
+#include "..\src\core\stdplug.h"
+
+MIR_CORE_DLL(void) Icon_Register(HINSTANCE hInst, const char *szSection, IconItem *pIcons, size_t iCount, char *prefix, int hLangpack)
+{
+ TCHAR szFile[MAX_PATH];
+ GetModuleFileName(hInst, szFile, MAX_PATH);
+
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.ptszDefaultFile = szFile;
+ sid.pszSection = (char*)szSection;
+ sid.flags = SIDF_PATH_TCHAR;
+
+ for (unsigned i = 0; i < iCount; i++) {
+ char szSetting[100];
+ if (prefix) {
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s_%s", prefix, pIcons[i].szName);
+ sid.pszName = szSetting;
+ }
+ else sid.pszName = pIcons[i].szName;
+
+ sid.cx = sid.cy = pIcons[i].size;
+ sid.pszDescription = pIcons[i].szDescr;
+ sid.iDefaultIndex = -pIcons[i].defIconID;
+ pIcons[i].hIcolib = (HANDLE)CallService("Skin2/Icons/AddIcon", hLangpack, (LPARAM)&sid);
+ }
+}
+
+MIR_CORE_DLL(void) Icon_RegisterT(HINSTANCE hInst, const TCHAR *szSection, IconItemT *pIcons, size_t iCount, char *prefix, int hLangpack)
+{
+ TCHAR szFile[MAX_PATH];
+ GetModuleFileName(hInst, szFile, MAX_PATH);
+
+ SKINICONDESC sid = { sizeof(sid) };
+ sid.ptszDefaultFile = szFile;
+ sid.ptszSection = (TCHAR*)szSection;
+ sid.flags = SIDF_ALL_TCHAR;
+
+ for (unsigned i = 0; i < iCount; i++) {
+ char szSetting[100];
+ if (prefix) {
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%s_%s", prefix, pIcons[i].szName);
+ sid.pszName = szSetting;
+ }
+ else sid.pszName = pIcons[i].szName;
+
+ sid.cx = sid.cy = pIcons[i].size;
+ sid.ptszDescription = pIcons[i].tszDescr;
+ sid.iDefaultIndex = -pIcons[i].defIconID;
+ pIcons[i].hIcolib = (HANDLE)CallService("Skin2/Icons/AddIcon", hLangpack, (LPARAM)&sid);
+ }
+}
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index df6cce1144..3958995c32 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -134,3 +134,5 @@ GetSubscribersCount @131 NotifyFastHook @132
db_find_first @133
db_find_next @134
+Icon_Register @135
+Icon_RegisterT @136
diff --git a/src/mir_core/mir_core_10.vcxproj b/src/mir_core/mir_core_10.vcxproj index edabb2b74f..c1cf98d550 100644 --- a/src/mir_core/mir_core_10.vcxproj +++ b/src/mir_core/mir_core_10.vcxproj @@ -27,6 +27,7 @@ </ItemGroup>
<ItemGroup>
<ClCompile Include="cmdline.cpp" />
+ <ClCompile Include="icons.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
diff --git a/src/mir_core/mir_core_10.vcxproj.filters b/src/mir_core/mir_core_10.vcxproj.filters index 61188b5100..9e472906fb 100644 --- a/src/mir_core/mir_core_10.vcxproj.filters +++ b/src/mir_core/mir_core_10.vcxproj.filters @@ -55,6 +55,9 @@ <ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="icons.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="commonheaders.h">
diff --git a/src/modules/extraicons/IcolibExtraIcon.cpp b/src/modules/extraicons/IcolibExtraIcon.cpp index 1b18b0f9c8..aa00b0efdc 100644 --- a/src/modules/extraicons/IcolibExtraIcon.cpp +++ b/src/modules/extraicons/IcolibExtraIcon.cpp @@ -82,7 +82,7 @@ int IcolibExtraIcon::setIcon(int id, HANDLE hContact, HANDLE hIcoLib) }
}
- IconItem *p = (IconItem*)hIcoLib;
+ IcolibItem *p = (IcolibItem*)hIcoLib;
char *szName = (p) ? p->name : NULL;
storeIcon(hContact, szName);
diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp index a1cfbf8c57..b47a5d4dd9 100644 --- a/src/modules/extraicons/extraicons.cpp +++ b/src/modules/extraicons/extraicons.cpp @@ -507,6 +507,13 @@ static INT_PTR svcExtraIcon_Add(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////
+static IconItem iconList[] =
+{
+ { LPGEN("Chat Activity"), "ChatActivity", IDI_CHAT },
+ { LPGEN("Male"), "gender_male", IDI_MALE },
+ { LPGEN("Female"), "gender_female", IDI_FEMALE }
+};
+
void LoadExtraIconsModule()
{
DWORD ret = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS2, 0);
@@ -525,28 +532,7 @@ void LoadExtraIconsModule() hEventExtraImageListRebuilding = CreateHookableEvent(ME_CLIST_EXTRA_LIST_REBUILD);
// Icons
- TCHAR tszFile[MAX_PATH];
- GetModuleFileName(NULL, tszFile, MAX_PATH);
-
- SKINICONDESC sid = { sizeof(sid) };
- sid.flags = SIDF_PATH_TCHAR;
- sid.ptszDefaultFile = tszFile;
- sid.pszSection = "Contact List";
-
- sid.pszName = "ChatActivity";
- sid.pszDescription = LPGEN("Chat Activity");
- sid.iDefaultIndex = -IDI_CHAT;
- Skin_AddIcon(&sid);
-
- sid.pszName = "gender_male";
- sid.pszDescription = LPGEN("Male");
- sid.iDefaultIndex = -IDI_MALE;
- Skin_AddIcon(&sid);
-
- sid.pszName = "gender_female";
- sid.pszDescription = LPGEN("Female");
- sid.iDefaultIndex = -IDI_FEMALE;
- Skin_AddIcon(&sid);
+ Icon_Register(NULL, "Contact List", iconList, SIZEOF(iconList));
// Hooks
HookEvent(ME_SYSTEM_MODULESLOADED, &ModulesLoaded);
diff --git a/src/modules/icolib/IcoLib.h b/src/modules/icolib/IcoLib.h index 550de7ad9b..ec93d2af62 100644 --- a/src/modules/icolib/IcoLib.h +++ b/src/modules/icolib/IcoLib.h @@ -56,7 +56,7 @@ struct IconSourceItem int icon_size;
};
-struct IconItem
+struct IcolibItem
{
char* name;
SectionItem* section;
@@ -90,15 +90,15 @@ int IconSourceItem_ReleaseIcon(IconSourceItem* item); HICON IconSourceItem_GetIcon(IconSourceItem* item);
IconSourceItem* GetIconSourceItem(const TCHAR* file, int indx, int cxIcon, int cyIcon);
-IconItem* IcoLib_FindHIcon(HICON hIcon, bool &big);
-IconItem* IcoLib_FindIcon(const char* pszIconName);
+IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big);
+IcolibItem* IcoLib_FindIcon(const char* pszIconName);
-HICON IconItem_GetIcon(IconItem* item, bool big);
+HICON IconItem_GetIcon(IcolibItem* item, bool big);
int SkinOptionsInit(WPARAM, LPARAM);
extern CRITICAL_SECTION csIconList;
-extern LIST<IconItem> iconList;
+extern LIST<IcolibItem> iconList;
extern LIST<SectionItem> sectionList;
extern BOOL bNeedRebuild;
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index eec1dff500..80bcfc5e9e 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -82,12 +82,12 @@ static int sttCompareIconSourceItems(const IconSourceItem* p1, const IconSourceI static LIST<IconSourceItem> iconSourceList(20, sttCompareIconSourceItems);
-static int sttCompareIcons(const IconItem* p1, const IconItem* p2)
+static int sttCompareIcons(const IcolibItem* p1, const IcolibItem* p2)
{
return strcmp(p1->name, p2->name);
}
-LIST<IconItem> iconList(20, sttCompareIcons);
+LIST<IcolibItem> iconList(20, sttCompareIcons);
/////////////////////////////////////////////////////////////////////////////////////////
// Utility functions
@@ -447,20 +447,20 @@ static void IcoLib_RemoveSection(SectionItem* section) }
}
-IconItem* IcoLib_FindIcon(const char* pszIconName)
+IcolibItem* IcoLib_FindIcon(const char* pszIconName)
{
int indx;
- IconItem key = { (char*)pszIconName };
+ IcolibItem key = { (char*)pszIconName };
if ((indx = iconList.getIndex(&key)) != -1)
return iconList[ indx ];
return NULL;
}
-IconItem* IcoLib_FindHIcon(HICON hIcon, bool &big)
+IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big)
{
for (int i = 0; i < iconList.getCount(); i++) {
- IconItem *p = iconList[i];
+ IcolibItem *p = iconList[i];
if ((void*)p == hIcon) {
big = (p->source_small == NULL);
return p;
@@ -478,7 +478,7 @@ IconItem* IcoLib_FindHIcon(HICON hIcon, bool &big) return NULL;
}
-static void IcoLib_FreeIcon(IconItem* icon)
+static void IcoLib_FreeIcon(IcolibItem* icon)
{
if ( !icon) return;
@@ -510,9 +510,9 @@ HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid) mir_cslock lck(csIconList);
- IconItem* item = IcoLib_FindIcon(sid->pszName);
+ IcolibItem* item = IcoLib_FindIcon(sid->pszName);
if (!item) {
- item = (IconItem*)mir_calloc(sizeof(IconItem));
+ item = (IcolibItem*)mir_calloc(sizeof(IcolibItem));
item->name = sid->pszName;
iconList.insert(item);
}
@@ -552,7 +552,7 @@ HANDLE IcoLib_AddNewIcon(int hLangpack, SKINICONDESC* sid) if (sid->hDefaultIcon) {
bool big;
- IconItem* def_item = IcoLib_FindHIcon(sid->hDefaultIcon, big);
+ IcolibItem* def_item = IcoLib_FindHIcon(sid->hDefaultIcon, big);
if (def_item) {
item->default_icon = big ? def_item->source_big : def_item->source_small;
item->default_icon->ref_count++;
@@ -581,8 +581,8 @@ static INT_PTR IcoLib_RemoveIcon(WPARAM, LPARAM lParam) mir_cslock lck(csIconList);
int i;
- if ((i = iconList.getIndex((IconItem*)&lParam)) != -1) {
- IconItem *item = iconList[ i ];
+ if ((i = iconList.getIndex((IcolibItem*)&lParam)) != -1) {
+ IcolibItem *item = iconList[ i ];
IcoLib_FreeIcon(item);
iconList.remove(i);
SAFE_FREE((void**)&item);
@@ -600,7 +600,7 @@ void KillModuleIcons(int hLangpack) mir_cslock lck(csIconList);
for (int i = iconList.getCount()-1; i >= 0; i--) {
- IconItem *item = iconList[i];
+ IcolibItem *item = iconList[i];
if ( item->hLangpack == hLangpack) {
IcoLib_FreeIcon(item);
iconList.remove(i);
@@ -612,7 +612,7 @@ void KillModuleIcons(int hLangpack) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetDefaultIcon
-HICON IconItem_GetDefaultIcon(IconItem* item, bool big)
+HICON IconItem_GetDefaultIcon(IcolibItem* item, bool big)
{
HICON hIcon = NULL;
@@ -660,7 +660,7 @@ HICON IconItem_GetDefaultIcon(IconItem* item, bool big) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetIcon
-HICON IconItem_GetIcon(IconItem* item, bool big)
+HICON IconItem_GetIcon(IcolibItem* item, bool big)
{
DBVARIANT dbv = {0};
HICON hIcon = NULL;
@@ -704,7 +704,7 @@ HICON IcoLib_GetIcon(const char* pszIconName, bool big) return hIconBlank;
mir_cslock lck(csIconList);
- IconItem* item = IcoLib_FindIcon(pszIconName);
+ IcolibItem* item = IcoLib_FindIcon(pszIconName);
return (item) ? IconItem_GetIcon(item, big) : NULL;
}
@@ -732,7 +732,7 @@ HICON IcoLib_GetIconByHandle(HANDLE hItem, bool big) return NULL;
mir_cslock lck(csIconList);
- IconItem* pi = (IconItem*)hItem;
+ IcolibItem* pi = (IcolibItem*)hItem;
if ( iconList.getIndex(pi) != -1)
return IconItem_GetIcon(pi, big);
@@ -762,7 +762,7 @@ static INT_PTR IcoLib_AddRef(WPARAM wParam, LPARAM) mir_cslock lck(csIconList);
bool big;
- IconItem *item = IcoLib_FindHIcon((HICON)wParam, big);
+ IcolibItem *item = IcoLib_FindHIcon((HICON)wParam, big);
INT_PTR res = 1;
if (item) {
@@ -865,7 +865,7 @@ void UnloadIcoLibModule(void) DeleteCriticalSection(&csIconList);
for (i = iconList.getCount()-1; i >= 0; i--) {
- IconItem* p = iconList[i];
+ IcolibItem* p = iconList[i];
iconList.remove(i);
IcoLib_FreeIcon(p);
mir_free(p);
diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index 09faff70e9..dc757297df 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -73,7 +73,7 @@ int IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big) {
mir_cslock lck(csIconList);
- IconItem *item = NULL;
+ IcolibItem *item = NULL;
if (szIconName)
item = IcoLib_FindIcon(szIconName);
@@ -98,7 +98,7 @@ int IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big) /////////////////////////////////////////////////////////////////////////////////////////
// IconItem_GetIcon_Preview
-HICON IconItem_GetIcon_Preview(IconItem* item)
+HICON IconItem_GetIcon_Preview(IcolibItem* item)
{
HICON hIcon = NULL;
@@ -154,7 +154,7 @@ static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive) mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[ indx ];
+ IcolibItem *item = iconList[ indx ];
if (item->default_file && item->section == sectionActive) {
_itot(item->default_indx, path + suffIndx, 10);
@@ -194,7 +194,7 @@ void LoadSubIcons(HWND htv, TCHAR *filename, HTREEITEM hItem) static void UndoChanges(int iconIndx, int cmd)
{
- IconItem *item = iconList[ iconIndx ];
+ IcolibItem *item = iconList[ iconIndx ];
if ( !item->temp_file && !item->temp_icon && item->temp_reset && cmd == ID_CANCELCHANGE)
item->temp_reset = FALSE;
@@ -320,7 +320,7 @@ void DoIconsChanged(HWND hwndDlg) mir_cslock lck(csIconList); // Destroy unused icons
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
if (item->source_small && !item->source_small->icon_ref_count) {
item->source_small->icon_ref_count++;
IconSourceItem_ReleaseIcon(item->source_small);
@@ -783,7 +783,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
if (item->section == sectionActive) {
lvi.pszText = item->getDescr();
HICON hIcon = item->temp_icon;
@@ -843,7 +843,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ListView_GetItem(hPreview, &lvi);
{
mir_cslock lck(csIconList);
- IconItem *item = iconList[ lvi.lParam ];
+ IcolibItem *item = iconList[ lvi.lParam ];
SAFE_FREE((void**)&item->temp_file);
SafeDestroyIcon(&item->temp_icon);
@@ -938,7 +938,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
if (item->temp_reset) {
DBDeleteContactSetting(NULL, "SkinIcons", item->name);
if (item->source_small != item->default_icon) {
@@ -960,7 +960,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_PREVIEW:
if (((LPNMHDR)lParam)->code == LVN_GETINFOTIP) {
- IconItem *item;
+ IcolibItem *item;
NMLVGETINFOTIP *pInfoTip = (NMLVGETINFOTIP *)lParam;
LVITEM lvi;
lvi.mask = LVIF_PARAM;
@@ -1022,7 +1022,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM {
mir_cslock lck(csIconList);
for (int indx = 0; indx < iconList.getCount(); indx++) {
- IconItem *item = iconList[indx];
+ IcolibItem *item = iconList[indx];
SAFE_FREE((void**)&item->temp_file);
SafeDestroyIcon(&item->temp_icon);
|