From b563eba7514c70e53e13cf0cffc5bf1245e5d654 Mon Sep 17 00:00:00 2001 From: slotwin Date: Tue, 20 May 2014 19:10:54 +0000 Subject: Popup/options: fix Apply button highlighting add spin controls to edit boxes proper capitalization and a typo code cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@9255 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/res/resource.rc | 77 +++++++++++----- plugins/Popup/src/actions.cpp | 105 +++++++++++----------- plugins/Popup/src/icons.cpp | 32 +++---- plugins/Popup/src/opt_adv.cpp | 101 +++++++++++---------- plugins/Popup/src/opt_gen.cpp | 201 ++++++++++++++++++++---------------------- plugins/Popup/src/opttree.cpp | 143 +++++++++++++----------------- plugins/Popup/src/resource.h | 4 +- 7 files changed, 336 insertions(+), 327 deletions(-) (limited to 'plugins/Popup') diff --git a/plugins/Popup/res/resource.rc b/plugins/Popup/res/resource.rc index a9173fd542..6f390d8cb4 100644 --- a/plugins/Popup/res/resource.rc +++ b/plugins/Popup/res/resource.rc @@ -13,11 +13,11 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Нейтральный resources +// Neutral resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1251) +#pragma code_page(1250) ///////////////////////////////////////////////////////////////////////////// // @@ -81,8 +81,8 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "History",IDC_STATIC,3,3,143,56 CONTROL "Enable popup history",IDC_ENABLE_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,15,134,8 - RTEXT "Store last",IDC_HISTORY_STATIC1,8,25,58,12,SS_CENTERIMAGE - EDITTEXT IDC_HISTORYSIZE,68,25,26,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Store last",IDC_HISTORY_STATIC1,8,25,47,12,SS_CENTERIMAGE + EDITTEXT IDC_HISTORYSIZE,57,25,37,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER LTEXT "events",IDC_HISTORY_STATIC2,99,25,42,12,SS_CENTERIMAGE CONTROL "",IDC_SHOWHISTORY,"MButtonClass",WS_TABSTOP,9,37,16,15 CONTROL "Use History++ to render log",IDC_HPPLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,30,40,111,8 @@ -110,7 +110,7 @@ BEGIN CONTROL "Opaque popups under cursor",IDC_TRANS_OPAQUEONHOVER, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,175,40,118,8 GROUPBOX "Effects",IDC_STATIC,151,63,146,84 - CONTROL "Slide Popup",IDC_USEANIMATIONS,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,157,79,136,8 + CONTROL "Slide popup",IDC_USEANIMATIONS,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,157,79,136,8 LTEXT "Effect:",IDC_EFFECT_TXT,157,90,33,12,SS_CENTERIMAGE COMBOBOX IDC_EFFECT,191,91,78,64,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP RTEXT "Time (in):",IDC_FADEIN_TXT1,157,107,69,12,SS_CENTERIMAGE @@ -122,9 +122,11 @@ BEGIN CONTROL "",IDC_FADEOUT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,257,121,11,14 LTEXT "ms",IDC_FADEOUT_TXT2,274,122,20,12,SS_CENTERIMAGE LTEXT "Limit window amount to:",IDC_STATIC,154,159,96,12,SS_CENTERIMAGE - EDITTEXT IDC_MAXPOPUPS,255,159,26,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_MAXPOPUPS,255,159,37,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER ICON IDI_MB_WARN,IDC_ICO_RESTART,8,201,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE | NOT WS_VISIBLE PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 + CONTROL "",IDC_HISTORYSIZE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS,84,25,11,14 + CONTROL "",IDC_MAXPOPUPS_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS,282,159,11,14 END IDD_OPT_SKIN2 DIALOGEX 0, 0, 304, 228 @@ -166,7 +168,7 @@ BEGIN EDITTEXT IDC_TXT_RIGHT,155,70,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER EDITTEXT IDC_TXT_BOTTOM,83,105,25,12,ES_CENTER | ES_AUTOHSCROLL | ES_NUMBER LTEXT "Desktop",IDC_STATIC,10,25,71,8 - LTEXT "Popup Area",IDC_STATIC,44,48,99,8 + LTEXT "Popup area",IDC_STATIC,44,48,99,8 LTEXT "pixel(s)",IDC_STATIC,112,25,38,14,SS_CENTERIMAGE LTEXT "pixel(s)",IDC_STATIC,112,104,38,14,SS_CENTERIMAGE CTEXT "pixel(s)",IDC_STATIC,10,84,25,8 @@ -186,9 +188,9 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "General",IDC_STATIC,3,3,143,45 CONTROL "Enable popup actions",IDC_CHK_ENABLEACTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,14,136,10 - ICON IDI_MB_INFO,IDC_ICO_INFO,6,23,21,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE - LTEXT "Popup Actions are those tiny buttons below notification text.",IDC_STATIC,27,24,116,22 - GROUPBOX "Common Actions",IDC_GRP_CUSTOMACTIONS,3,51,143,71 + ICON IDI_MB_INFO,IDC_ICO_INFO,6,23,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE + LTEXT "Popup actions are those tiny buttons below notification text.",IDC_STATIC,27,24,116,22 + GROUPBOX "Common actions",IDC_GRP_CUSTOMACTIONS,3,51,143,71 LTEXT "Please choose in what cases default actions should be added:",IDC_TXT_CUSTOMACTIONS,8,61,136,17 CONTROL "Add info && menu for IM contacts only",IDC_CHK_IMCONTACTSONLY, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,82,136,10 @@ -196,20 +198,20 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,95,136,10 CONTROL "Don't close popups on default actions",IDC_CHK_DONTCLOSE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,107,136,10 - GROUPBOX "Size && Position",IDC_GRP_SIZEPOSITION,3,125,143,72 + GROUPBOX "Size and position",IDC_GRP_SIZEPOSITION,3,125,143,72 CONTROL "Use large icons",IDC_CHK_LARGEICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,135,136,10 LTEXT "Popup actions will be displayed as:",IDC_TXT_POSITION,8,147,136,8 CONTROL "Icons and labels below text",IDC_RD_TEXT,"Button",BS_AUTORADIOBUTTON,26,159,117,10 CONTROL "Icons on the left",IDC_RD_LEFTICONS,"Button",BS_AUTORADIOBUTTON,26,171,117,10 CONTROL "Icons aligned to the right",IDC_RD_RIGHTICONS,"Button",BS_AUTORADIOBUTTON,26,183,117,10 - GROUPBOX "Show Actions: (requires apply)",IDC_GRP_ACTIONS,151,3,146,134 + GROUPBOX "Show actions: (requires apply)",IDC_GRP_ACTIONS,151,3,146,134 CONTROL "",IDC_ACTIONS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,156,13,136,118 - GROUPBOX "Mouse Actions Overwrite",IDC_GRP_SIZEPOSITION2,151,141,146,56 - CONTROL "Left Button",IDC_TXT_POSITION2,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,152,64,12 + GROUPBOX "Mouse actions overwrite",IDC_GRP_SIZEPOSITION2,151,141,146,56 + CONTROL "Left button",IDC_TXT_POSITION2,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,152,64,12 COMBOBOX IDC_CB_LEFT,223,152,69,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Middle Button",IDC_TXT_MIDDLE,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,166,64,12 + CONTROL "Middle button",IDC_TXT_MIDDLE,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,166,64,12 COMBOBOX IDC_CB_MIDDLE,223,166,69,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Right Button",IDC_TXT_RIGHT,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,180,64,12 + CONTROL "Right button",IDC_TXT_RIGHT,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,157,180,64,12 COMBOBOX IDC_CB_RIGHT,223,180,69,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 END @@ -250,8 +252,8 @@ BEGIN CONTROL "",IDC_SINVISIBLE2,"MButtonClass",WS_TABSTOP,244,151,15,14 CONTROL "",IDC_SPHONE2,"MButtonClass",WS_TABSTOP,260,151,15,14 CONTROL "",IDC_SLUNCH2,"MButtonClass",WS_TABSTOP,276,151,16,14 - ICON IDI_MB_INFO,IDC_ICO_INFO,112,170,21,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE - LTEXT "Colors can be configured in\r\nCustomize > Fonts && Colors",IDC_TXT_COLORS,132,171,108,24 + ICON IDI_MB_INFO,IDC_ICO_INFO,112,170,20,20,SS_CENTERIMAGE | SS_REALSIZEIMAGE + LTEXT "Colors can be configured in\r\nCustomize > Fonts and colors",IDC_TXT_COLORS,132,171,108,24 PUSHBUTTON "More...",IDC_MORE,242,176,50,14 PUSHBUTTON "Live Preview",IDC_PREVIEW,219,203,73,14 CONTROL "Disable if message window is open",IDC_CHECKWINDOW, @@ -285,14 +287,14 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Default Timeout",IDC_STATIC,3,3,143,53 + GROUPBOX "Default timeout",IDC_STATIC,3,3,143,53 CONTROL "Infinite popup delay",IDC_INFINITEDELAY,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,9,15,133,8 LTEXT "Popup delay:",IDC_SECONDS_STATIC1,18,26,50,12,SS_CENTERIMAGE EDITTEXT IDC_SECONDS,70,26,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER CONTROL "",IDC_SECONDS_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,92,25,11,12 LTEXT "seconds",IDC_SECONDS_STATIC2,107,26,35,12,SS_CENTERIMAGE CONTROL "Do not close hovered popups",IDC_LEAVEHOVERED,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,41,124,8 - GROUPBOX "Size && Position",IDC_STATIC,3,60,143,83 + GROUPBOX "Size and position",IDC_STATIC,3,60,143,83 CONTROL "Dynamically resize the popups",IDC_DYNAMICRESIZE,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,9,71,133,8 CONTROL "Minimum width",IDC_USEMINIMUMWIDTH,"Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,7,81,88,12,WS_EX_RIGHT EDITTEXT IDC_MINIMUMWIDTH,100,81,40,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER @@ -306,7 +308,7 @@ BEGIN RTEXT "Layout:",IDC_STATIC,7,125,34,12,SS_CENTERIMAGE COMBOBOX IDC_LAYOUT,46,125,94,64,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP GROUPBOX "Miscellaneous",IDC_STATIC,3,147,143,50 - CONTROL "Reorder Popups",IDC_REORDERPOPUPS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,9,158,133,8 + CONTROL "Reorder popups",IDC_REORDERPOPUPS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,9,158,133,8 GROUPBOX "Disable when:",IDC_STATIC,151,3,146,194 CONTROL "Always (has priority)",IDC_POPUPENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,15,135,8 CONTROL "Fullscreen mode",IDC_DISABLEINFS,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,159,26,135,8 @@ -338,6 +340,34 @@ IDB_NOAVATAR BITMAP "avatar.bmp" #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN + IDD_OPT_POPUP_ADVANCED, DIALOG + BEGIN + END + + IDD_OPT_SKIN2, DIALOG + BEGIN + END + + IDD_HISTORY, DIALOG + BEGIN + END + + IDD_POSITION, DIALOG + BEGIN + END + + IDD_OPT_ACTIONS, DIALOG + BEGIN + END + + IDD_OPT_NOTIFICATIONS, DIALOG + BEGIN + END + + IDD_OPT_CONTACTS, DIALOG + BEGIN + END + IDD_OPT_POPUP_GENERAL, DIALOG BEGIN HORZGUIDE, 203 @@ -346,6 +376,7 @@ END #endif // APSTUDIO_INVOKED +#ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE @@ -368,7 +399,9 @@ BEGIN "\0" END -#endif // Нейтральный resources +#endif // APSTUDIO_INVOKED + +#endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index c6ff944088..7ecfa6b41f 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -35,30 +35,30 @@ void LoadActions() { POPUPACTION actions[] = { - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_REPLY,0), "General/Quick reply", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_MESS,0), "General/Send message", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_INFO,0), "General/User details", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_MENU,0), "General/Contact menu", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_ADD,0), "General/Add permanently", 0}, - { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_PIN,0), "General/Pin popup", 0}, - { 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}, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_REPLY, 0), "General/Quick reply", 0}, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_MESS, 0), "General/Send message", 0}, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_INFO, 0), "General/User details", 0}, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_MENU, 0), "General/Contact menu", 0}, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_ADD, 0), "General/Add permanently", 0}, + { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_PIN, 0), "General/Pin popup", 0}, + { 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 #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}, + { 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) + for (int i = 0; i < SIZEOF(actions); ++i) RegisterAction(&actions[i]); } void UnloadActions() { - for (int i=0; i < gActions.getCount(); ++i) + for (int i = 0; i < gActions.getCount(); ++i) delete gActions[i]; gActions.destroy(); } @@ -104,9 +104,9 @@ DWORD MouseOverride(HWND hCombo, int number) { DWORD dwItem = 0; DWORD ItemActive = 0; - if (number<0 || number >7) + if (number < 0 || number > 7) number = 0; - dwItem = SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)TranslateT("no overwrite")); + dwItem = SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)TranslateT("No overwrite")); SendMessage(hCombo, CB_SETITEMDATA, dwItem, 0); if (number == 0) ItemActive = dwItem; @@ -149,9 +149,9 @@ DWORD MouseOverride(HWND hCombo, int number) void LoadOption_Actions() { PopupOptions.actions = db_get_dw(NULL, MODULNAME, "Actions", - ACT_ENABLE|ACT_RIGHTICONS|ACT_DEF_KEEPWND|ACT_DEF_IMONLY| - ACT_DEF_NOGLOBAL|ACT_DEF_MESSAGE|ACT_DEF_DETAILS|ACT_DEF_MENU| - ACT_DEF_ADD|ACT_DEF_DISMISS|ACT_DEF_PIN); + ACT_ENABLE | ACT_RIGHTICONS | ACT_DEF_KEEPWND | ACT_DEF_IMONLY | + ACT_DEF_NOGLOBAL | ACT_DEF_MESSAGE | ACT_DEF_DETAILS | ACT_DEF_MENU | + ACT_DEF_ADD | ACT_DEF_DISMISS | ACT_DEF_PIN); PopupOptions.overrideLeft = db_get_dw(NULL,MODULNAME, "OverrideLeft", 0); PopupOptions.overrideMiddle = db_get_dw(NULL,MODULNAME, "OverrideMiddle", 0); PopupOptions.overrideRight = db_get_dw(NULL,MODULNAME, "OverrideRight", 0); @@ -192,16 +192,16 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM 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; @@ -220,12 +220,12 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM 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); + ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES | LVS_EX_LABELTIP); HIMAGELIST hImgList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 10, 1); ListView_SetImageList(hwndList, hImgList, LVSIL_SMALL); LVCOLUMN column = {0}; - column.mask = LVCF_TEXT|LVCF_WIDTH; + column.mask = LVCF_TEXT | LVCF_WIDTH; column.pszText = TranslateT("Action"); column.cx = 175; ListView_InsertColumn(hwndList, 0, &column); @@ -247,7 +247,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { LVGROUP group = {0}; group.cbSize = sizeof(group); - group.mask = LVGF_HEADER|LVGF_GROUPID; + group.mask = LVGF_HEADER | LVGF_GROUPID; LPWSTR wszGroup = mir_a2u(szGroup); group.pszHeader = TranslateW(wszGroup); group.cchHeader = lstrlenW(wszGroup); @@ -258,9 +258,9 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } LVITEM item = {0}; - item.mask = LVIF_IMAGE|LVIF_PARAM|LVIF_TEXT|LVIF_STATE|LVIF_INDENT; + item.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT | LVIF_STATE | LVIF_INDENT; item.iItem = i; - ptrT tszName( mir_a2t(szName)); + ptrT tszName(mir_a2t(szName)); item.pszText = TranslateTS(tszName); item.iImage = ImageList_AddIcon(hImgList, gActions[i]->lchIcon); item.lParam = i; @@ -272,7 +272,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ListView_SetItemState(hwndList, i, (gActions[i]->flags & PAF_ENABLED) ? 0x2000 : 0x1000, LVIS_STATEIMAGEMASK); } - BOOL enabled = (PopupOptions.actions&ACT_ENABLE) ? TRUE : FALSE; + BOOL enabled = (PopupOptions.actions & ACT_ENABLE) ? TRUE : FALSE; for (i = 0; i < SIZEOF(controls); ++i) EnableWindow(GetDlgItem(hwnd, controls[i]), enabled); } @@ -284,10 +284,10 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM 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); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); { BOOL enabled = (PopupOptions.actions & ACT_ENABLE) ? TRUE : FALSE; - for (i=0; i < SIZEOF(controls); ++i) + for (i = 0; i < SIZEOF(controls); ++i) EnableWindow(GetDlgItem(hwnd, controls[i]), enabled); } break; @@ -295,37 +295,37 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM 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); + 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); + 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); + 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); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_RD_TEXT: - PopupOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS); + 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); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_RD_LEFTICONS: - PopupOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS); + 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); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_RD_RIGHTICONS: - PopupOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_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); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_PREVIEW: PopupPreview(); @@ -334,12 +334,13 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM 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); + 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); + 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); + SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_GETCURSEL, 0, 0), 0); + if (HIWORD(wParam) == CBN_SELCHANGE) + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; @@ -355,9 +356,9 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM db_set_dw(NULL, MODULNAME, "Actions", PopupOptions.actions); HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS); - for (i=0; i < gActions.getCount(); ++i) { + 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); + db_set_b(NULL, "PopupActions", gActions[i]->lpzTitle, (gActions[i]->flags & PAF_ENABLED) ? 1 : 0); } //overrideActions @@ -370,7 +371,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM 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); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } } return FALSE; diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index 2e0727fd4e..8beaa5ef7f 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.cpp @@ -32,30 +32,30 @@ static IconItem iconList[] = // common popup { LPGEN("Popups are enabled"), ICO_POPUP_ON, IDI_POPUP }, { LPGEN("Popups are disabled"), ICO_POPUP_OFF, IDI_NOPOPUP }, - { LPGEN("With \"favorite\" overlay"), ICO_FAV, IDI_PU_FAVOURITE }, + { LPGEN("With \"favorite\" overlay"), ICO_FAV, IDI_PU_FAVOURITE }, { LPGEN("With \"fullscreen\" overlay"), ICO_FULLSCREEN, IDI_PU_FULLSCREEN }, { LPGEN("Popup History"), ICO_HISTORY, IDI_HISTORY }, // option { LPGEN("Refresh skin list"), ICO_OPT_RELOAD, IDI_RELOAD }, - { LPGEN("Popup Placement"), ICO_OPT_RESIZE, IDI_RESIZE }, + { LPGEN("Popup placement"), ICO_OPT_RESIZE, IDI_RESIZE }, { LPGEN("OK"), ICO_OPT_OK, IDI_ACT_OK }, { LPGEN("Cancel"), ICO_OPT_CANCEL, IDI_ACT_CLOSE }, - { LPGEN("Popup Group"), ICO_OPT_GROUP, IDI_OPT_GROUP }, + { LPGEN("Popup group"), ICO_OPT_GROUP, IDI_OPT_GROUP }, { LPGEN("Show default"), ICO_OPT_DEF, IDI_ACT_OK }, - { LPGEN("Favorite Contact"), ICO_OPT_FAV, IDI_OPT_FAVORITE }, - { LPGEN("Show in Fullscreen"), ICO_OPT_FULLSCREEN, IDI_OPT_FULLSCREEN }, - { LPGEN("Blocked Contact"), ICO_OPT_BLOCK, IDI_OPT_BLOCK }, + { LPGEN("Favorite contact"), ICO_OPT_FAV, IDI_OPT_FAVORITE }, + { LPGEN("Show in fullscreen"), ICO_OPT_FULLSCREEN, IDI_OPT_FULLSCREEN }, + { LPGEN("Blocked contact"), ICO_OPT_BLOCK, IDI_OPT_BLOCK }, // action - { LPGEN("Quick Reply"), ICO_ACT_REPLY, IDI_ACT_REPLY }, - { LPGEN("Pin Popup"), ICO_ACT_PIN, IDI_ACT_PIN }, - { LPGEN("Pinned Popup"), ICO_ACT_PINNED, IDI_ACT_PINNED }, - { LPGEN("Send Message"), ICO_ACT_MESS, IDI_ACT_MESSAGE }, + { LPGEN("Quick reply"), ICO_ACT_REPLY, IDI_ACT_REPLY }, + { LPGEN("Pin popup"), ICO_ACT_PIN, IDI_ACT_PIN }, + { LPGEN("Pinned popup"), ICO_ACT_PINNED, IDI_ACT_PINNED }, + { LPGEN("Send message"), ICO_ACT_MESS, IDI_ACT_MESSAGE }, { LPGEN("User details"), ICO_ACT_INFO, IDI_ACT_INFO }, - { LPGEN("Contact Menu"), ICO_ACT_MENU, IDI_ACT_MENU }, - { LPGEN("Add Contact Permanently"), ICO_ACT_ADD, IDI_ACT_ADD }, - { LPGEN("Dismiss Popup"), ICO_ACT_CLOSE, IDI_ACT_CLOSE }, + { LPGEN("Contact menu"), ICO_ACT_MENU, IDI_ACT_MENU }, + { LPGEN("Add contact permanently"), ICO_ACT_ADD, IDI_ACT_ADD }, + { LPGEN("Dismiss popup"), ICO_ACT_CLOSE, IDI_ACT_CLOSE }, { LPGEN("Copy to clipboard"), ICO_ACT_COPY, IDI_ACT_COPY } }; @@ -75,7 +75,7 @@ HICON IcoLib_GetIcon(LPCSTR pszIcon, bool big) void InitIcons() { Icon_Register(hInst, SECT_TOLBAR, iconList, 2); - Icon_Register(hInst, SECT_POPUP, iconList+2, 5); - Icon_Register(hInst, SECT_POPUP SECT_POPUP_OPT, iconList+7, 9); - Icon_Register(hInst, SECT_POPUP SECT_POPUP_ACT, iconList+16, 9); + Icon_Register(hInst, SECT_POPUP, iconList + 2, 5); + Icon_Register(hInst, SECT_POPUP SECT_POPUP_OPT, iconList + 7, 9); + Icon_Register(hInst, SECT_POPUP SECT_POPUP_ACT, iconList + 16, 9); } diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 47afc3933f..3f0834d28e 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -104,16 +104,19 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM //Group: History { CheckDlgButton(hwnd, IDC_ENABLE_HISTORY, PopupOptions.EnableHistory); - SetDlgItemInt (hwnd, IDC_HISTORYSIZE, PopupOptions.HistorySize, FALSE); + SetDlgItemInt(hwnd, IDC_HISTORYSIZE, PopupOptions.HistorySize, FALSE); + SendDlgItemMessage(hwnd, IDC_HISTORYSIZE_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwnd, IDC_HISTORYSIZE), 0); + SendDlgItemMessage(hwnd, IDC_HISTORYSIZE_SPIN, UDM_SETRANGE, 0, MAKELONG(SETTING_HISTORYSIZE_MAX, 1)); CheckDlgButton(hwnd, IDC_HPPLOG, PopupOptions.UseHppHistoryLog); HWND hCtrl = GetDlgItem(hwnd, IDC_SHOWHISTORY); SendMessage(hCtrl, BUTTONSETASFLATBTN, TRUE, 0); SendMessage(hCtrl, BUTTONADDTOOLTIP, (WPARAM)Translate("Popup History"), 0); - SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,0)); + SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_HISTORY, 0)); EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC1), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HISTORYSIZE), PopupOptions.EnableHistory); + EnableWindow(GetDlgItem(hwnd, IDC_HISTORYSIZE_SPIN),PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC2), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_SHOWHISTORY), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HPPLOG), PopupOptions.EnableHistory && gbHppInstalled); @@ -126,13 +129,13 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hwnd, IDC_AVT_PNGBORDER), PopupOptions.avatarBorders); //Radius SetDlgItemInt(hwnd, IDC_AVT_RADIUS, PopupOptions.avatarRadius, FALSE); - SendDlgItemMessage(hwnd, IDC_AVT_RADIUS_SPIN,UDM_SETRANGE, 0, (LPARAM)MAKELONG((PopupOptions.avatarSize / 2),0)); + SendDlgItemMessage(hwnd, IDC_AVT_RADIUS_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG((PopupOptions.avatarSize / 2), 0)); //Size mir_subclassWindow(GetDlgItem(hwnd, IDC_AVT_SIZE_SLIDE), AvatarTrackBarWndProc); - SendDlgItemMessage(hwnd, IDC_AVT_SIZE_SLIDE, TBM_SETRANGE,FALSE, + SendDlgItemMessage(hwnd, IDC_AVT_SIZE_SLIDE, TBM_SETRANGE, FALSE, MAKELONG(SETTING_AVTSIZE_MIN, SETTING_AVTSIZE_MAX)); - SendDlgItemMessage(hwnd, IDC_AVT_SIZE_SLIDE, TBM_SETPOS, TRUE, + SendDlgItemMessage(hwnd, IDC_AVT_SIZE_SLIDE, TBM_SETPOS, TRUE, max(PopupOptions.avatarSize, SETTING_AVTSIZE_MIN)); SetDlgItemInt(hwnd, IDC_AVT_SIZE, PopupOptions.avatarSize, FALSE); //Request avatars @@ -142,7 +145,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { BOOL bMonitor = 0; - bMonitor = GetSystemMetrics(SM_CMONITORS)>1; + bMonitor = GetSystemMetrics(SM_CMONITORS) > 1; CheckDlgButton(hwnd, IDC_MIRANDAWND, bMonitor ? (PopupOptions.Monitor == MN_MIRANDA) : TRUE); CheckDlgButton(hwnd, IDC_ACTIVEWND, bMonitor ? (PopupOptions.Monitor == MN_ACTIVE) : FALSE); @@ -155,9 +158,9 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { //win2k+ CheckDlgButton(hwnd, IDC_TRANS, PopupOptions.UseTransparency); - SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(1,255)); + SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETRANGE, FALSE, MAKELONG(1, 255)); SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_SETPOS, TRUE, PopupOptions.Alpha); - mir_subclassWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER), AlphaTrackBarWndProc); + mir_subclassWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER), AlphaTrackBarWndProc); mir_sntprintf(tstr, SIZEOF(tstr), _T("%d%%"), Byte2Percentile(PopupOptions.Alpha)); SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr); CheckDlgButton(hwnd, IDC_TRANS_OPAQUEONHOVER, PopupOptions.OpaqueOnHover); @@ -177,13 +180,13 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM //Use Animations CheckDlgButton(hwnd, IDC_USEANIMATIONS, PopupOptions.UseAnimations); //Fade - SetDlgItemInt (hwnd, IDC_FADEIN, PopupOptions.FadeIn, FALSE); - SetDlgItemInt (hwnd, IDC_FADEOUT,PopupOptions.FadeOut,FALSE); + SetDlgItemInt(hwnd, IDC_FADEIN, PopupOptions.FadeIn, FALSE); + SetDlgItemInt(hwnd, IDC_FADEOUT, PopupOptions.FadeOut, FALSE); UDACCEL aAccels[] = {{0,50},{1,100},{3,500}}; SendDlgItemMessage(hwnd, IDC_FADEIN_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_FADEINTIME_MAX, SETTING_FADEINTIME_MIN)); SendDlgItemMessage(hwnd, IDC_FADEIN_SPIN, UDM_SETACCEL, (WPARAM)SIZEOF(aAccels), (LPARAM)&aAccels); - SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN,UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_FADEOUTTIME_MAX,SETTING_FADEOUTTIME_MIN)); - SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN,UDM_SETACCEL, (WPARAM)SIZEOF(aAccels), (LPARAM)&aAccels); + SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_FADEOUTTIME_MAX, SETTING_FADEOUTTIME_MIN)); + SendDlgItemMessage(hwnd, IDC_FADEOUT_SPIN, UDM_SETACCEL, (WPARAM)SIZEOF(aAccels), (LPARAM)&aAccels); BOOL how = PopupOptions.UseAnimations || PopupOptions.UseEffect; EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT1), how); @@ -204,10 +207,10 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem(hwnd, IDC_EFFECT_TXT), how); HWND hCtrl = GetDlgItem(hwnd, IDC_EFFECT); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("No effect")) ,-2); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Fade in/out")) ,-1); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("No effect")), -2); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Fade in/out")), -1); dwActiveItem = (DWORD)PopupOptions.UseEffect; - for (int i=0; i < g_lstPopupVfx.getCount(); ++i) { + for (int i = 0; i < g_lstPopupVfx.getCount(); ++i) { dwItem = ComboBox_AddString(hCtrl, TranslateTS(g_lstPopupVfx[i])); ComboBox_SetItemData(hCtrl, dwItem, i); if (PopupOptions.UseEffect && !lstrcmp(g_lstPopupVfx[i], PopupOptions.Effect)) @@ -219,6 +222,8 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM //later check stuff SetDlgItemInt(hwnd, IDC_MAXPOPUPS, PopupOptions.MaxPopups, FALSE); + SendDlgItemMessage(hwnd, IDC_MAXPOPUPS_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwnd, IDC_MAXPOPUPS), 0); + SendDlgItemMessage(hwnd, IDC_MAXPOPUPS_SPIN, UDM_SETRANGE, 0, MAKELONG(999, 1)); TranslateDialogDefault(hwnd); //do it on end of WM_INITDIALOG bDlgInit = true; return TRUE; @@ -226,14 +231,14 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_HSCROLL: switch (idCtrl = GetDlgCtrlID((HWND)lParam)) { case IDC_AVT_SIZE_SLIDE: - PopupOptions.avatarSize = SendDlgItemMessage(hwnd,IDC_AVT_SIZE_SLIDE, TBM_GETPOS,0,0); - SetDlgItemInt(hwnd, IDC_AVT_SIZE ,PopupOptions.avatarSize,FALSE); - SendDlgItemMessage(hwnd, IDC_AVT_RADIUS_SPIN,UDM_SETRANGE, 0, (LPARAM)MAKELONG((PopupOptions.avatarSize / 2),0)); + PopupOptions.avatarSize = SendDlgItemMessage(hwnd, IDC_AVT_SIZE_SLIDE, TBM_GETPOS, 0, 0); + SetDlgItemInt(hwnd, IDC_AVT_SIZE, PopupOptions.avatarSize, FALSE); + SendDlgItemMessage(hwnd, IDC_AVT_RADIUS_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG((PopupOptions.avatarSize / 2), 0)); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_TRANS_SLIDER: - PopupOptions.Alpha = (BYTE)SendDlgItemMessage(hwnd,IDC_TRANS_SLIDER, TBM_GETPOS, 0,0); + PopupOptions.Alpha = (BYTE)SendDlgItemMessage(hwnd, IDC_TRANS_SLIDER, TBM_GETPOS, 0, 0); mir_sntprintf(tstr, SIZEOF(tstr), TranslateT("%d%%"), Byte2Percentile(PopupOptions.Alpha)); SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); @@ -245,15 +250,16 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM idCtrl = LOWORD(wParam); switch (HIWORD(wParam)) { case BN_CLICKED: //Button controls - switch(idCtrl) { + switch (idCtrl) { case IDC_ENABLE_HISTORY: PopupOptions.EnableHistory = !PopupOptions.EnableHistory; EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC1), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HISTORYSIZE), PopupOptions.EnableHistory); + EnableWindow(GetDlgItem(hwnd, IDC_HISTORYSIZE_SPIN),PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC2), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_SHOWHISTORY), PopupOptions.EnableHistory); EnableWindow(GetDlgItem(hwnd, IDC_HPPLOG), PopupOptions.EnableHistory && gbHppInstalled); - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_SHOWHISTORY: @@ -262,43 +268,43 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_HPPLOG: PopupOptions.UseHppHistoryLog = !PopupOptions.UseHppHistoryLog; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_AVT_BORDER: PopupOptions.avatarBorders = !PopupOptions.avatarBorders; EnableWindow(GetDlgItem(hwnd, IDC_AVT_PNGBORDER), PopupOptions.avatarBorders); - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_AVT_PNGBORDER: PopupOptions.avatarPNGBorders = !PopupOptions.avatarPNGBorders; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_AVT_REQUEST: PopupOptions.EnableAvatarUpdates = !PopupOptions.EnableAvatarUpdates; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_MIRANDAWND: PopupOptions.Monitor = MN_MIRANDA; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_ACTIVEWND: PopupOptions.Monitor = MN_ACTIVE; - SendMessage(GetParent(hwnd), PSM_CHANGED,0,0); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_TRANS: PopupOptions.UseTransparency = !PopupOptions.UseTransparency; { BOOL how = TRUE; - EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1) ,how && PopupOptions.UseTransparency); - EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER) ,how && PopupOptions.UseTransparency); - EnableWindow(GetDlgItem(hwnd, IDC_TRANS_PERCENT) ,how && PopupOptions.UseTransparency); - EnableWindow(GetDlgItem(hwnd, IDC_TRANS_OPAQUEONHOVER) ,how && PopupOptions.UseTransparency); + EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1), how && PopupOptions.UseTransparency); + EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER), how && PopupOptions.UseTransparency); + EnableWindow(GetDlgItem(hwnd, IDC_TRANS_PERCENT), how && PopupOptions.UseTransparency); + EnableWindow(GetDlgItem(hwnd, IDC_TRANS_OPAQUEONHOVER), how && PopupOptions.UseTransparency); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; @@ -332,7 +338,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case CBN_SELCHANGE: //lParam = Handle to the control - switch(idCtrl) { + switch (idCtrl) { case IDC_EFFECT: { int iEffect = ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); @@ -358,11 +364,11 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case EN_CHANGE: //Edit controls change if (!bDlgInit) break; //lParam = Handle to the control - switch(idCtrl) { + switch (idCtrl) { case IDC_MAXPOPUPS: { int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); - if (maxPop > 0){ + if (maxPop > 0) { PopupOptions.MaxPopups = maxPop; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } @@ -371,8 +377,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_HISTORYSIZE: { int histSize = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); - if ( histSize > 0 && - histSize <= SETTING_HISTORYSIZE_MAX){ + if (histSize > 0 && histSize <= SETTING_HISTORYSIZE_MAX) { PopupOptions.HistorySize = histSize; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } @@ -381,7 +386,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_AVT_RADIUS: { int avtRadius = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); - if ( avtRadius <= SETTING_AVTSIZE_MAX / 2 ) { + if (avtRadius <= SETTING_AVTSIZE_MAX / 2 ) { PopupOptions.avatarRadius = avtRadius; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } @@ -390,8 +395,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_FADEIN: { int fadeIn = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); - if ( fadeIn >= SETTING_FADEINTIME_MIN && - fadeIn <= SETTING_FADEINTIME_MAX ) { + if (fadeIn >= SETTING_FADEINTIME_MIN && fadeIn <= SETTING_FADEINTIME_MAX ) { PopupOptions.FadeIn = fadeIn; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } @@ -399,9 +403,8 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_FADEOUT: { - int fadeOut = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); - if ( fadeOut >= SETTING_FADEOUTTIME_MIN && - fadeOut <= SETTING_FADEOUTTIME_MAX){ + int fadeOut = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); + if (fadeOut >= SETTING_FADEOUTTIME_MIN && fadeOut <= SETTING_FADEOUTTIME_MAX) { PopupOptions.FadeOut = fadeOut; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } @@ -412,7 +415,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case EN_KILLFOCUS: //Edit controls lost fokus //lParam = Handle to the control - switch(idCtrl) { + switch (idCtrl) { case IDC_MAXPOPUPS: { int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); @@ -456,7 +459,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM int fade = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE); if (fade < SETTING_FADEINTIME_MIN) PopupOptions.FadeIn = SETTING_FADEINTIME_MIN; - else if (fade > SETTING_FADEINTIME_MAX) + else if (fade > SETTING_FADEINTIME_MAX) PopupOptions.FadeIn = SETTING_FADEINTIME_MAX; if (fade != PopupOptions.FadeIn) { SetDlgItemInt(hwnd, idCtrl, PopupOptions.FadeIn, FALSE); @@ -483,7 +486,7 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) { + switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_RESET: @@ -558,8 +561,8 @@ LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA RECT rc; GetWindowRect(hwnd, &rc); SetWindowPos(hwndBox, NULL, - (rc.left+rc.right-newVal)/2, rc.bottom+2, newVal, newVal, - SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW); + (rc.left + rc.right - newVal) / 2, rc.bottom + 2, newVal, newVal, + SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); HRGN rgn = CreateRoundRectRgn(0, 0, newVal, newVal, 2 * PopupOptions.avatarRadius, 2 * PopupOptions.avatarRadius); SetWindowRgn(hwndBox, rgn, TRUE); @@ -609,8 +612,8 @@ LRESULT CALLBACK AlphaTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SetWindowLongPtr(hwndBox, GWLP_USERDATA, 1); RECT rc; GetWindowRect(hwnd, &rc); SetWindowPos(hwndBox, NULL, - (rc.left+rc.right-170)/2, rc.bottom+2, 170, 50, - SWP_NOACTIVATE|SWP_DEFERERASE|SWP_NOSENDCHANGING|SWP_SHOWWINDOW); + (rc.left + rc.right - 170) / 2, rc.bottom + 2, 170, 50, + SWP_NOACTIVATE | SWP_DEFERERASE | SWP_NOSENDCHANGING | SWP_SHOWWINDOW); SetWindowRgn(hwndBox, NULL, TRUE); } SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED); diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 90103fb7b8..b5e471b5bf 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -42,12 +42,12 @@ static int CountStatusModes(DWORD flags) return res; } -int AddStatusMode (OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flag) +int AddStatusMode(OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flag) { if (!flag) return pos; options[pos].dwFlag = flag; options[pos].groupId = OPTTREE_CHECK; - options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(TCHAR)*lstrlen(prefix)+32); + options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(TCHAR) * lstrlen(prefix) + 32); options[pos].pszSettingName = mir_tstrdup(prefix); options[pos].iconIndex = 0; @@ -55,32 +55,32 @@ int AddStatusMode (OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flag) lstrcat(options[pos].pszOptionName, _T("/")); switch (flag) { - case PF2_IDLE: lstrcat(options[pos].pszOptionName, LPGENT("Offline")); break; - case PF2_ONLINE: lstrcat(options[pos].pszOptionName, LPGENT("Online")); break; - case PF2_INVISIBLE: lstrcat(options[pos].pszOptionName, LPGENT("Invisible")); break; - case PF2_SHORTAWAY: lstrcat(options[pos].pszOptionName, LPGENT("Away")); break; - case PF2_LONGAWAY: lstrcat(options[pos].pszOptionName, LPGENT("NA")); break; - case PF2_LIGHTDND: lstrcat(options[pos].pszOptionName, LPGENT("Occupied")); break; - case PF2_HEAVYDND: lstrcat(options[pos].pszOptionName, LPGENT("DND")); break; - case PF2_FREECHAT: lstrcat(options[pos].pszOptionName, LPGENT("Free for chat")); break; - case PF2_OUTTOLUNCH:lstrcat(options[pos].pszOptionName, LPGENT("Out to lunch")); break; - case PF2_ONTHEPHONE:lstrcat(options[pos].pszOptionName, LPGENT("On the phone")); break; + case PF2_IDLE: lstrcat(options[pos].pszOptionName, LPGENT("Offline")); break; + case PF2_ONLINE: lstrcat(options[pos].pszOptionName, LPGENT("Online")); break; + case PF2_INVISIBLE: lstrcat(options[pos].pszOptionName, LPGENT("Invisible")); break; + case PF2_SHORTAWAY: lstrcat(options[pos].pszOptionName, LPGENT("Away")); break; + case PF2_LONGAWAY: lstrcat(options[pos].pszOptionName, LPGENT("NA")); break; + case PF2_LIGHTDND: lstrcat(options[pos].pszOptionName, LPGENT("Occupied")); break; + case PF2_HEAVYDND: lstrcat(options[pos].pszOptionName, LPGENT("DND")); break; + case PF2_FREECHAT: lstrcat(options[pos].pszOptionName, LPGENT("Free for chat")); break; + case PF2_OUTTOLUNCH: lstrcat(options[pos].pszOptionName, LPGENT("Out to lunch")); break; + case PF2_ONTHEPHONE: lstrcat(options[pos].pszOptionName, LPGENT("On the phone")); break; } - return pos+1; + return pos + 1; } int AddStatusModes(OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flags) { pos = AddStatusMode(options, pos, prefix, PF2_IDLE); - pos = AddStatusMode(options, pos, prefix, flags&PF2_ONLINE); - pos = AddStatusMode(options, pos, prefix, flags&PF2_INVISIBLE); - pos = AddStatusMode(options, pos, prefix, flags&PF2_SHORTAWAY); - pos = AddStatusMode(options, pos, prefix, flags&PF2_LONGAWAY); - pos = AddStatusMode(options, pos, prefix, flags&PF2_LIGHTDND); - pos = AddStatusMode(options, pos, prefix, flags&PF2_HEAVYDND); - pos = AddStatusMode(options, pos, prefix, flags&PF2_FREECHAT); - pos = AddStatusMode(options, pos, prefix, flags&PF2_OUTTOLUNCH); - pos = AddStatusMode(options, pos, prefix, flags&PF2_ONTHEPHONE); + pos = AddStatusMode(options, pos, prefix, flags & PF2_ONLINE); + pos = AddStatusMode(options, pos, prefix, flags & PF2_INVISIBLE); + pos = AddStatusMode(options, pos, prefix, flags & PF2_SHORTAWAY); + pos = AddStatusMode(options, pos, prefix, flags & PF2_LONGAWAY); + pos = AddStatusMode(options, pos, prefix, flags & PF2_LIGHTDND); + pos = AddStatusMode(options, pos, prefix, flags & PF2_HEAVYDND); + pos = AddStatusMode(options, pos, prefix, flags & PF2_FREECHAT); + pos = AddStatusMode(options, pos, prefix, flags & PF2_OUTTOLUNCH); + pos = AddStatusMode(options, pos, prefix, flags & PF2_ONTHEPHONE); return pos; } @@ -102,8 +102,8 @@ void LoadOption_General() PopupOptions.MaximumWidth = db_get_w(NULL, MODULNAME, "MaximumWidth", 300); //Position - PopupOptions.Position - = DBGetContactSettingRangedByte(NULL, MODULNAME, "Position", POS_LOWERRIGHT, POS_MINVALUE, POS_MAXVALUE); + PopupOptions.Position = + DBGetContactSettingRangedByte(NULL, MODULNAME, "Position", POS_LOWERRIGHT, POS_MINVALUE, POS_MAXVALUE); //Configure popup area PopupOptions.gapTop = db_get_w(NULL, MODULNAME, "gapTop", 5); @@ -113,8 +113,8 @@ void LoadOption_General() PopupOptions.spacing = db_get_w(NULL, MODULNAME, "spacing", 5); //Spreading - PopupOptions.Spreading - = DBGetContactSettingRangedByte(NULL, MODULNAME, "Spreading", SPREADING_VERTICAL, SPREADING_MINVALUE, SPREADING_MAXVALUE); + PopupOptions.Spreading = + DBGetContactSettingRangedByte(NULL, MODULNAME, "Spreading", SPREADING_VERTICAL, SPREADING_MINVALUE, SPREADING_MAXVALUE); //miscellaneous PopupOptions.ReorderPopups = db_get_b(NULL, MODULNAME, "ReorderPopups", TRUE); @@ -151,58 +151,54 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM //Dynamic Resize CheckDlgButton(hwnd, IDC_DYNAMICRESIZE, PopupOptions.DynamicResize); - SetDlgItemText(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.DynamicResize ? LPGENT("Maximum width"): LPGENT("Width")); + SetDlgItemText(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.DynamicResize ? LPGENT("Maximum width") : LPGENT("Width")); //Minimum Width CheckDlgButton(hwnd, IDC_USEMINIMUMWIDTH, PopupOptions.UseMinimumWidth); - SendDlgItemMessage(hwnd, IDC_MINIMUMWIDTH_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG( - SETTING_MAXIMUMWIDTH_MAX, - SETTING_MINIMUMWIDTH_MIN)); + SendDlgItemMessage(hwnd, IDC_MINIMUMWIDTH_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_MAXIMUMWIDTH_MAX, SETTING_MINIMUMWIDTH_MIN)); SetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, PopupOptions.MinimumWidth, FALSE); //Maximum Width PopupOptions.UseMaximumWidth = PopupOptions.DynamicResize ? PopupOptions.UseMaximumWidth : TRUE; CheckDlgButton(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.UseMaximumWidth); - SendDlgItemMessage(hwnd, IDC_MAXIMUMWIDTH_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG( - SETTING_MAXIMUMWIDTH_MAX, - SETTING_MINIMUMWIDTH_MIN)); + SendDlgItemMessage(hwnd, IDC_MAXIMUMWIDTH_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(SETTING_MAXIMUMWIDTH_MAX, SETTING_MINIMUMWIDTH_MIN)); SetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, PopupOptions.MaximumWidth, FALSE); //And finally let's enable/disable them. - EnableWindow(GetDlgItem(hwnd, IDC_USEMINIMUMWIDTH), PopupOptions.DynamicResize); - EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); - EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); - EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), PopupOptions.UseMaximumWidth); - EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), PopupOptions.UseMaximumWidth); + EnableWindow(GetDlgItem(hwnd, IDC_USEMINIMUMWIDTH), PopupOptions.DynamicResize); + EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); + EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); + EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), PopupOptions.UseMaximumWidth); + EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), PopupOptions.UseMaximumWidth); //Position combobox. { HWND hCtrl = GetDlgItem(hwnd, IDC_WHERE); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("upper left corner")) ,POS_UPPERLEFT); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("lower left corner")) ,POS_LOWERLEFT); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("lower right corner")) ,POS_LOWERRIGHT); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("upper right corner")) ,POS_UPPERRIGHT); - SendDlgItemMessage(hwnd, IDC_WHERE, CB_SETCURSEL, (PopupOptions.Position) , 0); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upper left corner")), POS_UPPERLEFT); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Lower left corner")), POS_LOWERLEFT); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Lower right corner")), POS_LOWERRIGHT); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Upper right corner")), POS_UPPERRIGHT); + SendDlgItemMessage(hwnd, IDC_WHERE, CB_SETCURSEL, PopupOptions.Position, 0); } //Configure popup area { HWND hCtrl = GetDlgItem(hwnd, IDC_CUSTOMPOS); SendMessage(hCtrl, BUTTONSETASFLATBTN, TRUE, 0); - SendMessage(hCtrl, BUTTONADDTOOLTIP, (WPARAM)_T("Popup Area"), BATF_TCHAR); - SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_RESIZE,0)); + SendMessage(hCtrl, BUTTONADDTOOLTIP, (WPARAM)_T("Popup area"), BATF_TCHAR); + SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_RESIZE, 0)); } //Spreading combobox { HWND hCtrl = GetDlgItem(hwnd, IDC_LAYOUT); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("horizontal")) ,SPREADING_HORIZONTAL); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("vertical")) ,SPREADING_VERTICAL); - SendDlgItemMessage(hwnd, IDC_LAYOUT, CB_SETCURSEL, (PopupOptions.Spreading), 0); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Horizontal")), SPREADING_HORIZONTAL); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Vertical")), SPREADING_VERTICAL); + SendDlgItemMessage(hwnd, IDC_LAYOUT, CB_SETCURSEL, PopupOptions.Spreading, 0); } //miscellaneous CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopupOptions.ReorderPopups); //Popup enabled - CheckDlgButton(hwnd, IDC_POPUPENABLED, PopupOptions.ModuleIsEnabled?BST_UNCHECKED:BST_CHECKED); - CheckDlgButton(hwnd, IDC_DISABLEINFS, PopupOptions.DisableWhenFullscreen); - EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled); - EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled); + CheckDlgButton(hwnd, IDC_POPUPENABLED, PopupOptions.ModuleIsEnabled ? BST_UNCHECKED : BST_CHECKED); + CheckDlgButton(hwnd, IDC_DISABLEINFS, PopupOptions.DisableWhenFullscreen); + EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled); + EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled); //new status options { @@ -226,7 +222,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM continue; TCHAR prefix[128]; - mir_sntprintf(prefix,SIZEOF(prefix), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName); + mir_sntprintf(prefix, SIZEOF(prefix), LPGENT("Protocol Status")_T("/%s"), protocols[i]->tszAccountName); pos = AddStatusModes(statusOptions, pos, prefix, protoFlags); } @@ -254,14 +250,14 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND: switch (HIWORD(wParam)) { - case BN_CLICKED: //Button controls - switch( LOWORD(wParam)) { + case BN_CLICKED: //Button controls + switch (LOWORD(wParam)) { case IDC_INFINITEDELAY: PopupOptions.InfiniteDelay = !PopupOptions.InfiniteDelay; - EnableWindow(GetDlgItem(hwnd, IDC_SECONDS),!PopupOptions.InfiniteDelay); - EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC1), !PopupOptions.InfiniteDelay); - EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC2), !PopupOptions.InfiniteDelay); - EnableWindow(GetDlgItem(hwnd, IDC_LEAVEHOVERED), !PopupOptions.InfiniteDelay); + EnableWindow(GetDlgItem(hwnd, IDC_SECONDS), !PopupOptions.InfiniteDelay); + EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC1), !PopupOptions.InfiniteDelay); + EnableWindow(GetDlgItem(hwnd, IDC_SECONDS_STATIC2), !PopupOptions.InfiniteDelay); + EnableWindow(GetDlgItem(hwnd, IDC_LEAVEHOVERED), !PopupOptions.InfiniteDelay); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; @@ -271,36 +267,36 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case IDC_DYNAMICRESIZE: - PopupOptions.DynamicResize=!PopupOptions.DynamicResize; - EnableWindow(GetDlgItem(hwnd, IDC_USEMINIMUMWIDTH), PopupOptions.DynamicResize); - EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); - EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); - SetDlgItemText(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.DynamicResize ? TranslateT("Maximum width"): TranslateT("Width")); + PopupOptions.DynamicResize = !PopupOptions.DynamicResize; + EnableWindow(GetDlgItem(hwnd, IDC_USEMINIMUMWIDTH), PopupOptions.DynamicResize); + EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); + EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.DynamicResize && PopupOptions.UseMinimumWidth); + SetDlgItemText(hwnd, IDC_USEMAXIMUMWIDTH, PopupOptions.DynamicResize ? TranslateT("Maximum width") : TranslateT("Width")); if (!PopupOptions.DynamicResize) { PopupOptions.UseMaximumWidth = TRUE; CheckDlgButton(hwnd, IDC_USEMAXIMUMWIDTH, BST_CHECKED); - EnableWindow(GetDlgItem(hwnd, IDC_USEMAXIMUMWIDTH), TRUE); - EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), TRUE); - EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), TRUE); + EnableWindow(GetDlgItem(hwnd, IDC_USEMAXIMUMWIDTH), TRUE); + EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), TRUE); + EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), TRUE); } SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_USEMINIMUMWIDTH: - PopupOptions.UseMinimumWidth= !PopupOptions.UseMinimumWidth; - EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.UseMinimumWidth); - EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.UseMinimumWidth); + PopupOptions.UseMinimumWidth = !PopupOptions.UseMinimumWidth; + EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH), PopupOptions.UseMinimumWidth); + EnableWindow(GetDlgItem(hwnd, IDC_MINIMUMWIDTH_SPIN), PopupOptions.UseMinimumWidth); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; case IDC_USEMAXIMUMWIDTH: - PopupOptions.UseMaximumWidth= Button_GetCheck((HWND)lParam); + PopupOptions.UseMaximumWidth = Button_GetCheck((HWND)lParam); if (!PopupOptions.DynamicResize) { //ugly - set always on if DynamicResize = off CheckDlgButton(hwnd, LOWORD(wParam), BST_CHECKED); PopupOptions.UseMaximumWidth = TRUE; } EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH), PopupOptions.UseMaximumWidth); - EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), PopupOptions.UseMaximumWidth); + EnableWindow(GetDlgItem(hwnd, IDC_MAXIMUMWIDTH_SPIN), PopupOptions.UseMaximumWidth); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; @@ -311,21 +307,21 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM GetWindowRect((HWND)lParam, &rcButton); GetWindowRect(hwndBox, &rcBox); MoveWindow(hwndBox, - rcButton.right-(rcBox.right-rcBox.left) + 15, + rcButton.right - (rcBox.right - rcBox.left) + 15, rcButton.bottom + 3, - rcBox.right-rcBox.left, - rcBox.bottom-rcBox.top, + rcBox.right - rcBox.left, + rcBox.bottom - rcBox.top, FALSE); - SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE)|WS_EX_LAYERED); + SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes(hwndBox, NULL, 0, LWA_ALPHA); ShowWindow(hwndBox, SW_SHOW); - for (int i=0; i <= 255; i += 15) { + for (int i = 0; i <= 255; i += 15) { SetLayeredWindowAttributes(hwndBox, NULL, i, LWA_ALPHA); UpdateWindow(hwndBox); Sleep(1); } - SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE)&~WS_EX_LAYERED); + SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) & ~WS_EX_LAYERED); ShowWindow(hwndBox, SW_SHOW); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); @@ -335,8 +331,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_REORDERPOPUPS: { PopupOptions.ReorderPopups = !PopupOptions.ReorderPopups; - PopupOptions.ReorderPopupsWarning = PopupOptions.ReorderPopups ? - db_get_b(NULL, MODULNAME, "ReorderPopupsWarning", TRUE) : TRUE; + PopupOptions.ReorderPopupsWarning = PopupOptions.ReorderPopups ? db_get_b(NULL, MODULNAME, "ReorderPopupsWarning", TRUE) : TRUE; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; @@ -344,10 +339,10 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_POPUPENABLED: { int chk = IsDlgButtonChecked(hwnd, IDC_POPUPENABLED); - if (PopupOptions.ModuleIsEnabled&&chk || !PopupOptions.ModuleIsEnabled&&!chk) - svcEnableDisableMenuCommand(0,0); - EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled); - EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled); + if (PopupOptions.ModuleIsEnabled&&chk || !PopupOptions.ModuleIsEnabled && !chk) + svcEnableDisableMenuCommand(0, 0); + EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled); + EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled); } break; @@ -363,7 +358,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case CBN_SELCHANGE: //ComboBox controls - switch( LOWORD(wParam)) { + switch (LOWORD(wParam)) { //lParam = Handle to the control case IDC_WHERE: PopupOptions.Position = ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)); @@ -378,12 +373,12 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case EN_CHANGE: //Edit controls change if (!bDlgInit) break; - switch( LOWORD(wParam)) { + switch (LOWORD(wParam)) { //lParam = Handle to the control case IDC_SECONDS: { int seconds = GetDlgItemInt(hwnd, LOWORD(wParam), NULL, FALSE); - if ( seconds >= SETTING_LIFETIME_MIN && + if (seconds >= SETTING_LIFETIME_MIN && seconds <= SETTING_LIFETIME_MAX && seconds != PopupOptions.Seconds) { PopupOptions.Seconds = seconds; @@ -394,7 +389,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_MINIMUMWIDTH: { int temp = GetDlgItemInt(hwnd, IDC_MINIMUMWIDTH, NULL, FALSE); - if ( temp >= SETTING_MINIMUMWIDTH_MIN && + if (temp >= SETTING_MINIMUMWIDTH_MIN && temp <= SETTING_MAXIMUMWIDTH_MAX && temp != PopupOptions.MinimumWidth) { PopupOptions.MinimumWidth = temp; @@ -405,7 +400,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_MAXIMUMWIDTH: { int temp = GetDlgItemInt(hwnd, IDC_MAXIMUMWIDTH, NULL, FALSE); - if ( temp >= SETTING_MINIMUMWIDTH_MIN && + if (temp >= SETTING_MINIMUMWIDTH_MIN && temp <= SETTING_MAXIMUMWIDTH_MAX && temp != PopupOptions.MaximumWidth) { PopupOptions.MaximumWidth = temp; @@ -417,7 +412,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case EN_KILLFOCUS: //Edit controls lost fokus - switch( LOWORD(wParam)) { + switch (LOWORD(wParam)) { //lParam = Handle to the control case IDC_SECONDS: { @@ -477,7 +472,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) { + switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_RESET: @@ -501,11 +496,11 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM db_set_b(NULL, MODULNAME, "Position", (BYTE)PopupOptions.Position); //Configure popup area - db_set_w(NULL, MODULNAME, "gapTop", (WORD)PopupOptions.gapTop); - db_set_w(NULL, MODULNAME, "gapBottom", (WORD)PopupOptions.gapBottom); - db_set_w(NULL, MODULNAME, "gapLeft", (WORD)PopupOptions.gapLeft); - db_set_w(NULL, MODULNAME, "gapRight", (WORD)PopupOptions.gapRight); - db_set_w(NULL, MODULNAME, "spacing", (WORD)PopupOptions.spacing); + db_set_w(NULL, MODULNAME, "gapTop", (WORD)PopupOptions.gapTop); + db_set_w(NULL, MODULNAME, "gapBottom", (WORD)PopupOptions.gapBottom); + db_set_w(NULL, MODULNAME, "gapLeft", (WORD)PopupOptions.gapLeft); + db_set_w(NULL, MODULNAME, "gapRight", (WORD)PopupOptions.gapRight); + db_set_w(NULL, MODULNAME, "spacing", (WORD)PopupOptions.spacing); //Spreading db_set_b(NULL, MODULNAME, "Spreading", (BYTE)PopupOptions.Spreading); @@ -522,7 +517,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM PROTOACCOUNT **protocols; ProtoEnumAccounts(&protocolCount, &protocols); - for (int i=0; i < protocolCount; ++i) { + for (int i = 0; i < protocolCount; ++i) { char prefix[128]; mir_snprintf(prefix, SIZEOF(prefix), "Protocol Status/%s", protocols[i]->szModuleName); @@ -538,7 +533,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_MINIMUMWIDTH_SPIN: { - LPNMUPDOWN lpnmud = (LPNMUPDOWN) lParam; + LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam; int temp = lpnmud->iPos + lpnmud->iDelta; if (temp > PopupOptions.MaximumWidth) { PopupOptions.MaximumWidth = min(temp, SETTING_MAXIMUMWIDTH_MAX); @@ -549,7 +544,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_MAXIMUMWIDTH_SPIN: { - LPNMUPDOWN lpnmud = (LPNMUPDOWN) lParam; + LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam; int temp = lpnmud->iPos + lpnmud->iDelta; if (temp < PopupOptions.MinimumWidth) { PopupOptions.MinimumWidth = max(temp, SETTING_MINIMUMWIDTH_MIN); @@ -561,7 +556,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_DESTROY: if (statusOptions) { - for (int i=0; i < statusOptionsCount; ++i) { + for (int i = 0; i < statusOptionsCount; ++i) { mir_free(statusOptions[i].pszOptionName); mir_free(statusOptions[i].pszSettingName); } @@ -585,7 +580,7 @@ void ErrorMSG(int minValue, int maxValue) void Check_ReorderPopups(HWND hwnd) { if (!PopupOptions.ReorderPopups && PopupOptions.ReorderPopupsWarning) { int res = MessageBox(hwnd, - TranslateT("'Reorder Popups' option is currently diabled.\r\nThis may cause misaligned popups when used with\r\navatars and text replacement (mainly NewXstatusNotify).\r\n\r\nDo you want to enable popup reordering now?\r\n"), + TranslateT("'Reorder popups' option is currently disabled.\r\nThis may cause misaligned popups when used with\r\navatars and text replacement (mainly NewXstatusNotify).\r\n\r\nDo you want to enable popup reordering now?\r\n"), TranslateT("Popup Plus Warning"), MB_ICONEXCLAMATION | MB_YESNOCANCEL); switch (res) { @@ -624,11 +619,11 @@ INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendMessage(GetDlgItem(hwndDlg, IDOK), BUTTONSETASFLATBTN, TRUE, 0); SendMessage(GetDlgItem(hwndDlg, IDOK), BUTTONADDTOOLTIP, (WPARAM)_T("OK"), BATF_TCHAR); - SendMessage(GetDlgItem(hwndDlg, IDOK), BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_OK,0)); + SendMessage(GetDlgItem(hwndDlg, IDOK), BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_OK, 0)); SendMessage(GetDlgItem(hwndDlg, IDCANCEL), BUTTONSETASFLATBTN, TRUE, 0); SendMessage(GetDlgItem(hwndDlg, IDCANCEL), BUTTONADDTOOLTIP, (WPARAM)_T("Cancel"), BATF_TCHAR); - SendMessage(GetDlgItem(hwndDlg, IDCANCEL), BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_CANCEL,0)); + SendMessage(GetDlgItem(hwndDlg, IDCANCEL), BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_OPT_CANCEL, 0)); SetDlgItemInt(hwndDlg, IDC_TXT_TOP, PopupOptions.gapTop, FALSE); SetDlgItemInt(hwndDlg, IDC_TXT_BOTTOM, PopupOptions.gapBottom, FALSE); diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp index bdaf23e446..4f6e45ff22 100644 --- a/plugins/Popup/src/opttree.cpp +++ b/plugins/Popup/src/opttree.cpp @@ -35,7 +35,7 @@ static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem) TVITEMW tvi = {0}; - tvi.mask = TVIF_HANDLE|TVIF_TEXT; + tvi.mask = TVIF_HANDLE | TVIF_TEXT; tvi.hItem = hItem; tvi.pszText = buf.unicode; tvi.cchTextMax = SIZEOF(buf.unicode); @@ -48,25 +48,21 @@ static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem) void OptTree_Translate(HWND hwndTree) { HTREEITEM hItem = TreeView_GetRoot(hwndTree); - while (hItem) - { + while (hItem) { OptTree_TranslateItem(hwndTree, hItem); HTREEITEM hItemTmp = 0; - if (hItemTmp = TreeView_GetChild(hwndTree, hItem)) - { + if (hItemTmp = TreeView_GetChild(hwndTree, hItem)) { hItem = hItemTmp; - } else - if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem)) - { + } + else if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem)) { hItem = hItemTmp; - } else - { - while (1) - { - if (!(hItem = TreeView_GetParent(hwndTree, hItem))) break; - if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem)) - { + } + else { + while (1) { + if (!(hItem = TreeView_GetParent(hwndTree, hItem))) + break; + if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem)) { hItem = hItemTmp; break; } @@ -92,8 +88,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHA tvi.pszText = str; tvi.cchTextMax = MAX_PATH; - while (tvi.hItem) - { + while (tvi.hItem) { TreeView_GetItem(hwndTree, &tvi); if (!lstrcmp(tvi.pszText, name)) @@ -108,47 +103,42 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconInd { TCHAR itemName[1024]; - TCHAR* sectionName; + TCHAR *sectionName; int sectionLevel = 0; HTREEITEM hSection = NULL, result = NULL; lstrcpy(itemName, name); sectionName = itemName; - while (sectionName) - { + while (sectionName) { // allow multi-level tree - TCHAR* pItemName = sectionName; + TCHAR *pItemName = sectionName; HTREEITEM hItem; - if (sectionName = _tcschr(sectionName, '/')) - { + if (sectionName = _tcschr(sectionName, '/')) { // one level deeper *sectionName = 0; sectionName++; } hItem = OptTree_FindNamedTreeItemAt(hwndTree, hSection, pItemName); - if (!sectionName || !hItem) - { - if (!hItem) - { + if (!sectionName || !hItem) { + if (!hItem) { TVINSERTSTRUCT tvis = {0}; tvis.hParent = hSection; tvis.hInsertAfter = TVI_LAST;//TVI_SORT; - tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE; tvis.item.pszText = pItemName; tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED; - if (sectionName) - { + if (sectionName) { tvis.item.lParam = 0; tvis.item.iImage = tvis.item.iSelectedImage = -1; - } else - { + } + else { tvis.item.lParam = lParam; tvis.item.iImage = tvis.item.iSelectedImage = iconIndex; - tvis.item.mask |= TVIF_IMAGE|TVIF_SELECTEDIMAGE; + tvis.item.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE; } hItem = TreeView_InsertItem(hwndTree, &tvis); if (!sectionName) @@ -176,8 +166,8 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, i TreeView_SelectItem(hwndTree, NULL); TreeView_DeleteAllItems(hwndTree); - hImgLst = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR|ILC_COLOR32|ILC_MASK, 5, 1); - ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR|LR_SHARED)); + hImgLst = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR | ILC_COLOR32 | ILC_MASK, 5, 1); + ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_POPUP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED)); ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadSkinnedIcon(SKINICON_OTHER_TICK)); ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadSkinnedIcon(SKINICON_OTHER_NOTICK)); ImageList_ReplaceIcon(hImgLst, -1, (HICON)LoadSkinnedIcon(SKINICON_OTHER_TICK)); @@ -187,56 +177,47 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, i TreeView_SetImageList(hwndTree, hImgLst, TVSIL_NORMAL); /* build options tree. based on code from IcoLib */ - for (indx = 0; indx < optionCount; indx++) - { - TCHAR* sectionName; + for (indx = 0; indx < optionCount; indx++) { + TCHAR *sectionName; int sectionLevel = 0; HTREEITEM hSection = NULL; lstrcpy(itemName, options[indx].pszOptionName); sectionName = itemName; - while (sectionName) - { + while (sectionName) { // allow multi-level tree - TCHAR* pItemName = sectionName; + TCHAR *pItemName = sectionName; HTREEITEM hItem; - if (sectionName = _tcschr(sectionName, '/')) - { + if (sectionName = _tcschr(sectionName, '/')) { // one level deeper *sectionName = 0; sectionName++; } hItem = OptTree_FindNamedTreeItemAt(hwndTree, hSection, pItemName); - if (!sectionName || !hItem) - { - if (!hItem) - { + if (!sectionName || !hItem) { + if (!hItem) { TVINSERTSTRUCT tvis = {0}; tvis.hParent = hSection; tvis.hInsertAfter = TVI_LAST;//TVI_SORT; - tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvis.item.pszText = pItemName; tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED; - if (sectionName) - { + if (sectionName) { tvis.item.lParam = -1; tvis.item.state |= TVIS_BOLD; tvis.item.stateMask |= TVIS_BOLD; tvis.item.iImage = tvis.item.iSelectedImage = IMG_GRPOPEN; - } else - { + } + else { tvis.item.lParam = indx; if (options[indx].groupId == OPTTREE_CHECK) - { tvis.item.iImage = tvis.item.iSelectedImage = IMG_NOCHECK; - } else - { + else tvis.item.iImage = tvis.item.iSelectedImage = IMG_NORCHECK; - } } hItem = TreeView_InsertItem(hwndTree, &tvis); if (!sectionName) @@ -263,23 +244,22 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, i case WM_NOTIFY: { LPNMHDR lpnmhdr = (LPNMHDR)lparam; - if (lpnmhdr->idFrom != idcTree) break; + if (lpnmhdr->idFrom != idcTree) + break; switch (lpnmhdr->code) { case NM_CLICK: { TVHITTESTINFO hti; - hti.pt.x=(short)LOWORD(GetMessagePos()); - hti.pt.y=(short)HIWORD(GetMessagePos()); - ScreenToClient(lpnmhdr->hwndFrom,&hti.pt); - if (TreeView_HitTest(lpnmhdr->hwndFrom,&hti)) - { - if (hti.flags&TVHT_ONITEMICON) - { + hti.pt.x = (short)LOWORD(GetMessagePos()); + hti.pt.y = (short)HIWORD(GetMessagePos()); + ScreenToClient(lpnmhdr->hwndFrom, &hti.pt); + if (TreeView_HitTest(lpnmhdr->hwndFrom, &hti)) { + if (hti.flags & TVHT_ONITEMICON) { TVITEM tvi; - tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE; - tvi.hItem=hti.hItem; - TreeView_GetItem(lpnmhdr->hwndFrom,&tvi); + tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE; + tvi.hItem = hti.hItem; + TreeView_GetItem(lpnmhdr->hwndFrom, &tvi); switch (tvi.iImage) { case IMG_GRPOPEN: @@ -306,12 +286,10 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, i case IMG_NORCHECK: { int i; - for (i = 0; i < optionCount; ++i) - { - if (options[i].groupId == options[tvi.lParam].groupId) - { + for (i = 0; i < optionCount; ++i) { + if (options[i].groupId == options[tvi.lParam].groupId) { TVITEM tvi_tmp; - tvi_tmp.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; + tvi_tmp.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi_tmp.hItem = options[i].hItem; tvi_tmp.iImage = tvi_tmp.iSelectedImage = IMG_NORCHECK; TreeView_SetItem(lpnmhdr->hwndFrom, &tvi_tmp); @@ -322,7 +300,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, i break; } } - TreeView_SetItem(lpnmhdr->hwndFrom,&tvi); + TreeView_SetItem(lpnmhdr->hwndFrom, &tvi); } } break; @@ -332,11 +310,10 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, i { LPNMTREEVIEW lpnmtv = (LPNMTREEVIEW)lparam; TVITEM tvi; - tvi.mask=TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; + tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi.hItem = lpnmtv->itemNew.hItem; - tvi.iImage = tvi.iSelectedImage = - (lpnmtv->itemNew.state & TVIS_EXPANDED) ? IMG_GRPOPEN : IMG_GRPCLOSED; - TreeView_SetItem(lpnmhdr->hwndFrom,&tvi); + tvi.iImage = tvi.iSelectedImage = (lpnmtv->itemNew.state & TVIS_EXPANDED) ? IMG_GRPOPEN : IMG_GRPCLOSED; + TreeView_SetItem(lpnmhdr->hwndFrom, &tvi); break; } } @@ -351,13 +328,12 @@ DWORD OptTree_GetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int op HWND hwndTree = GetDlgItem(hwnd, idcTree); DWORD result = 0; int i; - for (i = 0; i < optionCount; ++i) - { + for (i = 0; i < optionCount; ++i) { if ((!options[i].pszSettingName && !pszSettingName) || (options[i].pszSettingName && pszSettingName && !lstrcmp(options[i].pszSettingName, pszSettingName))) { - TVITEM tvi = { 0 }; - tvi.mask = TVIF_HANDLE|TVIF_IMAGE; + TVITEM tvi = {0}; + tvi.mask = TVIF_HANDLE | TVIF_IMAGE; tvi.hItem = options[i].hItem; TreeView_GetItem(hwndTree, &tvi); if ((tvi.iImage == IMG_CHECK) || (tvi.iImage == IMG_RCHECK)) @@ -370,13 +346,12 @@ DWORD OptTree_GetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int op void OptTree_SetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int optionCount, DWORD dwOptions, LPTSTR pszSettingName) { HWND hwndTree = GetDlgItem(hwnd, idcTree); - for (int i = 0; i < optionCount; ++i) - { + for (int i = 0; i < optionCount; ++i) { if ((!options[i].pszSettingName && !pszSettingName) || (options[i].pszSettingName && pszSettingName && !lstrcmp(options[i].pszSettingName, pszSettingName))) { TVITEM tvi; - tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; + tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvi.hItem = options[i].hItem; if (options[i].groupId == OPTTREE_CHECK) tvi.iImage = tvi.iSelectedImage = (dwOptions & options[i].dwFlag) ? IMG_CHECK : IMG_NOCHECK; diff --git a/plugins/Popup/src/resource.h b/plugins/Popup/src/resource.h index a2f81a2aec..df05d7e9ee 100644 --- a/plugins/Popup/src/resource.h +++ b/plugins/Popup/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by resource.rc +// Used by ..\res\resource.rc // #define IDD_OPT_POPUP 101 #define IDD_OPT_POPUP_ADVANCED 102 @@ -53,6 +53,8 @@ #define IDC_FADEOUT 1013 #define IDC_FADEOUT_SPIN 1014 #define IDC_FADEOUT_TXT2 1015 +#define IDC_HISTORYSIZE_SPIN 1016 +#define IDC_MAXPOPUPS_SPIN 1017 #define IDC_PREVIEW 1033 #define IDC_DEBUG 1034 #define IDC_GRP_MULTIMONITOR 1035 -- cgit v1.2.3