From 57abc51aad272a656282a52a460a47abe24e07d6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 20 Jun 2012 23:51:53 +0000 Subject: - MS_SKIN2_ADDICON replaced with Skin_AddIcon; - SKINICONDESC_SIZE* constants removed and replaced with sizeof(sid); - added SIDF_PATH_UNICODE for all plugins; - dynamic translation fixed in the icolib options dialog git-svn-id: http://svn.miranda-ng.org/main/trunk@507 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/QuickReplies/events.cpp | 42 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'plugins/QuickReplies/events.cpp') diff --git a/plugins/QuickReplies/events.cpp b/plugins/QuickReplies/events.cpp index fd4991423d..2227c6d6f1 100644 --- a/plugins/QuickReplies/events.cpp +++ b/plugins/QuickReplies/events.cpp @@ -35,7 +35,7 @@ INT_PTR QuickRepliesService(WPARAM, LPARAM) int OnModulesLoaded(WPARAM wParam, LPARAM lParam) { UnhookEvent(hOnModulesLoaded); - HICON hIcon = NULL; + HANDLE hIcon = NULL; char buttonName[32]; if (!ServiceExists(MS_QUICKREPLIES_SERVICE)) @@ -43,34 +43,26 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) iNumber = 0; hQuickRepliesService = CreateServiceFunction(MS_QUICKREPLIES_SERVICE, QuickRepliesService); } - else - iNumber = DBGetContactSettingByte(NULL, MODULE_NAME, "InstancesCount", 0); + else iNumber = DBGetContactSettingByte(NULL, MODULE_NAME, "InstancesCount", 0); DBWriteContactSettingByte(NULL, MODULE_NAME, "InstancesCount", iNumber + 1); hOnOptInitialized = HookEvent(ME_OPT_INITIALISE, OnOptInitialized); hOnButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, OnButtonPressed); - if (ServiceExists(MS_SKIN2_ADDICON)) - { - char buttonNameTranslated[32]; - mir_snprintf(buttonName, SIZEOF(buttonName), "Button %x", iNumber + 1); - mir_snprintf(buttonNameTranslated, SIZEOF(buttonNameTranslated), "%s %x",Translate("Button"), iNumber + 1); - - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(SKINICONDESC); - sid.pszSection = "TabSRMM/Quick Replies"; - sid.cx = sid.cy = 16; - sid.pszDescription = buttonNameTranslated; - sid.pszName = buttonName; - sid.hDefaultIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_QICON)); - - hIcon = (HICON)CallService(MS_SKIN2_ADDICON, 0, (LPARAM) &sid); - } - else - hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_QICON)); + char buttonNameTranslated[32]; + mir_snprintf(buttonName, SIZEOF(buttonName), "Button %x", iNumber + 1); + mir_snprintf(buttonNameTranslated, SIZEOF(buttonNameTranslated), "%s %x",Translate("Button"), iNumber + 1); - if (ServiceExists(MS_BB_ADDBUTTON)) - { + SKINICONDESC sid = {0}; + sid.cbSize = sizeof(sid); + sid.pszSection = "TabSRMM/Quick Replies"; + sid.cx = sid.cy = 16; + sid.pszDescription = buttonNameTranslated; + sid.pszName = buttonName; + sid.hDefaultIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_QICON)); + hIcon = Skin_AddIcon(&sid); + + if (ServiceExists(MS_BB_ADDBUTTON)) { mir_snprintf(buttonName, SIZEOF(buttonName), MODULE_NAME" %x", iNumber + 1); BBButton bbd = {0}; @@ -78,15 +70,13 @@ 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 = (HANDLE)hIcon; + bbd.hIcon = hIcon; bbd.dwButtonID = iNumber; bbd.dwDefPos = 220; CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); } - DestroyIcon(hIcon); - return 0; } -- cgit v1.2.3