diff options
author | George Hazan <george.hazan@gmail.com> | 2012-12-01 13:25:11 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-12-01 13:25:11 +0000 |
commit | 854959cbc0a1bad2c086214be4d1a829b17a61f3 (patch) | |
tree | ee3de50f4b4e57f54ae20d139f97fa469ff90d34 /plugins/Popup | |
parent | 73ddc73d92675399e4619758d4b0881418de0a6d (diff) |
icolib: icon creation quirks
git-svn-id: http://svn.miranda-ng.org/main/trunk@2588 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup')
-rw-r--r-- | plugins/Popup/src/icons.cpp | 131 | ||||
-rw-r--r-- | plugins/Popup/src/notifications.cpp | 13 | ||||
-rw-r--r-- | plugins/Popup/src/opt_class.cpp | 16 |
3 files changed, 72 insertions, 88 deletions
diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index 32594dd464..b1ee0142c0 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.cpp @@ -32,52 +32,49 @@ Last change by : $Author: Merlin_de $ #include "headers.h"
-typedef struct _ICODESC
+struct
{
LPSTR pszName;
- LPTSTR ptszDesc;
- LPTSTR ptszSection;
- BOOL bfromIconPack;
+ LPSTR ptszDesc;
+ LPSTR ptszSection;
WORD idResource;
LPSTR pszIcon;
int size;
-} ICODESC;
-
-static ICODESC icoDesc[] =
+}
+static icoDesc[] =
{
//toolbar
- { ICO_TB_POPUP_ON, _T("Popups are enabled"), _T(SECT_TOLBAR), 0, IDI_POPUP, NULL, 0 },
- { ICO_TB_POPUP_OFF, _T("Popups are disabled"), _T(SECT_TOLBAR), 0, IDI_NOPOPUP, NULL, 0 },
+ { 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 },
+
//common popup
- { ICO_POPUP_ON, _T("Popups are enabled"), _T(SECT_POPUP), 0, IDI_POPUP, NULL, 0 },
- { ICO_POPUP_OFF, _T("Popups are disabled"), _T(SECT_POPUP), 0, IDI_NOPOPUP, NULL, 0 },
- { ICO_FAV, _T("With \"favourite\" overlay"), _T(SECT_POPUP), 0, IDI_PU_FAVOURITE, NULL, 0 },
- { ICO_FULLSCREEN, _T("With \"fullscreen\" overlay"), _T(SECT_POPUP), 0, IDI_PU_FULLSCREEN, NULL, 0 },
- { ICO_HISTORY, _T("Popup History"), _T(SECT_POPUP), 0, IDI_HISTORY, NULL, -1 },
- //misc (register is done inside notification service)
- //{ ICO_MISC_NOTIFY, _T("Notification"), _T(SECT_POPUP) _T(SECT_POPUP_MISC), 0, IDI_MB_INFO, NULL, 0 },
- //{ ICO_MISC_WARNING, _T("Warning"), _T(SECT_POPUP) _T(SECT_POPUP_MISC), 0, IDI_MB_WARN, NULL, 0 },
- //{ ICO_MISC_ERROR, _T("Error"), _T(SECT_POPUP) _T(SECT_POPUP_MISC), 0, IDI_MB_STOP, NULL, 0 },
+ { 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 },
+
//option
- { ICO_OPT_RELOAD, _T("Refresh skin list"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_RELOAD, NULL, 0 },
- { ICO_OPT_RESIZE, _T("Popup Placement"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_RESIZE, NULL, 0 },
- { ICO_OPT_OK, _T("OK"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_ACT_OK, NULL, 0 },
- { ICO_OPT_CANCEL, _T("Cancel"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_ACT_CLOSE, NULL, 0 },
- { ICO_OPT_GROUP, _T("Popup Group"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_OPT_GROUP, NULL, 0 },
- { ICO_OPT_DEF, _T("Show default"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_ACT_OK, NULL, 0 },
- { ICO_OPT_FAV, _T("Favorite Contact"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_OPT_FAVORITE, NULL, 0 },
- { ICO_OPT_FULLSCREEN, _T("Show in Fullscreen"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_OPT_FULLSCREEN, NULL, 0 },
- { ICO_OPT_BLOCK, _T("Blocked Contact"), _T(SECT_POPUP) _T(SECT_POPUP_OPT), 0, IDI_OPT_BLOCK, NULL, 0 },
+ { 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 },
+
//action
- { ICO_ACT_REPLY, _T("Quick Reply"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_REPLY, NULL, -1 },
- { ICO_ACT_PIN, _T("Pin Popup"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_PIN, NULL, -1 },
- { ICO_ACT_PINNED, _T("Pinned Popup"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_PINNED, NULL, -1 },
- { ICO_ACT_MESS, _T("Send Message"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_MESSAGE, NULL, -1 },
- { ICO_ACT_INFO, _T("User Details"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_INFO, NULL, -1 },
- { ICO_ACT_MENU, _T("Contact Menu"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_MENU, NULL, -1 },
- { ICO_ACT_ADD, _T("Add Contact Permanently"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_ADD, NULL, -1 },
- { ICO_ACT_CLOSE, _T("Dismiss Popup"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_CLOSE, NULL, -1 },
- { ICO_ACT_COPY, _T("Copy to clipboard"), _T(SECT_POPUP) _T(SECT_POPUP_ACT), 0, IDI_ACT_COPY, NULL, -1 }
+ { 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 }
};
@@ -94,52 +91,40 @@ HICON IcoLib_GetIcon(LPCSTR pszIcon, bool big) void InitIcons()
{
- SKINICONDESC sid;
- ZeroMemory(&sid, sizeof(sid));
- sid.cbSize = sizeof(sid);
- sid.flags = SIDF_ALL_TCHAR;
- TCHAR selfDLL[1024];
- GetModuleFileName(hInst, selfDLL, 1024);
+ 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.ptszDescription = icoDesc[i].ptszDesc; // [TRANSLATED-BY-CORE]
- sid.ptszSection = icoDesc[i].ptszSection; //must be always untranslatet !!!!!
-
- if(icoDesc[i].idResource==0){
- //use icon from icon lib
- sid.hDefaultIcon = Skin_GetIcon(icoDesc[i].pszIcon);
- sid.ptszDefaultFile = NULL;
- sid.iDefaultIndex = 0;
- }else{
- //load and register from popup.dll
- sid.hDefaultIcon = 0;
- sid.ptszDefaultFile = selfDLL;
- sid.iDefaultIndex = -icoDesc[i].idResource;
- }
+ 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;
- }
+ case -1:
+ sid.cx = sid.cy = 0;
+ break;
+
// small icons (16x16)
- case 0:{
- sid.cx = sid.cy = 16;
- break;
- }
+ case 0:
+ sid.cx = sid.cy = 16;
+ break;
+
// normal icons (32x32)
- case 1:{
- sid.cx = sid.cy = 32;
- break;
- }
+ case 1:
+ sid.cx = sid.cy = 32;
+ break;
+
// custom icon size
- default:{
- sid.cx = sid.cy = icoDesc[i].size;
- break;
- }
+ default:
+ sid.cx = sid.cy = icoDesc[i].size;
+ break;
}
Skin_AddIcon(&sid);
}
-}
\ No newline at end of file +}
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 9b5b953315..ccfc1a51cc 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -188,11 +188,11 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) HANDLE RegisterNotification(POPUPNOTIFICATION *notification)
{
POPUPTREEDATA *ptd = (POPUPTREEDATA *)mir_alloc(sizeof(POPUPTREEDATA));
- ptd->signature = PopupNotificationData_SIGNATURE;
- ptd->typ = 1;
- ptd->pszTreeRoot = mir_a2t(notification->lpzGroup);
- ptd->pszDescription = mir_a2t(notification->lpzName);
- ptd->notification = *notification;
+ ptd->signature = PopupNotificationData_SIGNATURE;
+ ptd->typ = 1;
+ ptd->pszTreeRoot = mir_a2t(notification->lpzGroup);
+ ptd->pszDescription = mir_a2t(notification->lpzName);
+ ptd->notification = *notification;
if (!ptd->notification.lpzLAction) ptd->notification.lpzLAction = POPUP_ACTION_NOTHING;
if (!ptd->notification.lpzRAction) ptd->notification.lpzRAction = POPUP_ACTION_DISMISS;
LoadNotificationSettings(ptd, "PopUpNotifications");
@@ -228,8 +228,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) mir_snprintf(section, sizeof(section), "PopUps/%s", notification->lpzGroup);
mir_snprintf(setting, sizeof(setting), "%s_%s_%s", MODULNAME, notification->lpzGroup, notification->lpzName);
- SKINICONDESC sid = {0};
- sid.cbSize = sizeof(sid);
+ SKINICONDESC sid = { sizeof(sid) };
sid.pszSection = section;
sid.cx = sid.cy = 16;
sid.pszName = setting;
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index af038bce55..2129b3de41 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -376,17 +376,17 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l //we work with a copy for preview
ptdPrev = (POPUPTREEDATA *)mir_alloc(sizeof(POPUPTREEDATA));
memcpy(ptdPrev, ptd, sizeof(POPUPTREEDATA));
- ptdPrev->enabled = ptd->enabled;
- ptdPrev->timeoutValue = ptd->timeoutValue;
- strcpy(ptdPrev->leftAction , ptd->leftAction); //geht noch nicht??
- strcpy(ptdPrev->rightAction , ptd->rightAction); //geht noch nicht??
- ptdPrev->disableWhen = ptd->disableWhen;
+ ptdPrev->enabled = ptd->enabled;
+ ptdPrev->timeoutValue = ptd->timeoutValue;
+ strcpy(ptdPrev->leftAction, ptd->leftAction); //geht noch nicht??
+ strcpy(ptdPrev->rightAction, ptd->rightAction); //geht noch nicht??
+ ptdPrev->disableWhen = ptd->disableWhen;
ppd.lchNotification = (HANDLE)ptdPrev;
}
- else if(ptd->typ == 2) {
- ppd.lchIcon = ptd->pupClass.hIcon;
- }
+ else if(ptd->typ == 2)
+ ppd.lchIcon = ptd->pupClass.hIcon;
+
CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY);
mir_free(ptdPrev); ptdPrev = NULL;
}
|