summaryrefslogtreecommitdiff
path: root/plugins/YAPP
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-08-06 14:16:19 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-08-06 14:16:19 +0000
commit942f84fef5dfcdb095e950c30275d6b81db8e8f6 (patch)
tree3f1984131a32cf0947099d34b8e222ea9af07431 /plugins/YAPP
parented629adafe5d1bb4fc976412dc7767d16d641792 (diff)
fix for the time format in YAPP
git-svn-id: http://svn.miranda-ng.org/main/trunk@1381 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAPP')
-rw-r--r--plugins/YAPP/src/message_pump.cpp22
-rw-r--r--plugins/YAPP/src/notify_imp.cpp2
-rw-r--r--plugins/YAPP/src/options.cpp172
-rw-r--r--plugins/YAPP/src/popwin.cpp170
-rw-r--r--plugins/YAPP/src/services.cpp98
-rw-r--r--plugins/YAPP/src/yapp.cpp10
6 files changed, 238 insertions, 236 deletions
diff --git a/plugins/YAPP/src/message_pump.cpp b/plugins/YAPP/src/message_pump.cpp
index 7e2cea5f0c..68d946a091 100644
--- a/plugins/YAPP/src/message_pump.cpp
+++ b/plugins/YAPP/src/message_pump.cpp
@@ -27,7 +27,7 @@ bool is_full_screen() {
// check foregroundwindow
hWnd = GetForegroundWindow();
- if(hWnd && hWnd != hWndDesktop && hWnd != hWndShell) {
+ if (hWnd && hWnd != hWndDesktop && hWnd != hWndShell) {
GetClientRect(hWnd, &ClientRect);
if ((ClientRect.right - ClientRect.left) >= w && (ClientRect.bottom - ClientRect.top) >= h)
return true;
@@ -35,10 +35,10 @@ bool is_full_screen() {
// check other top level windows
while ((hWnd = FindWindowEx(NULL, hWnd, NULL, NULL))) {
- if(IsWindowVisible(hWnd) == 0 || IsIconic(hWnd) || hWnd == hWndDesktop || hWnd == hWndShell)
+ if (IsWindowVisible(hWnd) == 0 || IsIconic(hWnd) || hWnd == hWndDesktop || hWnd == hWndShell)
continue;
-// if(DBGetContactSettingByte(0, MODULE, "ShowForNonTopmostFullscreenWindows", 0) == 1) {
+// if (db_get_b(0, MODULE, "ShowForNonTopmostFullscreenWindows", 0) == 1) {
if (!(GetWindowLongPtr(hWnd, GWL_EXSTYLE) & WS_EX_TOPMOST))
continue;
// }
@@ -58,9 +58,9 @@ bool is_workstation_locked()
{
bool rc = false;
HDESK hDesk = OpenDesktop((TCHAR*)_T("default"), 0, FALSE, DESKTOP_SWITCHDESKTOP);
- if(hDesk != 0) {
+ if (hDesk != 0) {
HDESK hDeskInput = OpenInputDesktop(0, FALSE, DESKTOP_SWITCHDESKTOP);
- if(hDeskInput == 0) {
+ if (hDeskInput == 0) {
rc = true;
} else
CloseDesktop(hDeskInput);
@@ -76,7 +76,7 @@ unsigned __stdcall MessagePumpThread(void* param)
{
InitWindowStack();
- if(param) SetEvent((HANDLE)param);
+ if (param) SetEvent((HANDLE)param);
MSG hwndMsg = {0};
while(GetMessage(&hwndMsg, 0, 0, 0) > 0 && !Miranda_Terminated()) {
@@ -86,17 +86,17 @@ unsigned __stdcall MessagePumpThread(void* param)
{
bool enabled = true;
int status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
- if(status >= ID_STATUS_OFFLINE && status <= ID_STATUS_OUTTOLUNCH && options.disable_status[status - ID_STATUS_OFFLINE])
+ if (status >= ID_STATUS_OFFLINE && status <= ID_STATUS_OUTTOLUNCH && options.disable_status[status - ID_STATUS_OFFLINE])
enabled = false;
if ((options.disable_full_screen && is_full_screen()) || is_workstation_locked())
enabled = false;
PopupData *pd = (PopupData *)hwndMsg.lParam;
- if(enabled && num_popups < MAX_POPUPS) {
+ if (enabled && num_popups < MAX_POPUPS) {
//HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, GetDesktopWindow(), 0, hInst, (LPVOID)hwndMsg.lParam);
HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)hwndMsg.lParam);
num_popups++;
- if(hwndMsg.wParam) // set notifyer handle
+ if (hwndMsg.wParam) // set notifyer handle
SendMessage(hwnd, PUM_SETNOTIFYH, hwndMsg.wParam, 0);
} else {
if (pd) {
@@ -111,7 +111,7 @@ unsigned __stdcall MessagePumpThread(void* param)
case MUM_DELETEPOPUP:
{
HWND hwnd = (HWND)hwndMsg.lParam;
- if(IsWindow(hwnd)) {
+ if (IsWindow(hwnd)) {
DestroyWindow(hwnd);
num_popups--;
}
@@ -147,7 +147,7 @@ unsigned __stdcall MessagePumpThread(void* param)
DeinitWindowStack();
num_popups = 0;
- //if(param) SetEvent((HANDLE)param);
+ //if (param) SetEvent((HANDLE)param);
DeinitOptions();
DeinitServices();
diff --git a/plugins/YAPP/src/notify_imp.cpp b/plugins/YAPP/src/notify_imp.cpp
index 061c30f1a2..54a0fddf34 100644
--- a/plugins/YAPP/src/notify_imp.cpp
+++ b/plugins/YAPP/src/notify_imp.cpp
@@ -141,6 +141,6 @@ void DeinitNotify() {
UnhookEvent(hEventNotifyOptInit);
UnhookEvent(hEventNotifyModulesLoaded);
- for(int i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
DestroyServiceFunction(hServicesNotify[i]);
}
diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp
index 7ba798e5fa..c6b9e05110 100644
--- a/plugins/YAPP/src/options.cpp
+++ b/plugins/YAPP/src/options.cpp
@@ -9,78 +9,80 @@ Options options;
HICON hPopupIcon = 0;
void LoadModuleDependentOptions() {
- if(ServiceExists(MS_AV_DRAWAVATAR))
- options.av_layout = (PopupAvLayout)DBGetContactSettingByte(0, MODULE, "AVLayout", PAV_RIGHT);
+ if (ServiceExists(MS_AV_DRAWAVATAR))
+ options.av_layout = (PopupAvLayout)db_get_b(0, MODULE, "AVLayout", PAV_RIGHT);
else
options.av_layout = PAV_NONE;
- options.time_layout = (PopupTimeLayout)DBGetContactSettingByte(0, MODULE, "TimeLayout", (ServiceExists(MS_AV_DRAWAVATAR) ? PT_WITHAV : PT_RIGHT));
- if(options.time_layout == PT_WITHAV && !ServiceExists(MS_AV_DRAWAVATAR))
+ options.time_layout = (PopupTimeLayout)db_get_b(0, MODULE, "TimeLayout", (ServiceExists(MS_AV_DRAWAVATAR) ? PT_WITHAV : PT_RIGHT));
+ if (options.time_layout == PT_WITHAV && !ServiceExists(MS_AV_DRAWAVATAR))
options.time_layout = PT_RIGHT;
}
-void LoadOptions() {
- options.default_timeout = DBGetContactSettingDword(0, MODULE, "DefaultTimeout", 7);
- options.win_width = DBGetContactSettingDword(0, MODULE, "WinWidth", 220);
- options.win_max_height = DBGetContactSettingDword(0, MODULE, "WinMaxHeight", 400);
- options.location = (PopupLocation)DBGetContactSettingByte(0, MODULE, "Location", (BYTE)PL_BOTTOMRIGHT);
- options.opacity = DBGetContactSettingByte(0, MODULE, "Opacity", 75);
- options.border = (DBGetContactSettingByte(0, MODULE, "Border", 1) == 1);
- options.round = (DBGetContactSettingByte(0, MODULE, "RoundCorners", 1) == 1);
- options.av_round = (DBGetContactSettingByte(0, MODULE, "AvatarRoundCorners", 1) == 1);
- options.animate = (DBGetContactSettingByte(0, MODULE, "Animate", 1) == 1);
- options.trans_bg = (DBGetContactSettingByte(0, MODULE, "TransparentBg", 0) == 1);
- options.use_mim_monitor = (DBGetContactSettingByte(0, MODULE, "UseMimMonitor", 1) == 1);
- options.right_icon = (DBGetContactSettingByte(0, MODULE, "RightIcon", 0) == 1);
- options.av_layout = PAV_NONE; // corrected in LoadModuleDependentOptions function above
- options.av_size = DBGetContactSettingDword(0, MODULE, "AVSize", 40); //tweety
- options.text_indent = DBGetContactSettingDword(0, MODULE, "TextIndent", 22);
- options.global_hover = (DBGetContactSettingByte(0, MODULE, "GlobalHover", 1) == 1);
- options.time_layout = PT_RIGHT; // corrected in LoadModuleDependentOptions function above
+void LoadOptions()
+{
+ options.default_timeout = db_get_dw(0, MODULE, "DefaultTimeout", 7);
+ options.win_width = db_get_dw(0, MODULE, "WinWidth", 220);
+ options.win_max_height = db_get_dw(0, MODULE, "WinMaxHeight", 400);
+ options.location = (PopupLocation)db_get_b(0, MODULE, "Location", (BYTE)PL_BOTTOMRIGHT);
+ options.opacity = db_get_b(0, MODULE, "Opacity", 75);
+ options.border = db_get_b(0, MODULE, "Border", 1) == 1;
+ options.round = db_get_b(0, MODULE, "RoundCorners", 1) == 1;
+ options.av_round = db_get_b(0, MODULE, "AvatarRoundCorners", 1) == 1;
+ options.animate = db_get_b(0, MODULE, "Animate", 1) == 1;
+ options.trans_bg = db_get_b(0, MODULE, "TransparentBg", 0) == 1;
+ options.use_mim_monitor = db_get_b(0, MODULE, "UseMimMonitor", 1) == 1;
+ options.right_icon = db_get_b(0, MODULE, "RightIcon", 0) == 1;
+ options.av_layout = PAV_NONE; // corrected in LoadModuleDependentOptions function above
+ options.av_size = db_get_dw(0, MODULE, "AVSize", 40); //tweety
+ options.text_indent = db_get_dw(0, MODULE, "TextIndent", 22);
+ options.global_hover = db_get_b(0, MODULE, "GlobalHover", 1) == 1;
+ options.time_layout = (PopupTimeLayout)db_get_b(0, MODULE, "TimeLayout", PT_RIGHT);
char buff[128];
- for(int i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
sprintf(buff, "DisableStatus%d", i - 1); // -1 because i forgot offline status earlier!
- options.disable_status[i] = (DBGetContactSettingByte(0, MODULE, buff, 0) == 1);
+ options.disable_status[i] = (db_get_b(0, MODULE, buff, 0) == 1);
}
- options.disable_full_screen = (DBGetContactSettingByte(0, MODULE, "DisableFullScreen", 1) == 1);
- options.drop_shadow = (DBGetContactSettingByte(0, MODULE, "DropShadow", 0) == 1);
- options.sb_width = DBGetContactSettingDword(0, MODULE, "SidebarWidth", 22);
- options.padding = DBGetContactSettingDword(0, MODULE, "Padding", 4);
- options.av_padding = DBGetContactSettingDword(0, MODULE, "AvatarPadding", 4);
+ options.disable_full_screen = db_get_b(0, MODULE, "DisableFullScreen", 1) == 1;
+ options.drop_shadow = db_get_b(0, MODULE, "DropShadow", 0) == 1;
+ options.sb_width = db_get_dw(0, MODULE, "SidebarWidth", 22);
+ options.padding = db_get_dw(0, MODULE, "Padding", 4);
+ options.av_padding = db_get_dw(0, MODULE, "AvatarPadding", 4);
}
-void SaveOptions() {
- DBWriteContactSettingDword(0, MODULE, "DefaultTimeout", options.default_timeout);
- DBWriteContactSettingDword(0, MODULE, "WinWidth", options.win_width);
- DBWriteContactSettingDword(0, MODULE, "WinMaxHeight", options.win_max_height);
- DBWriteContactSettingByte(0, MODULE, "Location", (BYTE)options.location);
- DBWriteContactSettingByte(0, MODULE, "Opacity", (BYTE)options.opacity);
- DBWriteContactSettingByte(0, MODULE, "Border", (options.border ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "RoundCorners", (options.round ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "AvatarRoundCorners", (options.av_round ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "Animate", (options.animate ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "TransparentBg", (options.trans_bg ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "UseMimMonitor", (options.use_mim_monitor ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "RightIcon", (options.right_icon ? 1 : 0));
- if(ServiceExists(MS_AV_DRAWAVATAR))
- DBWriteContactSettingByte(0, MODULE, "AVLayout", (BYTE)options.av_layout);
- DBWriteContactSettingDword(0, MODULE, "AVSize", options.av_size);
- DBWriteContactSettingDword(0, MODULE, "TextIndent", options.text_indent);
- DBWriteContactSettingByte(0, MODULE, "GlobalHover", (options.global_hover ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "TimeLayout", (BYTE)options.time_layout);
+void SaveOptions()
+{
+ db_set_dw(0, MODULE, "DefaultTimeout", options.default_timeout);
+ db_set_dw(0, MODULE, "WinWidth", options.win_width);
+ db_set_dw(0, MODULE, "WinMaxHeight", options.win_max_height);
+ db_set_b(0, MODULE, "Location", (BYTE)options.location);
+ db_set_b(0, MODULE, "Opacity", (BYTE)options.opacity);
+ db_set_b(0, MODULE, "Border", (options.border ? 1 : 0));
+ db_set_b(0, MODULE, "RoundCorners", (options.round ? 1 : 0));
+ db_set_b(0, MODULE, "AvatarRoundCorners", (options.av_round ? 1 : 0));
+ db_set_b(0, MODULE, "Animate", (options.animate ? 1 : 0));
+ db_set_b(0, MODULE, "TransparentBg", (options.trans_bg ? 1 : 0));
+ db_set_b(0, MODULE, "UseMimMonitor", (options.use_mim_monitor ? 1 : 0));
+ db_set_b(0, MODULE, "RightIcon", (options.right_icon ? 1 : 0));
+ if (ServiceExists(MS_AV_DRAWAVATAR))
+ db_set_b(0, MODULE, "AVLayout", (BYTE)options.av_layout);
+ db_set_dw(0, MODULE, "AVSize", options.av_size);
+ db_set_dw(0, MODULE, "TextIndent", options.text_indent);
+ db_set_b(0, MODULE, "GlobalHover", (options.global_hover ? 1 : 0));
+ db_set_b(0, MODULE, "TimeLayout", (BYTE)options.time_layout);
char buff[128];
- for(int i = 0; i < 9; i++) {
+ for (int i = 0; i < 9; i++) {
sprintf(buff, "DisableStatus%d", i - 1);
- DBWriteContactSettingByte(0, MODULE, buff, options.disable_status[i] ? 1 : 0);
+ db_set_b(0, MODULE, buff, options.disable_status[i] ? 1 : 0);
}
- DBWriteContactSettingByte(0, MODULE, "DisableFullScreen", (options.disable_full_screen ? 1 : 0));
- DBWriteContactSettingByte(0, MODULE, "DropShadow", (options.drop_shadow ? 1 : 0));
- DBWriteContactSettingDword(0, MODULE, "SidebarWidth", options.sb_width);
- DBWriteContactSettingDword(0, MODULE, "Padding", options.padding);
- DBWriteContactSettingDword(0, MODULE, "AvatarPadding", options.av_padding);
+ db_set_b(0, MODULE, "DisableFullScreen", (options.disable_full_screen ? 1 : 0));
+ db_set_b(0, MODULE, "DropShadow", (options.drop_shadow ? 1 : 0));
+ db_set_dw(0, MODULE, "SidebarWidth", options.sb_width);
+ db_set_dw(0, MODULE, "Padding", options.padding);
+ db_set_dw(0, MODULE, "AvatarPadding", options.av_padding);
}
void ShowExamplePopups() {
@@ -102,9 +104,9 @@ void ShowExamplePopups() {
HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while(hContact) {
- if(options.av_layout != PAV_NONE && ServiceExists(MS_AV_DRAWAVATAR)) {
+ if (options.av_layout != PAV_NONE && ServiceExists(MS_AV_DRAWAVATAR)) {
AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0);
- if(ace && (ace->dwFlags & AVS_BITMAP_VALID)) {
+ if (ace && (ace->dwFlags & AVS_BITMAP_VALID)) {
pd.hContact = hContact;
pd.ptzText = TranslateT("An avatar.");
ShowPopup(pd);
@@ -135,12 +137,12 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_ADDSTRING, 0, (LPARAM)TranslateT("No time"));
SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_ADDSTRING, 0, (LPARAM)TranslateT("Time on left"));
SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_ADDSTRING, 0, (LPARAM)TranslateT("Time on right"));
- if(ServiceExists(MS_AV_DRAWAVATAR))
+ if (ServiceExists(MS_AV_DRAWAVATAR))
SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_ADDSTRING, 0, (LPARAM)TranslateT("Time above avatar"));
SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_SETCURSEL, (int)options.time_layout, 0);
SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("No avatar"));
- if(ServiceExists(MS_AV_DRAWAVATAR)) {
+ if (ServiceExists(MS_AV_DRAWAVATAR)) {
SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left avatar"));
SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right avatar"));
} else {
@@ -207,7 +209,7 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SendDlgItemMessage(hwndDlg, IDC_SPIN_SBWIDTH, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 0));
SendDlgItemMessage(hwndDlg, IDC_SPIN_PADDING, UDM_SETRANGE, 0, (LPARAM)MAKELONG(400, 0));
- if(options.default_timeout == -1) {
+ if (options.default_timeout == -1) {
CheckDlgButton(hwndDlg, IDC_RAD_NOTIMEOUT, TRUE);
HWND hw = GetDlgItem(hwndDlg, IDC_ED_TIMEOUT);
EnableWindow(hw, FALSE);
@@ -216,10 +218,10 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
CheckDlgButton(hwndDlg, IDC_RAD_TIMEOUT, TRUE);
SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, options.default_timeout, FALSE);
}
- if(options.right_icon) CheckDlgButton(hwndDlg, IDC_RAD_RIGHTICON, TRUE);
+ if (options.right_icon) CheckDlgButton(hwndDlg, IDC_RAD_RIGHTICON, TRUE);
else CheckDlgButton(hwndDlg, IDC_RAD_LEFTICON, TRUE);
- if(ServiceExists(MS_AV_DRAWAVATAR)) {
+ if (ServiceExists(MS_AV_DRAWAVATAR)) {
switch(options.av_layout) {
case PAV_NONE: CheckDlgButton(hwndDlg, IDC_RAD_NOAV, TRUE); break;
case PAV_RIGHT: CheckDlgButton(hwndDlg, IDC_RAD_RIGHTAV, TRUE); break;
@@ -262,7 +264,7 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
} else if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
} else if ( HIWORD( wParam ) == BN_CLICKED ) {
- if(LOWORD(wParam) == IDC_BTN_PREVIEW) {
+ if (LOWORD(wParam) == IDC_BTN_PREVIEW) {
ShowExamplePopups();
} else {
switch( LOWORD( wParam )) {
@@ -284,7 +286,7 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
break;
case WM_NOTIFY:
- if(IsWindowVisible(hwndDlg) && ((LPNMHDR) lParam)->hwndFrom == GetDlgItem(hwndDlg, IDC_LST_STATUS)) {
+ if (IsWindowVisible(hwndDlg) && ((LPNMHDR) lParam)->hwndFrom == GetDlgItem(hwndDlg, IDC_LST_STATUS)) {
switch (((LPNMHDR) lParam)->code) {
case LVN_ITEMCHANGED:
@@ -300,30 +302,30 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY ) {
BOOL trans;
int new_val;
- if(IsDlgButtonChecked(hwndDlg, IDC_RAD_NOTIMEOUT))
+ if (IsDlgButtonChecked(hwndDlg, IDC_RAD_NOTIMEOUT))
options.default_timeout = -1;
else {
new_val = GetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, &trans, FALSE);
- if(trans) options.default_timeout = new_val;
+ if (trans) options.default_timeout = new_val;
}
- if(options.default_timeout == 0) {
+ if (options.default_timeout == 0) {
SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, options.default_timeout, FALSE);
MessageBox(hwndDlg, TranslateT("You cannot set a default timeout of 0.\nValue has been reset."), TranslateT("Error"), MB_OK | MB_ICONWARNING);
options.default_timeout = 7; // prevent instant timeout
}
new_val = GetDlgItemInt(hwndDlg, IDC_ED_WIDTH, &trans, FALSE);
- if(trans) options.win_width = new_val;
+ if (trans) options.win_width = new_val;
new_val = GetDlgItemInt(hwndDlg, IDC_ED_MAXHEIGHT, &trans, FALSE);
- if(trans) options.win_max_height = new_val;
+ if (trans) options.win_max_height = new_val;
new_val = GetDlgItemInt(hwndDlg, IDC_ED_AVSIZE, &trans, FALSE);
- if(trans) options.av_size = new_val;
+ if (trans) options.av_size = new_val;
new_val = GetDlgItemInt(hwndDlg, IDC_ED_INDENT, &trans, FALSE);
- if(trans) options.text_indent = new_val;
+ if (trans) options.text_indent = new_val;
new_val = GetDlgItemInt(hwndDlg, IDC_ED_SBWIDTH, &trans, FALSE);
- if(trans) options.sb_width = new_val;
+ if (trans) options.sb_width = new_val;
new_val = GetDlgItemInt(hwndDlg, IDC_ED_PADDING, &trans, FALSE);
- if(trans) options.padding = new_val;
+ if (trans) options.padding = new_val;
options.location = (PopupLocation)SendDlgItemMessage(hwndDlg, IDC_CMB_PLACEMENT, CB_GETCURSEL, 0, 0);
options.right_icon = (SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_GETCURSEL, 0, 0) == 1);
@@ -331,7 +333,7 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
options.time_layout = (PopupTimeLayout)SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_GETCURSEL, 0, 0);
new_val = GetDlgItemInt(hwndDlg, IDC_ED_TRANS, &trans, FALSE);
- if(trans) options.opacity = new_val;
+ if (trans) options.opacity = new_val;
options.border = IsDlgButtonChecked(hwndDlg, IDC_CHK_BORDER) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_BORDER)) ? true : false;
options.round = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERS) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_ROUNDCORNERS)) ? true : false;
options.av_round = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERSAV) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_ROUNDCORNERSAV)) ? true : false;
@@ -359,15 +361,15 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
case WM_INITDIALOG:
TranslateDialogDefault( hwndDlg );
{
- if(num_classes) {
+ if (num_classes) {
newclasses = (POPUPCLASS *)mir_alloc(num_classes * sizeof(POPUPCLASS));
memcpy(newclasses, classes, num_classes * sizeof(POPUPCLASS));
POPUPCLASS *pc;
int index;
- for(int i = 0; i < num_classes; i++) {
+ for (int i = 0; i < num_classes; i++) {
pc = &newclasses[i];
- if(pc->flags & PCF_UNICODE) {
+ if (pc->flags & PCF_UNICODE) {
index = SendDlgItemMessageW(hwndDlg, IDC_LST_CLASSES, LB_ADDSTRING, 0, (LPARAM)pc->pwszDescription);
} else {
index = SendDlgItemMessageA(hwndDlg, IDC_LST_CLASSES, LB_ADDSTRING, 0, (LPARAM)pc->pszDescription);
@@ -384,7 +386,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
EnableWindow(GetDlgItem(hwndDlg, IDC_COL_TEXT), index != -1);
EnableWindow(GetDlgItem(hwndDlg, IDC_COL_BG), index != -1);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_TIMEOUT), index != -1);
- if(index != -1) {
+ if (index != -1) {
int i = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETITEMDATA, index, 0);
SendDlgItemMessage(hwndDlg, IDC_COL_TEXT, CPM_SETCOLOUR, 0, (LPARAM)newclasses[i].colorText);
SendDlgItemMessage(hwndDlg, IDC_COL_BG, CPM_SETCOLOUR, 0, (LPARAM)newclasses[i].colorBack);
@@ -395,7 +397,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
return TRUE;
} else if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
int index = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETCURSEL, 0, 0);
- if(index != -1) {
+ if (index != -1) {
int i = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETITEMDATA, index, 0);
BOOL tr;
int t = GetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, &tr, FALSE);
@@ -405,14 +407,14 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
}
} else {
int index = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETCURSEL, 0, 0);
- if(index != -1) {
+ if (index != -1) {
int i = SendDlgItemMessage(hwndDlg, IDC_LST_CLASSES, LB_GETITEMDATA, index, 0);
switch(LOWORD(wParam)) {
case IDC_CHK_TIMEOUT:
{
BOOL isChecked = IsDlgButtonChecked(hwndDlg, IDC_CHK_TIMEOUT);
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TIMEOUT), isChecked);
- if(isChecked) newclasses[i].iSeconds = 0;
+ if (isChecked) newclasses[i].iSeconds = 0;
else newclasses[i].iSeconds = -1;
SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, newclasses[i].iSeconds, TRUE);
}
@@ -427,7 +429,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
break;
case IDC_BTN_PREVIEW:
- if(newclasses[i].flags & PCF_UNICODE) {
+ if (newclasses[i].flags & PCF_UNICODE) {
POPUPCLASS pc = newclasses[i];
pc.PluginWindowProc = 0;
POPUPDATACLASS d = {sizeof(d), pc.pszName};
@@ -451,13 +453,13 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY ) {
memcpy(classes, newclasses, num_classes * sizeof(POPUPCLASS));
char setting[256];
- for(int i = 0; i < num_classes; i++) {
+ for (int i = 0; i < num_classes; i++) {
mir_snprintf(setting, 256, "%s/Timeout", classes[i].pszName);
DBWriteContactSettingWord(0, MODULE, setting, classes[i].iSeconds);
mir_snprintf(setting, 256, "%s/TextCol", classes[i].pszName);
- DBWriteContactSettingDword(0, MODULE, setting, (DWORD)classes[i].colorText);
+ db_set_dw(0, MODULE, setting, (DWORD)classes[i].colorText);
mir_snprintf(setting, 256, "%s/BgCol", classes[i].pszName);
- DBWriteContactSettingDword(0, MODULE, setting, (DWORD)classes[i].colorBack);
+ db_set_dw(0, MODULE, setting, (DWORD)classes[i].colorBack);
}
return TRUE;
}
diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp
index 682a3f7b05..59178f328f 100644
--- a/plugins/YAPP/src/popwin.cpp
+++ b/plugins/YAPP/src/popwin.cpp
@@ -18,14 +18,14 @@ int global_mouse_in = 0;
void trimW(wchar_t *str) {
int len = (int)wcslen(str), pos;
// trim whitespace (e.g. from OTR detection)
- for(pos = len - 1; pos >= 0; pos--) {
- if(str[pos] == L' ' || str[pos] == L'\t' || str[pos] == L'\r' || str[pos] == L'\n') str[pos] = 0;
+ for (pos = len - 1; pos >= 0; pos--) {
+ if (str[pos] == L' ' || str[pos] == L'\t' || str[pos] == L'\r' || str[pos] == L'\n') str[pos] = 0;
else break;
}
// remove tabs
- for(pos = len - 1; pos >= 0; pos--)
- if(str[pos] == L'\t') str[pos] = L' ';
+ for (pos = len - 1; pos >= 0; pos--)
+ if (str[pos] == L'\t') str[pos] = L' ';
}
void SetStartValues(void)
@@ -46,12 +46,12 @@ void SetStartValues(void)
}
}
- if(options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
pop_start_x = wa_rect.right - options.win_width - 1;
else
pop_start_x = wa_rect.left + 1;
- if(options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
pop_start_y = wa_rect.bottom - 1;
else
pop_start_y = wa_rect.top + 1;
@@ -82,9 +82,9 @@ void RepositionWindows() {
current = hwnd_stack_top;
while(current) {
SendMessage(current->hwnd, PUM_GETHEIGHT, (WPARAM)&height, 0);
- if(options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT) y -= height + 1;
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT) y -= height + 1;
SendMessage(current->hwnd, PUM_MOVE, (WPARAM)x, (LPARAM)y);
- if(options.location == PL_TOPRIGHT || options.location == PL_TOPLEFT) y += height + 1;
+ if (options.location == PL_TOPRIGHT || options.location == PL_TOPLEFT) y += height + 1;
current = current->next;
}
@@ -102,14 +102,14 @@ void AddWindowToStack(HWND hwnd) {
SendMessage(hwnd, PUM_GETHEIGHT, (WPARAM)&height, 0);
int x = pop_start_x, y = pop_start_y;
- if(options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
x += options.win_width;
else
x -= options.win_width;
- if(options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT) y -= height;
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT) y -= height;
SetWindowPos(hwnd, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
- if(options.location == PL_TOPRIGHT || options.location == PL_TOPLEFT) y += height;
+ if (options.location == PL_TOPRIGHT || options.location == PL_TOPLEFT) y += height;
stack_size++;
@@ -119,8 +119,8 @@ void AddWindowToStack(HWND hwnd) {
void RemoveWindowFromStack(HWND hwnd) {
HWNDStackNode *current = hwnd_stack_top, *prev = 0;
while(current) {
- if(current->hwnd == hwnd) {
- if(prev) {
+ if (current->hwnd == hwnd) {
+ if (prev) {
prev->next = current->next;
} else {
hwnd_stack_top = current->next;
@@ -134,7 +134,7 @@ void RemoveWindowFromStack(HWND hwnd) {
current = current->next;
}
- if(hwnd_stack_top) RepositionWindows();
+ if (hwnd_stack_top) RepositionWindows();
}
void ClearStack() {
@@ -168,7 +168,7 @@ struct PopupWindowData {
LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
PopupWindowData *pwd = (PopupWindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
PopupData *pd = 0;
- if(pwd) pd = pwd->pd;
+ if (pwd) pd = pwd->pd;
switch(uMsg) {
case WM_CREATE:
@@ -190,7 +190,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
pwd->tb_height = pwd->av_height = pwd->text_height = pwd->time_height = pwd->time_width = 0;
pwd->have_av = false;
- if(pwd->custom_col) {
+ if (pwd->custom_col) {
pwd->bkBrush = CreateSolidBrush(pd->colorBack);
//pwd->barBrush = CreateSolidBrush(pd->colorBack / 2); // make sidebar a dark version of the bg
@@ -206,7 +206,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
pwd->underlineBrush = CreateSolidBrush(colTitleUnderline);
}
- if(options.border) pwd->bPen = (HPEN)CreatePen(PS_SOLID, 1, colBorder);
+ if (options.border) pwd->bPen = (HPEN)CreatePen(PS_SOLID, 1, colBorder);
else pwd->bPen = CreatePen(PS_SOLID, 1, pwd->custom_col ? pd->colorBack : colBg);
SYSTEMTIME st;
@@ -215,11 +215,11 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pwd);
- if(pd->timeout == -1 || (pd->timeout == 0 && options.default_timeout == -1)) {
+ if (pd->timeout == -1 || (pd->timeout == 0 && options.default_timeout == -1)) {
// make a really long timeout - say 7 days? ;)
SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, 0);
} else {
- if(pd->timeout == 0) {
+ if (pd->timeout == 0) {
SetTimer(hwnd, ID_CLOSETIMER, options.default_timeout * 1000, 0);
} else {
SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
@@ -241,11 +241,11 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
#endif
#ifdef LWA_ALPHA
- if(MySetLayeredWindowAttributes) {
+ if (MySetLayeredWindowAttributes) {
MySetLayeredWindowAttributes(hwnd, RGB(0,0,0), (int)(options.opacity / 100.0 * 255), LWA_ALPHA);
- if(options.trans_bg) {
+ if (options.trans_bg) {
COLORREF bg;
- if(pd->colorBack == pd->colorText)
+ if (pd->colorBack == pd->colorText)
bg = colBg;
else
bg = pd->colorBack;
@@ -256,7 +256,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
PostMessage(hwnd, PM_INIT, (WPARAM)hwnd, 0);
return 0;
case WM_MOUSEMOVE:
- if(pwd && !pwd->mouse_in) {
+ if (pwd && !pwd->mouse_in) {
pwd->mouse_in = true;
global_mouse_in++;
TRACKMOUSEEVENT tme = { sizeof(tme) };
@@ -266,7 +266,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
break;
case WM_MOUSELEAVE:
- if(pwd && pwd->mouse_in) {
+ if (pwd && pwd->mouse_in) {
pwd->mouse_in = false;
global_mouse_in--;
}
@@ -276,25 +276,25 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
SendMessage(hwnd, WM_COMMAND, MAKEWPARAM(0, STN_CLICKED), 0);
break;
case WM_TIMER:
- if(wParam == ID_CLOSETIMER) {
+ if (wParam == ID_CLOSETIMER) {
KillTimer(hwnd, ID_CLOSETIMER);
- if(pwd->mouse_in || (options.global_hover && global_mouse_in))
+ if (pwd->mouse_in || (options.global_hover && global_mouse_in))
SetTimer(hwnd, ID_CLOSETIMER, 800, 0); // reset timer if mouse in window - allow another 800 ms
else {
PostMessage(hwnd, PM_DESTROY, 0, 0);
}
return TRUE;
- } else if(wParam == ID_MOVETIMER) {
+ } else if (wParam == ID_MOVETIMER) {
RECT r;
GetWindowRect(hwnd, &r);
- if(r.left == pwd->new_x && r.top == pwd->new_y) {
+ if (r.left == pwd->new_x && r.top == pwd->new_y) {
KillTimer(hwnd, ID_MOVETIMER);
return TRUE;
}
int adj_x = (pwd->new_x - r.left) / 4, adj_y = (pwd->new_y - r.top) / 4;
- if(adj_x == 0) adj_x = (pwd->new_x - r.left);
- if(adj_y == 0) adj_y = (pwd->new_y - r.top);
+ if (adj_x == 0) adj_x = (pwd->new_x - r.left);
+ if (adj_y == 0) adj_y = (pwd->new_y - r.top);
int x = r.left + adj_x, y = r.top + adj_y;
//SetWindowPos(hwnd, 0, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOCOPYBITS);
@@ -322,7 +322,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
CombineRgn(hMonRgn, hMonRgn, hWndRgn, RGN_AND);
// round corners
- if(options.round) {
+ if (options.round) {
HRGN hRgn1;
int v,h, w=10;
h=(r.right-r.left)>(w*2)?w:(r.right-r.left);
@@ -360,13 +360,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
r_bar.right = r.left + options.sb_width;
FillRect(hdc, &r_bar, pwd->barBrush);
// border
- if(options.border) {
+ if (options.border) {
HBRUSH hOldBrush = (HBRUSH)SelectObject(hdc, GetStockObject(NULL_BRUSH));
HPEN hOldPen = (HPEN)SelectObject(hdc, pwd->bPen);
int h = 0;
- if(options.round) {
+ if (options.round) {
int v;
int w=14;
h=(r.right-r.left)>(w*2)?w:(r.right-r.left);
@@ -386,49 +386,49 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
case WM_PAINT:
{
RECT r;
- //if(GetUpdateRect(hwnd, &r, TRUE)) {
+ //if (GetUpdateRect(hwnd, &r, TRUE)) {
PAINTSTRUCT ps;
BeginPaint(hwnd, &ps);
HDC hdc = ps.hdc;
GetClientRect(hwnd, &r);
// text background
- //if(pwd->custom_col) SetBkColor(ps.hdc, pd->colorBack);
+ //if (pwd->custom_col) SetBkColor(ps.hdc, pd->colorBack);
//else SetBkColor(ps.hdc, colBg);
SetBkMode(hdc, TRANSPARENT);
// avatar & time if with avatar
- if(options.av_layout != PAV_NONE && (pwd->have_av || options.time_layout == PT_WITHAV)) {
+ if (options.av_layout != PAV_NONE && (pwd->have_av || options.time_layout == PT_WITHAV)) {
RECT avr;
avr.top = options.av_padding;
- if(options.av_layout == PAV_LEFT) {
+ if (options.av_layout == PAV_LEFT) {
avr.left = r.left + options.av_padding;
- if(pwd->have_av && options.time_layout == PT_WITHAV) avr.right = avr.left + max(pwd->real_av_width, pwd->time_width);
- else if(pwd->have_av) avr.right = avr.left + pwd->real_av_width;
+ if (pwd->have_av && options.time_layout == PT_WITHAV) avr.right = avr.left + max(pwd->real_av_width, pwd->time_width);
+ else if (pwd->have_av) avr.right = avr.left + pwd->real_av_width;
else avr.right = avr.left + pwd->time_width;
r.left = avr.right;
- } else if(options.av_layout == PAV_RIGHT) {
+ } else if (options.av_layout == PAV_RIGHT) {
avr.right = r.right - options.av_padding;
- if(pwd->have_av && options.time_layout == PT_WITHAV) avr.left = avr.right - max(pwd->real_av_width, pwd->time_width);
- else if(pwd->have_av) avr.left = avr.right - pwd->real_av_width;
+ if (pwd->have_av && options.time_layout == PT_WITHAV) avr.left = avr.right - max(pwd->real_av_width, pwd->time_width);
+ else if (pwd->have_av) avr.left = avr.right - pwd->real_av_width;
else avr.left = avr.right - pwd->time_width;
r.right = avr.left;
}
- if(options.time_layout == PT_WITHAV) {
+ if (options.time_layout == PT_WITHAV) {
avr.top = options.padding;
avr.bottom = avr.top + pwd->time_height;
- if(pwd->custom_col) SetTextColor(ps.hdc, pd->colorText);
+ if (pwd->custom_col) SetTextColor(ps.hdc, pd->colorText);
else SetTextColor(ps.hdc, colTime);
- if(hFontTime) SelectObject(hdc, (HGDIOBJ)hFontTime);
+ if (hFontTime) SelectObject(hdc, (HGDIOBJ)hFontTime);
DrawText(ps.hdc, pwd->tbuff, (int)_tcslen(pwd->tbuff), &avr, DT_VCENTER | DT_CENTER | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
avr.top = avr.bottom + options.av_padding;
}
- if(pwd->have_av) {
+ if (pwd->have_av) {
// correct for wider time
- if(options.time_layout == PT_WITHAV && pwd->time_width > options.av_size) {
+ if (options.time_layout == PT_WITHAV && pwd->time_width > options.av_size) {
avr.left = avr.left + (pwd->time_width - pwd->real_av_width) / 2;
avr.right = avr.left + pwd->real_av_width;
}
@@ -448,8 +448,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
// title icon
int iconx, textxmin = r.left + options.padding, textxmax = r.right - options.padding;
- if(pd->hIcon) {
- if(options.right_icon) {
+ if (pd->hIcon) {
+ if (options.right_icon) {
iconx = r.right - (16 + options.padding);
textxmax -= 16 + options.padding;
} else {
@@ -460,12 +460,12 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
// title time
- if(options.time_layout == PT_LEFT || options.time_layout == PT_RIGHT) {
+ if (options.time_layout == PT_LEFT || options.time_layout == PT_RIGHT) {
RECT ttr;
ttr.top = r.top + options.padding; ttr.bottom = ttr.top + pwd->tb_height;
- if(pwd->custom_col) SetTextColor(ps.hdc, pd->colorText);
+ if (pwd->custom_col) SetTextColor(ps.hdc, pd->colorText);
else SetTextColor(ps.hdc, colTime);
- if(hFontTime) SelectObject(hdc, (HGDIOBJ)hFontTime);
+ if (hFontTime) SelectObject(hdc, (HGDIOBJ)hFontTime);
switch(options.time_layout) {
case PT_LEFT:
ttr.left = textxmin; ttr.right = ttr.left + pwd->time_width;
@@ -482,14 +482,14 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
}
- if(textxmin < options.sb_width) textxmin = options.sb_width + options.padding / 2;
+ if (textxmin < options.sb_width) textxmin = options.sb_width + options.padding / 2;
// title text
- if(hFontFirstLine) SelectObject(ps.hdc, (HGDIOBJ)hFontFirstLine);
+ if (hFontFirstLine) SelectObject(ps.hdc, (HGDIOBJ)hFontFirstLine);
RECT tr;
tr.left = r.left + options.padding + options.text_indent; tr.right = textxmax; tr.top = r.top + options.padding; tr.bottom = tr.top + pwd->tb_height;
- if(pwd->custom_col) SetTextColor(ps.hdc, pd->colorText);
+ if (pwd->custom_col) SetTextColor(ps.hdc, pd->colorText);
else SetTextColor(ps.hdc, colFirstLine);
TCHAR *title = mir_u2t(pd->pwzTitle);
DrawText(ps.hdc, title, (int)_tcslen(title), &tr, DT_VCENTER | DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX);
@@ -504,13 +504,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
FillRect(ps.hdc, &tur, pwd->underlineBrush);
// second line(s)
- if(pd->pwzText[0]) {
- if(hFontSecondLine) SelectObject(ps.hdc, (HGDIOBJ)hFontSecondLine);
+ if (pd->pwzText[0]) {
+ if (hFontSecondLine) SelectObject(ps.hdc, (HGDIOBJ)hFontSecondLine);
if (!pwd->custom_col)
SetTextColor(ps.hdc, colSecondLine);
// expand text if no avatar and the time isn't too large
- if(options.av_layout != PAV_NONE && options.time_layout == PT_WITHAV && pwd->time_height <= pwd->tb_height && !pwd->have_av)
+ if (options.av_layout != PAV_NONE && options.time_layout == PT_WITHAV && pwd->time_height <= pwd->tb_height && !pwd->have_av)
GetClientRect(hwnd, &r);
TCHAR *text = mir_u2t(pd->pwzText);
@@ -525,7 +525,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
return 0;
case WM_DESTROY:
- if(pwd->mouse_in) global_mouse_in--;
+ if (pwd->mouse_in) global_mouse_in--;
ShowWindow(hwnd, SW_HIDE);
@@ -551,7 +551,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
case PUM_UPDATERGN:
// round corners
- if(pwd->is_round) {
+ if (pwd->is_round) {
HRGN hRgn1;
RECT r;
@@ -567,7 +567,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
return TRUE;
case PUM_MOVE:
- if(options.animate) {
+ if (options.animate) {
KillTimer(hwnd, ID_MOVETIMER);
pwd->new_x = (int)wParam;
pwd->new_y = (int)lParam;
@@ -591,7 +591,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
{
HANDLE *phContact = (HANDLE *)wParam;
*phContact = pd->hContact;
- if(lParam) SetEvent((HANDLE)lParam);
+ if (lParam) SetEvent((HANDLE)lParam);
}
return TRUE;
case PUM_GETHEIGHT:
@@ -601,30 +601,30 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
SIZE size;
// time_height + width
- if(options.time_layout != PT_NONE) {
+ if (options.time_layout != PT_NONE) {
SIZE size_t;
- if(hFontTime) SelectObject(hdc, (HGDIOBJ)hFontTime);
+ if (hFontTime) SelectObject(hdc, (HGDIOBJ)hFontTime);
GetTextExtentPoint32(hdc, pwd->tbuff, (int)_tcslen(pwd->tbuff), &size_t);
pwd->time_height = size_t.cy;
pwd->time_width = size_t.cx;
}
// titlebar height
- if(hFontFirstLine) SelectObject(hdc, (HGDIOBJ)hFontFirstLine);
+ if (hFontFirstLine) SelectObject(hdc, (HGDIOBJ)hFontFirstLine);
TCHAR *title = mir_u2t(pd->pwzTitle);
GetTextExtentPoint32(hdc, title, (int)_tcslen(title), &size);
mir_free(title);
pwd->tb_height = size.cy;
- if(options.time_layout == PT_LEFT || options.time_layout == PT_RIGHT) {
- if(pwd->tb_height < pwd->time_height) pwd->tb_height = pwd->time_height;
+ if (options.time_layout == PT_LEFT || options.time_layout == PT_RIGHT) {
+ if (pwd->tb_height < pwd->time_height) pwd->tb_height = pwd->time_height;
}
- if(pwd->tb_height < 16) pwd->tb_height = 16;
+ if (pwd->tb_height < 16) pwd->tb_height = 16;
// avatar height
- if(options.av_layout != PAV_NONE && ServiceExists(MS_AV_DRAWAVATAR)) {
+ if (options.av_layout != PAV_NONE && ServiceExists(MS_AV_DRAWAVATAR)) {
AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)pd->hContact, 0);
- if(ace && (ace->dwFlags & AVS_BITMAP_VALID) && !(ace->dwFlags & AVS_HIDEONCLIST)) {
- if(ace->bmHeight >= ace->bmWidth) {
+ if (ace && (ace->dwFlags & AVS_BITMAP_VALID) && !(ace->dwFlags & AVS_HIDEONCLIST)) {
+ if (ace->bmHeight >= ace->bmWidth) {
pwd->real_av_height = options.av_size;
pwd->real_av_width = options.av_size * ace->bmWidth / ace->bmHeight;
} else {
@@ -641,14 +641,14 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
RECT r;
r.left = r.top = 0;
r.right = options.win_width - 2 * options.padding - options.text_indent;
- if(pwd->have_av && options.time_layout == PT_WITHAV)
+ if (pwd->have_av && options.time_layout == PT_WITHAV)
r.right -= (max(options.av_size, pwd->time_width) + options.padding);
- else if(pwd->have_av)
+ else if (pwd->have_av)
r.right -= (options.av_size + options.padding);
- else if(options.av_layout != PAV_NONE && options.time_layout == PT_WITHAV && pwd->time_height >= pwd->tb_height)
+ else if (options.av_layout != PAV_NONE && options.time_layout == PT_WITHAV && pwd->time_height >= pwd->tb_height)
r.right -= pwd->time_width + options.padding;
- if(hFontSecondLine) SelectObject(hdc, (HGDIOBJ)hFontSecondLine);
+ if (hFontSecondLine) SelectObject(hdc, (HGDIOBJ)hFontSecondLine);
TCHAR *text = mir_u2t(pd->pwzText);
DrawText(hdc, text, (int)_tcslen(text), &r, DT_CALCRECT | DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
pwd->text_height = r.bottom;
@@ -657,7 +657,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
ReleaseDC(hwnd, hdc);
- if(options.time_layout == PT_WITHAV && options.av_layout != PAV_NONE)
+ if (options.time_layout == PT_WITHAV && options.av_layout != PAV_NONE)
*pHeight = max(pwd->tb_height + pwd->text_height + 3 * options.padding, pwd->av_height + pwd->time_height + options.padding + 2 * options.av_padding);
else
*pHeight = max(pwd->tb_height + pwd->text_height + 3 * options.padding, pwd->av_height + 2 * options.av_padding);
@@ -666,7 +666,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
RECT r;
GetWindowRect(hwnd, &r);
- if(r.right - r.left != options.win_width || r.bottom - r.top != *pHeight) {
+ if (r.right - r.left != options.win_width || r.bottom - r.top != *pHeight) {
SetWindowPos(hwnd, 0, 0, 0, options.win_width, *pHeight, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
SendMessage(hwnd, PUM_UPDATERGN, 0, 0);
InvalidateRect(hwnd, 0, TRUE);
@@ -676,8 +676,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
case PUM_GETOPAQUE:
{
void **pData = (void **)wParam;
- if(pd) *pData = pd->opaque;
- if(lParam) SetEvent((HANDLE)lParam);
+ if (pd) *pData = pd->opaque;
+ if (lParam) SetEvent((HANDLE)lParam);
}
return TRUE;
case PUM_CHANGE:
@@ -690,8 +690,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
pwd->pd = pd = (PopupData *)lParam;
- if(pd->timeout != -1) {
- if(pd->timeout == 0) {
+ if (pd->timeout != -1) {
+ if (pd->timeout == 0) {
SetTimer(hwnd, ID_CLOSETIMER, 7 * 1000, 0);
} else {
SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0);
@@ -711,7 +711,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
return TRUE;
case PUM_UPDATENOTIFY:
- if(pwd->hNotify == (HANDLE)wParam) {
+ if (pwd->hNotify == (HANDLE)wParam) {
pd->colorBack = MNotifyGetDWord(pwd->hNotify, NFOPT_BACKCOLOR, colBg);
pd->colorText = MNotifyGetDWord(pwd->hNotify, NFOPT_TEXTCOLOR, colSecondLine);
pd->timeout = MNotifyGetDWord(pwd->hNotify, NFOPT_TIMEOUT, options.default_timeout);
@@ -732,7 +732,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
return TRUE;
case PUM_KILLNOTIFY:
- if(pwd->hNotify != (HANDLE)wParam)
+ if (pwd->hNotify != (HANDLE)wParam)
return TRUE;
// drop through
@@ -742,11 +742,11 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
- if(pd && pd->windowProc)
+ if (pd && pd->windowProc)
return CallWindowProc(pd->windowProc, hwnd, uMsg, wParam, lParam);
else {
// provide a way to close popups, if no PluginWindowProc is provided
- if(uMsg == WM_CONTEXTMENU) {
+ if (uMsg == WM_CONTEXTMENU) {
SendMessage(hwnd, PM_DESTROY, 0, 0);
return TRUE;
} else
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp
index 4dd00fcd38..16c83169f0 100644
--- a/plugins/YAPP/src/services.cpp
+++ b/plugins/YAPP/src/services.cpp
@@ -10,7 +10,7 @@ HANDLE hService[NUM_SERVICES];
HANDLE hMenuShowHistory, hMenuToggleOnOff;
void StripBBCodesInPlace(wchar_t *text) {
- if(text == 0 || DBGetContactSettingByte(0, MODULE, "StripBBCodes", 1) == 0)
+ if (text == 0 || db_get_b(0, MODULE, "StripBBCodes", 1) == 0)
return;
int read = 0, write = 0;
@@ -18,27 +18,27 @@ void StripBBCodesInPlace(wchar_t *text) {
while(read <= len) { // copy terminating null too
while(read <= len && text[read] != L'[') {
- if(text[read] != text[write]) text[write] = text[read];
+ if (text[read] != text[write]) text[write] = text[read];
read++; write++;
}
- if(read > len) break;
+ if (read > len) break;
- if(len - read >= 3 && (_wcsnicmp(text + read, L"[b]", 3) == 0 || _wcsnicmp(text + read, L"[i]", 3) == 0))
+ if (len - read >= 3 && (_wcsnicmp(text + read, L"[b]", 3) == 0 || _wcsnicmp(text + read, L"[i]", 3) == 0))
read += 3;
- else if(len - read >= 4 && (_wcsnicmp(text + read, L"[/b]", 4) == 0 || _wcsnicmp(text + read, L"[/i]", 4) == 0))
+ else if (len - read >= 4 && (_wcsnicmp(text + read, L"[/b]", 4) == 0 || _wcsnicmp(text + read, L"[/i]", 4) == 0))
read += 4;
- else if(len - read >= 6 && (_wcsnicmp(text + read, L"[color", 6) == 0)) {
+ else if (len - read >= 6 && (_wcsnicmp(text + read, L"[color", 6) == 0)) {
while(read < len && text[read] != L']') read++;
read++;// skip the ']'
- } else if(len - read >= 8 && (_wcsnicmp(text + read, L"[/color]", 8) == 0))
+ } else if (len - read >= 8 && (_wcsnicmp(text + read, L"[/color]", 8) == 0))
read += 8;
- else if(len - read >= 5 && (_wcsnicmp(text + read, L"[size", 5) == 0)) {
+ else if (len - read >= 5 && (_wcsnicmp(text + read, L"[size", 5) == 0)) {
while(read < len && text[read] != L']') read++;
read++;// skip the ']'
- } else if(len - read >= 7 && (_wcsnicmp(text + read, L"[/size]", 7) == 0))
+ } else if (len - read >= 7 && (_wcsnicmp(text + read, L"[/size]", 7) == 0))
read += 7;
else {
- if(text[read] != text[write]) text[write] = text[read];
+ if (text[read] != text[write]) text[write] = text[read];
read++; write++;
}
}
@@ -57,7 +57,7 @@ INT_PTR OldCreatePopupA(WPARAM wParam, LPARAM lParam) {
pd_out->hContact = pd_in->lchContact;
pd_out->hIcon = pd_in->lchIcon;
- if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
+ if (pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
pd_out->colorBack = pd_out->colorText = 0;
else {
pd_out->colorBack = pd_in->colorBack & 0xFFFFFF;
@@ -69,7 +69,7 @@ INT_PTR OldCreatePopupA(WPARAM wParam, LPARAM lParam) {
lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
- if (!DBGetContactSettingByte(0, MODULE, "Enabled", 1)) {
+ if (!db_get_b(0, MODULE, "Enabled", 1)) {
mir_free(pd_out->pwzTitle);
mir_free(pd_out->pwzText);
mir_free(pd_out);
@@ -95,7 +95,7 @@ INT_PTR OldCreatePopupExA(WPARAM wParam, LPARAM lParam) {
pd_out->hContact = pd_in->lchContact;
pd_out->hIcon = pd_in->lchIcon;
- if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
+ if (pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
pd_out->colorBack = pd_out->colorText = 0;
else {
pd_out->colorBack = pd_in->colorBack & 0xFFFFFF;
@@ -106,7 +106,7 @@ INT_PTR OldCreatePopupExA(WPARAM wParam, LPARAM lParam) {
pd_out->timeout = pd_in->iSeconds;
lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
- if (!DBGetContactSettingByte(0, MODULE, "Enabled", 1)) {
+ if (!db_get_b(0, MODULE, "Enabled", 1)) {
mir_free(pd_out->pwzTitle);
mir_free(pd_out->pwzText);
mir_free(pd_out);
@@ -132,7 +132,7 @@ INT_PTR OldCreatePopupW(WPARAM wParam, LPARAM lParam) {
pd_out->hContact = pd_in->lchContact;
pd_out->hIcon = pd_in->lchIcon;
- if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
+ if (pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
pd_out->colorBack = pd_out->colorText = 0;
else {
pd_out->colorBack = pd_in->colorBack & 0xFFFFFF;
@@ -143,7 +143,7 @@ INT_PTR OldCreatePopupW(WPARAM wParam, LPARAM lParam) {
pd_out->timeout = pd_in->iSeconds;
lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
- if (!DBGetContactSettingByte(0, MODULE, "Enabled", 1)) {
+ if (!db_get_b(0, MODULE, "Enabled", 1)) {
mir_free(pd_out->pwzTitle);
mir_free(pd_out->pwzText);
mir_free(pd_out);
@@ -161,7 +161,7 @@ INT_PTR ChangeTextW(WPARAM wParam, LPARAM lParam)
wchar_t *newText = NEWWSTR_ALLOCA((wchar_t *)lParam);
StripBBCodesInPlace(newText);
- if(IsWindow(hwndPop))
+ if (IsWindow(hwndPop))
SendMessage(hwndPop, PUM_SETTEXT, 0, (LPARAM)newText);
else
mir_free(newText);
@@ -174,7 +174,7 @@ INT_PTR ChangeTextA(WPARAM wParam, LPARAM lParam) {
wchar_t* buff = mir_a2u(newText);
StripBBCodesInPlace(buff);
- if(IsWindow(hwndPop))
+ if (IsWindow(hwndPop))
SendMessage(hwndPop, PUM_SETTEXT, 0, (LPARAM)buff);
mir_free(buff);
@@ -198,7 +198,7 @@ void ShowPopup(PopupData &pd_in)
lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
- if (!DBGetContactSettingByte(0, MODULE, "Enabled", 1))
+ if (!db_get_b(0, MODULE, "Enabled", 1))
{
mir_free(pd_out->pwzTitle);
mir_free(pd_out->pwzText);
@@ -211,7 +211,7 @@ void ShowPopup(PopupData &pd_in)
INT_PTR GetContact(WPARAM wParam, LPARAM lParam) {
HWND hwndPop = (HWND)wParam;
HANDLE hContact;
- if(GetCurrentThreadId() == message_pump_thread_id) {
+ if (GetCurrentThreadId() == message_pump_thread_id) {
SendMessage(hwndPop, PUM_GETCONTACT, (WPARAM)&hContact, 0);
} else {
HANDLE hEvent = CreateEvent(0, 0, 0, 0);
@@ -226,7 +226,7 @@ INT_PTR GetContact(WPARAM wParam, LPARAM lParam) {
INT_PTR GetOpaque(WPARAM wParam, LPARAM lParam) {
HWND hwndPop = (HWND)wParam;
void *data = 0;
- if(GetCurrentThreadId() == message_pump_thread_id) {
+ if (GetCurrentThreadId() == message_pump_thread_id) {
SendMessage(hwndPop, PUM_GETOPAQUE, (WPARAM)&data, 0);
} else {
HANDLE hEvent = CreateEvent(0, 0, 0, 0);
@@ -245,7 +245,7 @@ INT_PTR IsSecondLineShown(WPARAM wParam, LPARAM lParam) {
void UpdateMenu() {
CLISTMENUITEM mi = {0};
mi.cbSize = sizeof(CLISTMENUITEM);
- mi.pszName = (char*)(DBGetContactSettingByte(0, MODULE, "Enabled", 1) == 1 ? LPGEN("Disable Popups") : LPGEN("Enable Popups"));
+ mi.pszName = (char*)(db_get_b(0, MODULE, "Enabled", 1) == 1 ? LPGEN("Disable Popups") : LPGEN("Enable Popups"));
mi.flags = CMIM_NAME;// | CMIM_ICON;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuToggleOnOff, (LPARAM)&mi);
}
@@ -254,20 +254,20 @@ INT_PTR PopupQuery(WPARAM wParam, LPARAM lParam) {
switch(wParam) {
case PUQS_ENABLEPOPUPS:
{
- bool enabled = DBGetContactSettingByte(0, MODULE, "Enabled", 1) != 0;
- if (!enabled) DBWriteContactSettingByte(0, MODULE, "Enabled", 1);
+ bool enabled = db_get_b(0, MODULE, "Enabled", 1) != 0;
+ if (!enabled) db_set_b(0, MODULE, "Enabled", 1);
return !enabled;
}
break;
case PUQS_DISABLEPOPUPS:
{
- bool enabled = DBGetContactSettingByte(0, MODULE, "Enabled", 1) != 0;
- if (enabled) DBWriteContactSettingByte(0, MODULE, "Enabled", 0);
+ bool enabled = db_get_b(0, MODULE, "Enabled", 1) != 0;
+ if (enabled) db_set_b(0, MODULE, "Enabled", 0);
return enabled;
}
break;
case PUQS_GETSTATUS:
- return DBGetContactSettingByte(0, MODULE, "Enabled", 1);
+ return db_get_b(0, MODULE, "Enabled", 1);
default:
return 1;
}
@@ -276,8 +276,8 @@ INT_PTR PopupQuery(WPARAM wParam, LPARAM lParam) {
}
INT_PTR TogglePopups(WPARAM wParam, LPARAM lParam) {
- BYTE val = DBGetContactSettingByte(0, MODULE, "Enabled", 1);
- DBWriteContactSettingByte(0, MODULE, "Enabled", !val);
+ BYTE val = db_get_b(0, MODULE, "Enabled", 1);
+ db_set_b(0, MODULE, "Enabled", !val);
UpdateMenu();
return 0;
}
@@ -286,7 +286,7 @@ INT_PTR PopupChangeA(WPARAM wParam, LPARAM lParam) {
HWND hwndPop = (HWND)wParam;
POPUPDATAEX *pd_in = (POPUPDATAEX *)lParam;
- if(IsWindow(hwndPop)) {
+ if (IsWindow(hwndPop)) {
PopupData pd_out;
pd_out.cbSize = sizeof(PopupData);
pd_out.flags = PDF_UNICODE;
@@ -298,7 +298,7 @@ INT_PTR PopupChangeA(WPARAM wParam, LPARAM lParam) {
pd_out.hContact = pd_in->lchContact;
pd_out.hIcon = pd_in->lchIcon;
- if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
+ if (pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
pd_out.colorBack = pd_out.colorText = 0;
else {
pd_out.colorBack = pd_in->colorBack & 0xFFFFFF;
@@ -321,7 +321,7 @@ INT_PTR PopupChangeW(WPARAM wParam, LPARAM lParam) {
HWND hwndPop = (HWND)wParam;
POPUPDATAW *pd_in = (POPUPDATAW *)lParam;
- if(IsWindow(hwndPop)) {
+ if (IsWindow(hwndPop)) {
PopupData pd_out;
pd_out.cbSize = sizeof(PopupData);
pd_out.flags = PDF_UNICODE;
@@ -333,7 +333,7 @@ INT_PTR PopupChangeW(WPARAM wParam, LPARAM lParam) {
pd_out.hContact = pd_in->lchContact;
pd_out.hIcon = pd_in->lchIcon;
- if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
+ if (pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
pd_out.colorBack = pd_out.colorText = 0;
else {
pd_out.colorBack = pd_in->colorBack & 0xFFFFFF;
@@ -353,7 +353,7 @@ INT_PTR PopupChangeW(WPARAM wParam, LPARAM lParam) {
}
INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam) {
- if (!DBGetContactSettingByte(0, MODULE, "Enabled", 1)) return 0;
+ if (!db_get_b(0, MODULE, "Enabled", 1)) return 0;
POPUPDATAT pd = {0};
_tcscpy(pd.lptzContactName, lParam == SM_WARNING ? _T("Warning") : _T("Notification"));
@@ -368,7 +368,7 @@ INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam) {
}
INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam) {
- if (!DBGetContactSettingByte(0, MODULE, "Enabled", 1)) return 0;
+ if (!db_get_b(0, MODULE, "Enabled", 1)) return 0;
POPUPDATAW pd = {0};
wcscpy(pd.lpwzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification");
@@ -402,7 +402,7 @@ INT_PTR RegisterPopupClass(WPARAM wParam, LPARAM lParam)
num_classes++;
pc->pszName = mir_strdup(pc->pszName);
- if(pc->flags & PCF_UNICODE)
+ if (pc->flags & PCF_UNICODE)
pc->pwszDescription = mir_wstrdup(pc->pwszDescription);
else
pc->pszDescription = mir_strdup(pc->pszDescription);
@@ -410,11 +410,11 @@ INT_PTR RegisterPopupClass(WPARAM wParam, LPARAM lParam)
char setting[256];
mir_snprintf(setting, 256, "%s/Timeout", pc->pszName);
pc->iSeconds = DBGetContactSettingWord(0, MODULE, setting, pc->iSeconds);
- if(pc->iSeconds == (WORD)-1) pc->iSeconds = -1;
+ if (pc->iSeconds == (WORD)-1) pc->iSeconds = -1;
mir_snprintf(setting, 256, "%s/TextCol", pc->pszName);
- pc->colorText = (COLORREF)DBGetContactSettingDword(0, MODULE, setting, (DWORD)pc->colorText);
+ pc->colorText = (COLORREF)db_get_dw(0, MODULE, setting, (DWORD)pc->colorText);
mir_snprintf(setting, 256, "%s/BgCol", pc->pszName);
- pc->colorBack = (COLORREF)DBGetContactSettingDword(0, MODULE, setting, (DWORD)pc->colorBack);
+ pc->colorBack = (COLORREF)db_get_dw(0, MODULE, setting, (DWORD)pc->colorBack);
return 0;
}
@@ -422,22 +422,22 @@ INT_PTR RegisterPopupClass(WPARAM wParam, LPARAM lParam)
INT_PTR CreateClassPopup(WPARAM wParam, LPARAM lParam)
{
POPUPDATACLASS *pdc = (POPUPDATACLASS *)lParam;
- if(pdc->cbSize < sizeof(POPUPDATACLASS)) return 1;
+ if (pdc->cbSize < sizeof(POPUPDATACLASS)) return 1;
POPUPCLASS *pc = 0;
- if(wParam)
+ if (wParam)
pc = (POPUPCLASS *)wParam;
else {
- for(int i = 0; i < num_classes; i++) {
- if(strcmp(classes[i].pszName, pdc->pszClassName) == 0) {
+ for (int i = 0; i < num_classes; i++) {
+ if (strcmp(classes[i].pszName, pdc->pszClassName) == 0) {
pc = &classes[i];
break;
}
}
}
- if(pc) {
+ if (pc) {
PopupData pd = {sizeof(PopupData)};
- if(pc->flags & PCF_UNICODE) pd.flags |= PDF_UNICODE;
+ if (pc->flags & PCF_UNICODE) pd.flags |= PDF_UNICODE;
pd.colorBack = pc->colorBack;
pd.colorText = pc->colorText;
pd.hIcon = pc->hIcon;
@@ -502,7 +502,7 @@ void InitServices()
mi.hIcon = NULL;
mi.pszService = "PopUp/ToggleEnabled";
- mi.pszName = (char*)(DBGetContactSettingByte(0, MODULE, "Enabled", 1) ?
+ mi.pszName = (char*)(db_get_b(0, MODULE, "Enabled", 1) ?
LPGEN("Disable Popups") : LPGEN("Enable Popups"));
hMenuToggleOnOff = Menu_AddMainMenuItem(&mi);
@@ -511,7 +511,7 @@ void InitServices()
void DeinitServices() {
int i;
- for(i = 0; i < num_classes; i++) {
+ for (i = 0; i < num_classes; i++) {
mir_free(classes[i].pszName);
mir_free(classes[i].pszDescription);
}
@@ -519,6 +519,6 @@ void DeinitServices() {
UnhookEvent(hEventBuildMenu);
- for(i = 0; i < NUM_SERVICES; i++)
- if(hService[i]) DestroyServiceFunction(hService[i]);
+ for (i = 0; i < NUM_SERVICES; i++)
+ if (hService[i]) DestroyServiceFunction(hService[i]);
}
diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp
index 616f9b70de..4f9c289d12 100644
--- a/plugins/YAPP/src/yapp.cpp
+++ b/plugins/YAPP/src/yapp.cpp
@@ -59,13 +59,13 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_POPUPS,
int ReloadFont(WPARAM wParam, LPARAM lParam)
{
LOGFONTW log_font;
- if(hFontFirstLine) DeleteObject(hFontFirstLine);
+ if (hFontFirstLine) DeleteObject(hFontFirstLine);
colFirstLine = CallService(MS_FONT_GETW, (WPARAM)&font_id_firstlinew, (LPARAM)&log_font);
hFontFirstLine = CreateFontIndirectW(&log_font);
- if(hFontSecondLine) DeleteObject(hFontSecondLine);
+ if (hFontSecondLine) DeleteObject(hFontSecondLine);
colSecondLine = CallService(MS_FONT_GETW, (WPARAM)&font_id_secondlinew, (LPARAM)&log_font);
hFontSecondLine = CreateFontIndirectW(&log_font);
- if(hFontTime) DeleteObject(hFontTime);
+ if (hFontTime) DeleteObject(hFontTime);
colTime = CallService(MS_FONT_GETW, (WPARAM)&font_id_timew, (LPARAM)&log_font);
hFontTime = CreateFontIndirectW(&log_font);
@@ -163,7 +163,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
LoadModuleDependentOptions();
- if(GetModuleHandle(_T("neweventnotify")))
+ if (GetModuleHandle(_T("neweventnotify")))
ignore_gpd_passed_addy = true;
return 0;
@@ -208,7 +208,7 @@ extern "C" int YAPP_API Load(void) {
extern "C" int YAPP_API Unload()
{
- if(hEventReloadFont)
+ if (hEventReloadFont)
UnhookEvent(hEventReloadFont);
UnhookEvent(hEventPreShutdown);
UnhookEvent(hEventModulesLoaded);