From 82ae452fff08430d514f762f49e78fec90f88625 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 17 Mar 2013 15:06:11 +0000 Subject: - rest of memory leaks - code cleaning; git-svn-id: http://svn.miranda-ng.org/main/trunk@4078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/src/actions.cpp | 329 ++++++++++++++++-------------------- plugins/Popup/src/avatars.cpp | 2 +- plugins/Popup/src/config.cpp | 2 +- plugins/Popup/src/main.cpp | 6 +- plugins/Popup/src/notifications.cpp | 8 +- plugins/Popup/src/opt_adv.cpp | 56 +++--- plugins/Popup/src/opt_class.cpp | 4 +- plugins/Popup/src/opt_contacts.cpp | 4 +- plugins/Popup/src/opt_gen.cpp | 44 ++--- plugins/Popup/src/opt_skins.cpp | 22 +-- plugins/Popup/src/popup_thread.cpp | 2 +- plugins/Popup/src/popup_wnd2.cpp | 4 +- plugins/Popup/src/services.cpp | 2 +- plugins/Popup/src/skin.cpp | 4 +- plugins/Popup/src/srmm_menu.cpp | 8 +- 15 files changed, 234 insertions(+), 263 deletions(-) (limited to 'plugins/Popup/src') diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index d0ed93e550..1affca7df3 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -44,13 +44,12 @@ void LoadActions() { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_CLOSE,0), "General/Dismiss popup", 0}, { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_COPY,0), "General/Copy to clipboard", 0}, -//remove popup action + //remove popup action #if defined(_DEBUG) { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_POPUP_ON,0), "Popup Plus/Test action", PAF_ENABLED}, { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_CLOSE,0), "Popup Plus/Second test action", 0}, { sizeof(POPUPACTION), LoadSkinnedIcon(SKINICON_OTHER_MIRANDA), "Popup Plus/One more action", PAF_ENABLED}, #endif - }; for (int i=0; i < SIZEOF(actions); ++i) @@ -59,26 +58,23 @@ void LoadActions() void UnloadActions() { -// for (int i=0; i < gActions.getCount(); ++i) -// delete gActions[i]; + for (int i=0; i < gActions.getCount(); ++i) + delete gActions[i]; gActions.destroy(); } void RegisterAction(POPUPACTION *action) { int index; - if ((index = gActions.getIndex(action)) >= 0) - { + if ((index = gActions.getIndex(action)) >= 0) { DWORD flags = gActions[index]->flags; *gActions[index] = *action; gActions[index]->flags = flags; - } else - { - POPUPACTION *actionCopy = (POPUPACTION *)mir_alloc(sizeof(POPUPACTION)); + } + else { + POPUPACTION *actionCopy = new POPUPACTION; *actionCopy = *action; - actionCopy->flags = - DBGetContactSettingByte(NULL, "PopUpActions", actionCopy->lpzTitle, actionCopy->flags & PAF_ENABLED) ? - PAF_ENABLED : 0; + actionCopy->flags = db_get_b(NULL, "PopUpActions", actionCopy->lpzTitle, actionCopy->flags & PAF_ENABLED) ? PAF_ENABLED : 0; gActions.insert(actionCopy); } } @@ -161,76 +157,73 @@ void LoadOption_Actions() { PopUpOptions.overrideRight = DBGetContactSettingDword(NULL,MODULNAME, "OverrideRight", 0); } +static UINT controls[] = +{ + IDC_GRP_CUSTOMACTIONS, + IDC_TXT_CUSTOMACTIONS, + IDC_CHK_IMCONTACTSONLY, + IDC_CHK_CONTACTSONLY, + IDC_CHK_DONTCLOSE, + IDC_GRP_SIZEPOSITION, + IDC_CHK_LARGEICONS, + IDC_TXT_POSITION, + IDC_RD_TEXT, + IDC_RD_LEFTICONS, + IDC_RD_RIGHTICONS, + IDC_GRP_ACTIONS, + IDC_ACTIONS, + IDC_GRP_SIZEPOSITION2, + IDC_TXT_POSITION2, + IDC_CB_LEFT, + IDC_TXT_MIDDLE, + IDC_CB_MIDDLE, + IDC_TXT_RIGHT, + IDC_CB_RIGHT +}; + INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static bool windowInitialized = false; + int i; - static UINT controls[] = - { - IDC_GRP_CUSTOMACTIONS, - IDC_TXT_CUSTOMACTIONS, - IDC_CHK_IMCONTACTSONLY, - IDC_CHK_CONTACTSONLY, - IDC_CHK_DONTCLOSE, - IDC_GRP_SIZEPOSITION, - IDC_CHK_LARGEICONS, - IDC_TXT_POSITION, - IDC_RD_TEXT, - IDC_RD_LEFTICONS, - IDC_RD_RIGHTICONS, - IDC_GRP_ACTIONS, - IDC_ACTIONS, - IDC_GRP_SIZEPOSITION2, - IDC_TXT_POSITION2, - IDC_CB_LEFT, - IDC_TXT_MIDDLE, - IDC_CB_MIDDLE, - IDC_TXT_RIGHT, - IDC_CB_RIGHT - }; + switch (msg) { + case WM_INITDIALOG: + windowInitialized = false; - switch (msg) - { - case WM_INITDIALOG: - { - int i; - windowInitialized = false; + TranslateDialogDefault(hwnd); - TranslateDialogDefault(hwnd); + SendMessage(GetDlgItem(hwnd, IDC_ICO_INFO), STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_MISC_NOTIFY,0), 0); - SendMessage(GetDlgItem(hwnd, IDC_ICO_INFO), STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_MISC_NOTIFY,0), 0); + CheckDlgButton(hwnd, IDC_CHK_ENABLEACTIONS, PopUpOptions.actions&ACT_ENABLE ? TRUE : FALSE); + CheckDlgButton(hwnd, IDC_CHK_IMCONTACTSONLY, PopUpOptions.actions&ACT_DEF_IMONLY ? TRUE : FALSE); + CheckDlgButton(hwnd, IDC_CHK_CONTACTSONLY, PopUpOptions.actions&ACT_DEF_NOGLOBAL ? TRUE : FALSE); + CheckDlgButton(hwnd, IDC_CHK_DONTCLOSE, PopUpOptions.actions&ACT_DEF_KEEPWND ? TRUE : FALSE); + CheckDlgButton(hwnd, IDC_CHK_LARGEICONS, PopUpOptions.actions&ACT_LARGE ? TRUE : FALSE); + CheckDlgButton(hwnd, IDC_RD_TEXT, PopUpOptions.actions&ACT_TEXT ? TRUE : FALSE); + CheckDlgButton(hwnd, IDC_RD_LEFTICONS, PopUpOptions.actions&ACT_LEFTICONS ? TRUE : FALSE); + CheckDlgButton(hwnd, IDC_RD_RIGHTICONS, PopUpOptions.actions&ACT_RIGHTICONS ? TRUE : FALSE); - CheckDlgButton(hwnd, IDC_CHK_ENABLEACTIONS, PopUpOptions.actions&ACT_ENABLE ? TRUE : FALSE); - CheckDlgButton(hwnd, IDC_CHK_IMCONTACTSONLY, PopUpOptions.actions&ACT_DEF_IMONLY ? TRUE : FALSE); - CheckDlgButton(hwnd, IDC_CHK_CONTACTSONLY, PopUpOptions.actions&ACT_DEF_NOGLOBAL ? TRUE : FALSE); - CheckDlgButton(hwnd, IDC_CHK_DONTCLOSE, PopUpOptions.actions&ACT_DEF_KEEPWND ? TRUE : FALSE); - CheckDlgButton(hwnd, IDC_CHK_LARGEICONS, PopUpOptions.actions&ACT_LARGE ? TRUE : FALSE); - CheckDlgButton(hwnd, IDC_RD_TEXT, PopUpOptions.actions&ACT_TEXT ? TRUE : FALSE); - CheckDlgButton(hwnd, IDC_RD_LEFTICONS, PopUpOptions.actions&ACT_LEFTICONS ? TRUE : FALSE); - CheckDlgButton(hwnd, IDC_RD_RIGHTICONS, PopUpOptions.actions&ACT_RIGHTICONS ? TRUE : FALSE); + { + DWORD dwActiveItem = 0; + HWND hCombo = GetDlgItem(hwnd, IDC_CB_LEFT); + dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideLeft); + SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_SETCURSEL, dwActiveItem, 0); - { - DWORD dwActiveItem = 0; - HWND hCombo = GetDlgItem(hwnd, IDC_CB_LEFT); - dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideLeft); - SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_SETCURSEL, dwActiveItem, 0); - - dwActiveItem = 0; - hCombo = GetDlgItem(hwnd, IDC_CB_MIDDLE); - dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideMiddle); - SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_SETCURSEL, dwActiveItem, 0); - - dwActiveItem = 0; - hCombo = GetDlgItem(hwnd, IDC_CB_RIGHT); - dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideRight); - SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_SETCURSEL, dwActiveItem, 0); - } + dwActiveItem = 0; + hCombo = GetDlgItem(hwnd, IDC_CB_MIDDLE); + dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideMiddle); + SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_SETCURSEL, dwActiveItem, 0); + + dwActiveItem = 0; + hCombo = GetDlgItem(hwnd, IDC_CB_RIGHT); + dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideRight); + SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_SETCURSEL, dwActiveItem, 0); HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS); ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES|LVS_EX_LABELTIP); HIMAGELIST hImgList = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus()? ILC_COLOR32 : ILC_COLOR16), 10, 1); ListView_SetImageList(hwndList, hImgList, LVSIL_SMALL); - + LVCOLUMN column = {0}; column.mask = LVCF_TEXT|LVCF_WIDTH; column.pszText = TranslateT("Action"); @@ -242,8 +235,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM LIST groups(1, strcmp); - for (i = 0; i < gActions.getCount(); ++i) - { + for (i = 0; i < gActions.getCount(); ++i) { char szGroup[64]; char *szName = strchr(gActions[i]->lpzTitle, '/'); if (!szName) szName = gActions[i]->lpzTitle; @@ -284,129 +276,108 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } groups.destroy(); - + BOOL enabled = (PopUpOptions.actions&ACT_ENABLE) ? TRUE : FALSE; for (i = 0; i < SIZEOF(controls); ++i) EnableWindow(GetDlgItem(hwnd, controls[i]), enabled); - - windowInitialized = true; - break; } - - case WM_COMMAND: - { - switch (LOWORD(wParam)) + windowInitialized = true; + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_CHK_ENABLEACTIONS: + PopUpOptions.actions &= ~ACT_ENABLE; + PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_ENABLEACTIONS) ? ACT_ENABLE : 0; + SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); { - case IDC_CHK_ENABLEACTIONS: - { - PopUpOptions.actions &= ~ACT_ENABLE; - PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_ENABLEACTIONS) ? ACT_ENABLE : 0; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); - - BOOL enabled = (PopUpOptions.actions&ACT_ENABLE) ? TRUE : FALSE; - for (int i=0; i < SIZEOF(controls); ++i) - EnableWindow(GetDlgItem(hwnd, controls[i]), enabled); - break; - } - - case IDC_CHK_IMCONTACTSONLY: - PopUpOptions.actions &= ~ACT_DEF_IMONLY; - PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_IMCONTACTSONLY) ? ACT_DEF_IMONLY : 0; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); - break; - case IDC_CHK_CONTACTSONLY: - PopUpOptions.actions &= ~ACT_DEF_NOGLOBAL; - PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_CONTACTSONLY) ? ACT_DEF_NOGLOBAL : 0; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); - break; - case IDC_CHK_DONTCLOSE: - PopUpOptions.actions &= ~ACT_DEF_KEEPWND; - PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_DONTCLOSE) ? ACT_DEF_KEEPWND : 0; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); - break; - case IDC_CHK_LARGEICONS: - PopUpOptions.actions &= ~ACT_LARGE; - PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_LARGEICONS) ? ACT_LARGE : 0; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); - break; - case IDC_RD_TEXT: - PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS); - PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_ENABLEACTIONS) ? ACT_TEXT : 0; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); - break; - case IDC_RD_LEFTICONS: - PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS); - PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_RD_LEFTICONS) ? ACT_LEFTICONS : 0; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); - break; - case IDC_RD_RIGHTICONS: - PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS); - PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_RD_RIGHTICONS) ? ACT_RIGHTICONS : 0; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); - break; - case IDC_PREVIEW: - PopUpPreview(); - break; - case IDC_CB_LEFT: - case IDC_CB_MIDDLE: - case IDC_CB_RIGHT: - PopUpOptions.overrideLeft = SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_GETITEMDATA, - SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_GETCURSEL,0,0),0); - PopUpOptions.overrideMiddle = SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_GETITEMDATA, - SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_GETCURSEL,0,0),0); - PopUpOptions.overrideRight = SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_GETITEMDATA, - SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_GETCURSEL,0,0),0); - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); - break; + BOOL enabled = (PopUpOptions.actions & ACT_ENABLE) ? TRUE : FALSE; + for (i=0; i < SIZEOF(controls); ++i) + EnableWindow(GetDlgItem(hwnd, controls[i]), enabled); } break; + + case IDC_CHK_IMCONTACTSONLY: + PopUpOptions.actions &= ~ACT_DEF_IMONLY; + PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_IMCONTACTSONLY) ? ACT_DEF_IMONLY : 0; + SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + break; + case IDC_CHK_CONTACTSONLY: + PopUpOptions.actions &= ~ACT_DEF_NOGLOBAL; + PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_CONTACTSONLY) ? ACT_DEF_NOGLOBAL : 0; + SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + break; + case IDC_CHK_DONTCLOSE: + PopUpOptions.actions &= ~ACT_DEF_KEEPWND; + PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_DONTCLOSE) ? ACT_DEF_KEEPWND : 0; + SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + break; + case IDC_CHK_LARGEICONS: + PopUpOptions.actions &= ~ACT_LARGE; + PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_LARGEICONS) ? ACT_LARGE : 0; + SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + break; + case IDC_RD_TEXT: + PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS); + PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_ENABLEACTIONS) ? ACT_TEXT : 0; + SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + break; + case IDC_RD_LEFTICONS: + PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS); + PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_RD_LEFTICONS) ? ACT_LEFTICONS : 0; + SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + break; + case IDC_RD_RIGHTICONS: + PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS); + PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_RD_RIGHTICONS) ? ACT_RIGHTICONS : 0; + SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + break; + case IDC_PREVIEW: + PopUpPreview(); + break; + case IDC_CB_LEFT: + case IDC_CB_MIDDLE: + case IDC_CB_RIGHT: + PopUpOptions.overrideLeft = SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_GETITEMDATA, + SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_GETCURSEL,0,0),0); + PopUpOptions.overrideMiddle = SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_GETITEMDATA, + SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_GETCURSEL,0,0),0); + PopUpOptions.overrideRight = SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_GETITEMDATA, + SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_GETCURSEL,0,0),0); + SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); } + break; + + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->idFrom) { + case 0: + switch (((LPNMHDR)lParam)->code) { + case PSN_RESET: + LoadOption_Actions(); + break; - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->idFrom) - { - case 0: - { - switch (((LPNMHDR)lParam)->code) - { - case PSN_RESET: - LoadOption_Actions(); - break; - case PSN_APPLY: - { - DBWriteContactSettingDword(NULL, MODULNAME, "Actions", PopUpOptions.actions); - HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS); - for (int i=0; i < gActions.getCount(); ++i) - { - gActions[i]->flags = (ListView_GetItemState(hwndList, i, LVIS_STATEIMAGEMASK) == 0x2000) ? PAF_ENABLED : 0; - DBWriteContactSettingByte(NULL, "PopUpActions", gActions[i]->lpzTitle, (gActions[i]->flags&PAF_ENABLED) ? 1 : 0); - } - //overrideActions - DBWriteContactSettingDword(NULL, MODULNAME, "OverrideLeft", PopUpOptions.overrideLeft); - DBWriteContactSettingDword(NULL, MODULNAME, "OverrideMiddle", PopUpOptions.overrideMiddle); - DBWriteContactSettingDword(NULL, MODULNAME, "OverrideRight", PopUpOptions.overrideRight); - break; - } - } - break; - } + case PSN_APPLY: + db_set_dw(NULL, MODULNAME, "Actions", PopUpOptions.actions); + HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS); - case IDC_ACTIONS: - { - NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; - if (windowInitialized && - nmlv && nmlv->hdr.code == LVN_ITEMCHANGED && nmlv->uOldState != 0 && - (nmlv->uNewState == 0x1000 || nmlv->uNewState == 0x2000)) - { - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); - } - break; + for (i=0; i < gActions.getCount(); ++i) { + gActions[i]->flags = (ListView_GetItemState(hwndList, i, LVIS_STATEIMAGEMASK) == 0x2000) ? PAF_ENABLED : 0; + db_set_b(NULL, "PopUpActions", gActions[i]->lpzTitle, (gActions[i]->flags&PAF_ENABLED) ? 1 : 0); } + + //overrideActions + db_set_dw(NULL, MODULNAME, "OverrideLeft", PopUpOptions.overrideLeft); + db_set_dw(NULL, MODULNAME, "OverrideMiddle", PopUpOptions.overrideMiddle); + db_set_dw(NULL, MODULNAME, "OverrideRight", PopUpOptions.overrideRight); } - break; } + break; + case IDC_ACTIONS: + NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; + if (windowInitialized && nmlv && nmlv->hdr.code == LVN_ITEMCHANGED && nmlv->uOldState != 0 && (nmlv->uNewState == 0x1000 || nmlv->uNewState == 0x2000)) + SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + break; } return FALSE; } diff --git a/plugins/Popup/src/avatars.cpp b/plugins/Popup/src/avatars.cpp index 059bfa1b97..e7d90a396f 100644 --- a/plugins/Popup/src/avatars.cpp +++ b/plugins/Popup/src/avatars.cpp @@ -37,7 +37,7 @@ PopupAvatar *PopupAvatar::create(HANDLE hContact) if (!_tcsicmp(av->szFilename+_tcslen(av->szFilename)-4, _T(".gif"))) { // MessageBox(NULL, _T("02"), _T(MODULNAME_LONG), MB_OK); - if (DBGetContactSettingByte(NULL, MODULNAME, "EnableGifAnimation", 1) && GDIPlus_IsAnimatedGIF(av->szFilename)) + if (db_get_b(NULL, MODULNAME, "EnableGifAnimation", 1) && GDIPlus_IsAnimatedGIF(av->szFilename)) { // MessageBox(NULL, _T("03"), _T(MODULNAME_LONG), MB_OK); return new GifAvatar(hContact); diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index 1b0ecaee13..d4c88ff200 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -72,7 +72,7 @@ HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurB void LoadOptions() { ZeroMemory(&PopUpOptions, sizeof(PopUpOptions)); #if defined(_DEBUG) - PopUpOptions.debug = DBGetContactSettingByte(NULL, MODULNAME, "debug", FALSE); + PopUpOptions.debug = db_get_b(NULL, MODULNAME, "debug", FALSE); #endif //Load PopUp Options diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 9eb494ad05..be8ba531fb 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -168,7 +168,7 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM wp, LPARAM lp) //The module is enabled. //The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. PopUpOptions.ModuleIsEnabled = FALSE; - DBWriteContactSettingByte(NULL, MODULNAME, "ModuleIsEnabled", FALSE); + db_set_b(NULL, MODULNAME, "ModuleIsEnabled", FALSE); mi.ptszName = LPGENT("Enable &popup module"); mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF,0); } @@ -176,7 +176,7 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM wp, LPARAM lp) //The module is disabled. //The action to do is enable popups (show enabled), then write "disable popup" in the new item. PopUpOptions.ModuleIsEnabled = TRUE; - DBWriteContactSettingByte(NULL, MODULNAME, "ModuleIsEnabled", TRUE); + db_set_b(NULL, MODULNAME, "ModuleIsEnabled", TRUE); mi.ptszName = LPGENT("Disable &popup module"); mi.hIcon = IcoLib_GetIcon(ICO_POPUP_ON,0); } @@ -352,7 +352,7 @@ MIRAPI int Load(void) CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus); #if defined(_DEBUG) - PopUpOptions.debug = DBGetContactSettingByte(NULL, MODULNAME, "debug", FALSE); + PopUpOptions.debug = db_get_b(NULL, MODULNAME, "debug", FALSE); #else PopUpOptions.debug = false; #endif diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 5c01266b9f..40b971e160 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -102,7 +102,7 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}enabled", ptd->notification.lpzGroup, ptd->notification.lpzName); - DBWriteContactSettingByte(NULL, szModul, setting, ptd->enabled); + db_set_b(NULL, szModul, setting, ptd->enabled); mir_snprintf(setting, sizeof(setting), "{%s/%s}TimeoutVal", ptd->notification.lpzGroup, @@ -112,7 +112,7 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}disableWhen", ptd->notification.lpzGroup, ptd->notification.lpzName); - DBWriteContactSettingByte(NULL, szModul, setting, ptd->disableWhen); + db_set_b(NULL, szModul, setting, ptd->disableWhen); mir_snprintf(setting, sizeof(setting), "{%s/%s}leftAction", ptd->notification.lpzGroup, @@ -154,7 +154,7 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}enabled", ptd->notification.lpzGroup, ptd->notification.lpzName); ptd->enabled = - (signed char)DBGetContactSettingByte(NULL, szModul, setting, TRUE); + (signed char)db_get_b(NULL, szModul, setting, TRUE); mir_snprintf(setting, sizeof(setting), "{%s/%s}Timeout", ptd->notification.lpzGroup, ptd->notification.lpzName); ptd->notification.iSeconds = @@ -167,7 +167,7 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}disableWhen", ptd->notification.lpzGroup, ptd->notification.lpzName); ptd->disableWhen = - DBGetContactSettingByte(NULL, szModul, setting, 0); + db_get_b(NULL, szModul, setting, 0); mir_snprintf(setting, sizeof(setting), "{%s/%s}leftAction", ptd->notification.lpzGroup, ptd->notification.lpzName); szTmp = DBGetContactSettingString(NULL, szModul, setting, ptd->notification.lpzLAction); diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 74b023f389..bc2c5db587 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -43,25 +43,25 @@ void OptAdv_UnregisterVfx() { //Main Dialog Proc void LoadOption_AdvOpts() { //History - PopUpOptions.EnableHistory = DBGetContactSettingByte (NULL,MODULNAME, "EnableHistory", TRUE); + PopUpOptions.EnableHistory = db_get_b (NULL,MODULNAME, "EnableHistory", TRUE); PopUpOptions.HistorySize = DBGetContactSettingWord (NULL,MODULNAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT); - PopUpOptions.UseHppHistoryLog = DBGetContactSettingByte (NULL,MODULNAME, "UseHppHistoryLog", TRUE); + PopUpOptions.UseHppHistoryLog = db_get_b (NULL,MODULNAME, "UseHppHistoryLog", TRUE); //Avatars - PopUpOptions.avatarBorders = DBGetContactSettingByte (NULL,MODULNAME, "AvatarBorders", TRUE); - PopUpOptions.avatarPNGBorders = DBGetContactSettingByte (NULL,MODULNAME, "AvatarPNGBorders", FALSE); - PopUpOptions.avatarRadius = DBGetContactSettingByte (NULL,MODULNAME, "AvatarRadius", 2); + PopUpOptions.avatarBorders = db_get_b (NULL,MODULNAME, "AvatarBorders", TRUE); + PopUpOptions.avatarPNGBorders = db_get_b (NULL,MODULNAME, "AvatarPNGBorders", FALSE); + PopUpOptions.avatarRadius = db_get_b (NULL,MODULNAME, "AvatarRadius", 2); PopUpOptions.avatarSize = DBGetContactSettingWord (NULL,MODULNAME, "AvatarSize", SETTING_AVTSIZE_DEFAULT); - PopUpOptions.EnableAvatarUpdates = DBGetContactSettingByte (NULL,MODULNAME, "EnableAvatarUpdates", FALSE); + PopUpOptions.EnableAvatarUpdates = db_get_b (NULL,MODULNAME, "EnableAvatarUpdates", FALSE); //Monitor - PopUpOptions.Monitor = DBGetContactSettingByte (NULL,MODULNAME, "Monitor", SETTING_MONITOR_DEFAULT); + PopUpOptions.Monitor = db_get_b (NULL,MODULNAME, "Monitor", SETTING_MONITOR_DEFAULT); //Transparency - PopUpOptions.Enable9xTransparency = DBGetContactSettingByte (NULL,MODULNAME, "EnableRegionTransparency", TRUE); - PopUpOptions.UseTransparency = DBGetContactSettingByte (NULL,MODULNAME, "UseTransparency", TRUE); - PopUpOptions.Alpha = DBGetContactSettingByte (NULL,MODULNAME, "Alpha", SETTING_ALPHA_DEFAULT); - PopUpOptions.OpaqueOnHover = DBGetContactSettingByte (NULL,MODULNAME, "OpaqueOnHover", TRUE); + PopUpOptions.Enable9xTransparency = db_get_b (NULL,MODULNAME, "EnableRegionTransparency", TRUE); + PopUpOptions.UseTransparency = db_get_b (NULL,MODULNAME, "UseTransparency", TRUE); + PopUpOptions.Alpha = db_get_b (NULL,MODULNAME, "Alpha", SETTING_ALPHA_DEFAULT); + PopUpOptions.OpaqueOnHover = db_get_b (NULL,MODULNAME, "OpaqueOnHover", TRUE); //Effects - PopUpOptions.UseAnimations = DBGetContactSettingByte (NULL,MODULNAME, "UseAnimations", TRUE); - PopUpOptions.UseEffect = DBGetContactSettingByte (NULL,MODULNAME, "Fade", TRUE); + PopUpOptions.UseAnimations = db_get_b (NULL,MODULNAME, "UseAnimations", TRUE); + PopUpOptions.UseEffect = db_get_b (NULL,MODULNAME, "Fade", TRUE); PopUpOptions.Effect = (LPTSTR)DBGetContactSettingStringX(NULL,MODULNAME, "Effect", "", DBVT_TCHAR); PopUpOptions.FadeIn = DBGetContactSettingDword(NULL,MODULNAME, "FadeInTime", SETTING_FADEINTIME_DEFAULT); PopUpOptions.FadeOut = DBGetContactSettingDword(NULL,MODULNAME, "FadeOutTime",SETTING_FADEOUTTIME_DEFAULT); @@ -526,30 +526,30 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case PSN_APPLY: { //History - DBWriteContactSettingByte (NULL,MODULNAME, "EnableHistory", (BYTE)PopUpOptions.EnableHistory); + db_set_b (NULL,MODULNAME, "EnableHistory", (BYTE)PopUpOptions.EnableHistory); DBWriteContactSettingWord (NULL,MODULNAME, "HistorySize", PopUpOptions.HistorySize); PopupHistoryResize(); - DBWriteContactSettingByte (NULL,MODULNAME, "UseHppHistoryLog", PopUpOptions.UseHppHistoryLog); + db_set_b (NULL,MODULNAME, "UseHppHistoryLog", PopUpOptions.UseHppHistoryLog); //Avatars - DBWriteContactSettingByte (NULL,MODULNAME, "AvatarBorders", PopUpOptions.avatarBorders); - DBWriteContactSettingByte (NULL,MODULNAME, "AvatarPNGBorders", PopUpOptions.avatarPNGBorders); - DBWriteContactSettingByte (NULL,MODULNAME, "AvatarRadius", PopUpOptions.avatarRadius); + db_set_b (NULL,MODULNAME, "AvatarBorders", PopUpOptions.avatarBorders); + db_set_b (NULL,MODULNAME, "AvatarPNGBorders", PopUpOptions.avatarPNGBorders); + db_set_b (NULL,MODULNAME, "AvatarRadius", PopUpOptions.avatarRadius); DBWriteContactSettingWord (NULL,MODULNAME, "AvatarSize", PopUpOptions.avatarSize); - DBWriteContactSettingByte (NULL,MODULNAME, "EnableAvatarUpdates", PopUpOptions.EnableAvatarUpdates); + db_set_b (NULL,MODULNAME, "EnableAvatarUpdates", PopUpOptions.EnableAvatarUpdates); //Monitor - DBWriteContactSettingByte (NULL,MODULNAME, "Monitor", PopUpOptions.Monitor); + db_set_b (NULL,MODULNAME, "Monitor", PopUpOptions.Monitor); //Transparency - DBWriteContactSettingByte (NULL,MODULNAME, "EnableRegionTransparency", PopUpOptions.Enable9xTransparency); - DBWriteContactSettingByte (NULL,MODULNAME, "UseTransparency", PopUpOptions.UseTransparency); - DBWriteContactSettingByte (NULL,MODULNAME, "Alpha", PopUpOptions.Alpha); - DBWriteContactSettingByte (NULL,MODULNAME, "OpaqueOnHover", PopUpOptions.OpaqueOnHover); + db_set_b (NULL,MODULNAME, "EnableRegionTransparency", PopUpOptions.Enable9xTransparency); + db_set_b (NULL,MODULNAME, "UseTransparency", PopUpOptions.UseTransparency); + db_set_b (NULL,MODULNAME, "Alpha", PopUpOptions.Alpha); + db_set_b (NULL,MODULNAME, "OpaqueOnHover", PopUpOptions.OpaqueOnHover); //Effects - DBWriteContactSettingByte (NULL,MODULNAME, "UseAnimations", PopUpOptions.UseAnimations); - DBWriteContactSettingByte (NULL,MODULNAME, "Fade", PopUpOptions.UseEffect); + db_set_b (NULL,MODULNAME, "UseAnimations", PopUpOptions.UseAnimations); + db_set_b (NULL,MODULNAME, "Fade", PopUpOptions.UseEffect); DBWriteContactSettingTString(NULL, MODULNAME, "Effect", PopUpOptions.Effect); - DBWriteContactSettingDword(NULL,MODULNAME, "FadeInTime", PopUpOptions.FadeIn); - DBWriteContactSettingDword(NULL,MODULNAME, "FadeOutTime", PopUpOptions.FadeOut); + db_set_dw(NULL,MODULNAME, "FadeInTime", PopUpOptions.FadeIn); + db_set_dw(NULL,MODULNAME, "FadeOutTime", PopUpOptions.FadeOut); //other old stuff DBWriteContactSettingWord (NULL,MODULNAME, "MaxPopups", (BYTE)PopUpOptions.MaxPopups); } diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 246eef9bfa..eb4978b1d6 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -500,7 +500,7 @@ void LoadClassSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "%s/enabled", ptd->pupClass.pszName); ptd->enabled = - (signed char)DBGetContactSettingByte(NULL, szModul, setting, TRUE); + (signed char)db_get_b(NULL, szModul, setting, TRUE); mir_snprintf(setting, sizeof(setting), "%s/Timeout", ptd->pupClass.pszName); ptd->pupClass.iSeconds = @@ -527,7 +527,7 @@ void SaveClassSettings(POPUPTREEDATA *ptd, char* szModul) char setting[2*MAXMODULELABELLENGTH]; mir_snprintf(setting, sizeof(setting), "%s/enabled", ptd->pupClass.pszName); - DBWriteContactSettingByte(NULL, szModul, setting, ptd->enabled); + db_set_b(NULL, szModul, setting, ptd->enabled); mir_snprintf(setting, sizeof(setting), "%s/Timeout", ptd->pupClass.pszName); DBWriteContactSettingWord(NULL, szModul, setting, ptd->pupClass.iSeconds); diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index 46d735dfd4..84e528ea03 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -110,7 +110,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l { if (SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0))) { - DBWriteContactSettingByte(hContact, MODULNAME, "ShowMode", i); + db_set_b(hContact, MODULNAME, "ShowMode", i); break; } } @@ -146,7 +146,7 @@ static void sttSetAllContactIcons(HWND hwndList) hContact=db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); - DWORD dwMode = DBGetContactSettingByte(hContact, MODULNAME, "ShowMode", 0); + DWORD dwMode = db_get_b(hContact, MODULNAME, "ShowMode", 0); for (int i=0; i < 4 /*SIZEOF(sttIcons)*/; ++i) //hIml element [0] = SKINICON_OTHER_SMALLDOT //hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 863fdabe4b..9fc6001e8e 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -87,15 +87,15 @@ int AddStatusModes(OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flags) //Main Dialog Proc void LoadOption_General() { //Seconds - PopUpOptions.InfiniteDelay = DBGetContactSettingByte(NULL, MODULNAME, "InfiniteDelay", FALSE); + PopUpOptions.InfiniteDelay = db_get_b(NULL, MODULNAME, "InfiniteDelay", FALSE); PopUpOptions.Seconds = DBGetContactSettingRangedWord(NULL, MODULNAME, "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX); - PopUpOptions.LeaveHovered = DBGetContactSettingByte(NULL, MODULNAME, "LeaveHovered", TRUE); + PopUpOptions.LeaveHovered = db_get_b(NULL, MODULNAME, "LeaveHovered", TRUE); //Dynamic Resize - PopUpOptions.DynamicResize = DBGetContactSettingByte(NULL, MODULNAME, "DynamicResize", FALSE); - PopUpOptions.UseMinimumWidth = DBGetContactSettingByte(NULL, MODULNAME, "UseMinimumWidth", TRUE); + PopUpOptions.DynamicResize = db_get_b(NULL, MODULNAME, "DynamicResize", FALSE); + PopUpOptions.UseMinimumWidth = db_get_b(NULL, MODULNAME, "UseMinimumWidth", TRUE); PopUpOptions.MinimumWidth = DBGetContactSettingWord(NULL, MODULNAME, "MinimumWidth", 160); - PopUpOptions.UseMaximumWidth = DBGetContactSettingByte(NULL, MODULNAME, "UseMaximumWidth", TRUE); + PopUpOptions.UseMaximumWidth = db_get_b(NULL, MODULNAME, "UseMaximumWidth", TRUE); PopUpOptions.MaximumWidth = DBGetContactSettingWord(NULL, MODULNAME, "MaximumWidth", 300); //Position PopUpOptions.Position = DBGetContactSettingRangedByte(NULL, MODULNAME, "Position", @@ -110,11 +110,11 @@ void LoadOption_General() { PopUpOptions.Spreading = DBGetContactSettingRangedByte(NULL, MODULNAME, "Spreading", SPREADING_VERTICAL, SPREADING_MINVALUE, SPREADING_MAXVALUE); //miscellaneous - PopUpOptions.ReorderPopUps = DBGetContactSettingByte(NULL, MODULNAME, "ReorderPopUps", TRUE); - PopUpOptions.ReorderPopUpsWarning = DBGetContactSettingByte(NULL, MODULNAME, "ReorderPopUpsWarning", TRUE); + PopUpOptions.ReorderPopUps = db_get_b(NULL, MODULNAME, "ReorderPopUps", TRUE); + PopUpOptions.ReorderPopUpsWarning = db_get_b(NULL, MODULNAME, "ReorderPopUpsWarning", TRUE); //disable When - PopUpOptions.ModuleIsEnabled = DBGetContactSettingByte(NULL, MODULNAME, "ModuleIsEnabled", TRUE); - PopUpOptions.DisableWhenFullscreen = DBGetContactSettingByte(NULL, MODULNAME, "DisableWhenFullscreen", TRUE); + PopUpOptions.ModuleIsEnabled = db_get_b(NULL, MODULNAME, "ModuleIsEnabled", TRUE); + PopUpOptions.DisableWhenFullscreen = db_get_b(NULL, MODULNAME, "DisableWhenFullscreen", TRUE); //new status options (done inside WM_INITDIALOG) //Debug (done inside LoadOptions()) } @@ -348,7 +348,7 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { PopUpOptions.ReorderPopUps = !PopUpOptions.ReorderPopUps; PopUpOptions.ReorderPopUpsWarning = PopUpOptions.ReorderPopUps ? - DBGetContactSettingByte(NULL, MODULNAME, "ReorderPopUpsWarning", TRUE) : TRUE; + db_get_b(NULL, MODULNAME, "ReorderPopUpsWarning", TRUE) : TRUE; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; @@ -513,17 +513,17 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return TRUE; case PSN_APPLY: { //Seconds - DBWriteContactSettingByte(NULL, MODULNAME, "InfiniteDelay", PopUpOptions.InfiniteDelay); + db_set_b(NULL, MODULNAME, "InfiniteDelay", PopUpOptions.InfiniteDelay); DBWriteContactSettingWord(NULL, MODULNAME, "Seconds", (WORD)PopUpOptions.Seconds); - DBWriteContactSettingByte(NULL, MODULNAME, "LeaveHovered", PopUpOptions.LeaveHovered); + db_set_b(NULL, MODULNAME, "LeaveHovered", PopUpOptions.LeaveHovered); //Dynamic Resize - DBWriteContactSettingByte(NULL, MODULNAME, "DynamicResize", PopUpOptions.DynamicResize); - DBWriteContactSettingByte(NULL, MODULNAME, "UseMinimumWidth", PopUpOptions.UseMinimumWidth); + db_set_b(NULL, MODULNAME, "DynamicResize", PopUpOptions.DynamicResize); + db_set_b(NULL, MODULNAME, "UseMinimumWidth", PopUpOptions.UseMinimumWidth); DBWriteContactSettingWord(NULL, MODULNAME, "MinimumWidth", PopUpOptions.MinimumWidth); - DBWriteContactSettingByte(NULL, MODULNAME, "UseMaximumWidth", PopUpOptions.UseMaximumWidth); + db_set_b(NULL, MODULNAME, "UseMaximumWidth", PopUpOptions.UseMaximumWidth); DBWriteContactSettingWord(NULL, MODULNAME, "MaximumWidth", PopUpOptions.MaximumWidth); //Position - DBWriteContactSettingByte(NULL, MODULNAME, "Position", (BYTE)PopUpOptions.Position); + db_set_b(NULL, MODULNAME, "Position", (BYTE)PopUpOptions.Position); //Configure popup area DBWriteContactSettingWord(NULL, MODULNAME, "gapTop", (WORD)PopUpOptions.gapTop); DBWriteContactSettingWord(NULL, MODULNAME, "gapBottom", (WORD)PopUpOptions.gapBottom); @@ -531,12 +531,12 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM DBWriteContactSettingWord(NULL, MODULNAME, "gapRight", (WORD)PopUpOptions.gapRight); DBWriteContactSettingWord(NULL, MODULNAME, "spacing", (WORD)PopUpOptions.spacing); //Spreading - DBWriteContactSettingByte(NULL, MODULNAME, "Spreading", (BYTE)PopUpOptions.Spreading); + db_set_b(NULL, MODULNAME, "Spreading", (BYTE)PopUpOptions.Spreading); //miscellaneous - //DBWriteContactSettingByte(NULL, MODULNAME, "ReorderPopUps", PopUpOptions.ReorderPopUps); + //db_set_b(NULL, MODULNAME, "ReorderPopUps", PopUpOptions.ReorderPopUps); Check_ReorderPopUps(hwnd); //this save also PopUpOptions.ReorderPopUps //disable When - DBWriteContactSettingByte(NULL, MODULNAME, "DisableWhenFullscreen", PopUpOptions.DisableWhenFullscreen); + db_set_b(NULL, MODULNAME, "DisableWhenFullscreen", PopUpOptions.DisableWhenFullscreen); //new status options { int protocolCount; @@ -554,7 +554,7 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } //Debug #if defined(_DEBUG) - DBWriteContactSettingByte(NULL, MODULNAME, "debug", PopUpOptions.debug); + db_set_b(NULL, MODULNAME, "debug", PopUpOptions.debug); #endif }//end PSN_APPLY: @@ -636,8 +636,8 @@ void Check_ReorderPopUps(HWND hwnd) { return; } } - DBWriteContactSettingByte(NULL, MODULNAME, "ReorderPopUps", PopUpOptions.ReorderPopUps); - DBWriteContactSettingByte(NULL, MODULNAME, "ReorderPopUpsWarning", PopUpOptions.ReorderPopUpsWarning); + db_set_b(NULL, MODULNAME, "ReorderPopUps", PopUpOptions.ReorderPopUps); + db_set_b(NULL, MODULNAME, "ReorderPopUpsWarning", PopUpOptions.ReorderPopUpsWarning); if (hwnd) CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopUpOptions.ReorderPopUps); } diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 3110a6283b..ab8e518835 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -299,12 +299,12 @@ void LoadOption_Skins() { //skin pack PopUpOptions.SkinPack = (LPTSTR)DBGetContactSettingStringX(NULL,MODULNAME, "SkinPack", "* Popup Classic",DBVT_TCHAR); //more Skin options - PopUpOptions.DisplayTime = DBGetContactSettingByte(NULL,MODULNAME, "DisplayTime", TRUE); - PopUpOptions.DropShadow = DBGetContactSettingByte(NULL,MODULNAME, "DropShadow", TRUE); - PopUpOptions.EnableFreeformShadows = DBGetContactSettingByte(NULL,MODULNAME, "EnableShadowRegion", 1); - PopUpOptions.EnableAeroGlass = DBGetContactSettingByte(NULL,MODULNAME, "EnableAeroGlass", 1); - PopUpOptions.UseWinColors = DBGetContactSettingByte(NULL,MODULNAME, "UseWinColors", FALSE); - PopUpOptions.UseMText = DBGetContactSettingByte(NULL,MODULNAME, "UseMText", TRUE); + PopUpOptions.DisplayTime = db_get_b(NULL,MODULNAME, "DisplayTime", TRUE); + PopUpOptions.DropShadow = db_get_b(NULL,MODULNAME, "DropShadow", TRUE); + PopUpOptions.EnableFreeformShadows = db_get_b(NULL,MODULNAME, "EnableShadowRegion", 1); + PopUpOptions.EnableAeroGlass = db_get_b(NULL,MODULNAME, "EnableAeroGlass", 1); + PopUpOptions.UseWinColors = db_get_b(NULL,MODULNAME, "UseWinColors", FALSE); + PopUpOptions.UseMText = db_get_b(NULL,MODULNAME, "UseMText", TRUE); } INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -499,11 +499,11 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR skin->saveOpts(); skins.freeAllButActive(); //more Skin options - DBWriteContactSettingByte(NULL, MODULNAME, "DisplayTime", PopUpOptions.DisplayTime); - DBWriteContactSettingByte(NULL, MODULNAME, "DropShadow", PopUpOptions.DropShadow); - DBWriteContactSettingByte(NULL, MODULNAME, "EnableShadowRegion", PopUpOptions.EnableFreeformShadows); - DBWriteContactSettingByte(NULL, MODULNAME, "EnableAeroGlass", PopUpOptions.EnableAeroGlass); - DBWriteContactSettingByte(NULL, MODULNAME, "UseMText", PopUpOptions.UseMText); + db_set_b(NULL, MODULNAME, "DisplayTime", PopUpOptions.DisplayTime); + db_set_b(NULL, MODULNAME, "DropShadow", PopUpOptions.DropShadow); + db_set_b(NULL, MODULNAME, "EnableShadowRegion", PopUpOptions.EnableFreeformShadows); + db_set_b(NULL, MODULNAME, "EnableAeroGlass", PopUpOptions.EnableAeroGlass); + db_set_b(NULL, MODULNAME, "UseMText", PopUpOptions.UseMText); }//end PSN_APPLY: return TRUE; }//switch (((LPNMHDR)lParam)->code) diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 711a65ab95..13a44268ab 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -153,7 +153,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA switch (message) { case UTM_STOP_THREAD: gTerminating = true; - if (DBGetContactSettingByte(NULL, MODULNAME, "FastExit", 0)) + if (db_get_b(NULL, MODULNAME, "FastExit", 0)) for (int i=0; i < popupList.getCount(); ++i) PUDeletePopUp(popupList[i]->getHwnd()); PostQuitMessage(0); diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 02a48befd3..e14ed3bda9 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -624,7 +624,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && isIm && IsActionEnabled("General/Send message")) ++m_actionCount; if (enableDefaultUsr && IsActionEnabled("General/User details")) ++m_actionCount; if (enableDefaultUsr && IsActionEnabled("General/Contact menu")) ++m_actionCount; - if (enableDefaultUsr && DBGetContactSettingByte(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) ++m_actionCount; + if (enableDefaultUsr && db_get_b(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) ++m_actionCount; if (enableDefaultGen && (m_iTimeout != -1) && IsActionEnabled("General/Pin popup")) ++m_actionCount; if (enableDefaultGen && IsActionEnabled("General/Dismiss popup")) ++m_actionCount; if (enableDefaultGen && IsActionEnabled("General/Copy to clipboard")) ++m_actionCount; @@ -667,7 +667,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) ++iAction; } - if (enableDefaultUsr && DBGetContactSettingByte(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) { + if (enableDefaultUsr && db_get_b(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) { m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION); m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_ADD,iconSize); lstrcpyA(m_actions[iAction].actionA.lpzTitle, "General/Add permanently"); diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 9e3c4ca797..befd0638a1 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -177,7 +177,7 @@ INT_PTR PopUp_AddPopUp2(WPARAM wParam, LPARAM lParam) if (ppd->lchContact) proto = GetContactProto(ppd->lchContact); - BYTE bShowMode = proto ? DBGetContactSettingByte(ppd->lchContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO) : PU_SHOWMODE_AUTO; + BYTE bShowMode = proto ? db_get_b(ppd->lchContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO) : PU_SHOWMODE_AUTO; if (bShowMode == PU_SHOWMODE_BLOCK) return -1; diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index d85f8bedfd..cee1bfe592 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -625,7 +625,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o if (textAreaWidth <= 0) textAreaWidth = wnd->getRenderInfo()->realtextw; drawActionBar(bmp, wnd, - DBGetContactSettingByte(NULL, MODULNAME, "CenterActions", 0) ? + db_get_b(NULL, MODULNAME, "CenterActions", 0) ? (pos.x + (textAreaWidth - wnd->getRenderInfo()->actw)/2) : (PopUpOptions.actions&ACT_RIGHTICONS) ? (pos.x + textAreaWidth - wnd->getRenderInfo()->actw) : @@ -1269,7 +1269,7 @@ void PopupSkin::saveOpts() const mir_snprintf(buf, sizeof(buf), "skin.%.120S", m_name); - DBWriteContactSettingDword(NULL, MODULNAME, buf, m_flags); + db_set_dw(NULL, MODULNAME, buf, m_flags); } void PopupSkin::loadOpts() const diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index 2e289a1fc4..b22785143a 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -88,7 +88,7 @@ static void SrmmMenu_UpdateIcon(HANDLE hContact) { if (!hContact) return; - int mode = DBGetContactSettingByte(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO); + int mode = db_get_b(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO); StatusIconData sid = {0}; sid.cbSize = sizeof(sid); @@ -131,7 +131,7 @@ static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam) HANDLE hContact = (HANDLE)wParam; if (!hContact) return 0; - int mode = DBGetContactSettingByte(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO); + int mode = db_get_b(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO); if (sicd->flags&MBCF_RIGHTBUTTON) { @@ -148,12 +148,12 @@ static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam) if (mode) { - DBWriteContactSettingByte(hContact, MODULNAME, "ShowMode", mode-1); + db_set_b(hContact, MODULNAME, "ShowMode", mode-1); SrmmMenu_UpdateIcon(hContact); } } else { - DBWriteContactSettingByte(hContact, MODULNAME, "ShowMode", + db_set_b(hContact, MODULNAME, "ShowMode", (mode == PU_SHOWMODE_AUTO) ? PU_SHOWMODE_BLOCK : PU_SHOWMODE_AUTO); SrmmMenu_UpdateIcon(hContact); } -- cgit v1.2.3