From 7071e88fdeeaa146c8e72894c6eae58f438f2690 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 6 Mar 2018 16:17:32 +0300 Subject: PSN_WIZFINISH: new WM_NOTIFY event to be called when one of the options tabs is changed --- plugins/AVS/src/options.cpp | 270 ++++++++++----------- plugins/Scriver/src/chat_options.cpp | 185 +++++++------- plugins/Scriver/src/msgoptions.cpp | 72 +++--- .../src/AdvancedAutoAway/aaa_msgoptions.cpp | 4 + .../src/AdvancedAutoAway/aaa_options.cpp | 31 ++- .../StatusManager/src/KeepStatus/ks_options.cpp | 43 ++-- .../StatusManager/src/StartupStatus/ss_options.cpp | 25 +- plugins/TabSRMM/src/chat_options.cpp | 52 ++-- plugins/TabSRMM/src/msgoptions.cpp | 3 +- plugins/TabSRMM/src/muchighlight.cpp | 10 +- 10 files changed, 366 insertions(+), 329 deletions(-) (limited to 'plugins') diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 19024dd883..ffabf9441f 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -205,17 +205,17 @@ static INT_PTR CALLBACK DlgProcOptionsAvatars(HWND hwndDlg, UINT msg, WPARAM wPa case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case IDC_MAKE_TRANSPARENT_BKG: - { - BOOL transp_enabled = IsDlgButtonChecked(hwndDlg, IDC_MAKE_TRANSPARENT_BKG); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_L), transp_enabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_SPIN), transp_enabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS), transp_enabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_L), transp_enabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN), transp_enabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE), transp_enabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_MAKE_TRANSP_PROPORTIONAL), transp_enabled); - break; - } + { + BOOL transp_enabled = IsDlgButtonChecked(hwndDlg, IDC_MAKE_TRANSPARENT_BKG); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_L), transp_enabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_SPIN), transp_enabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS), transp_enabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_L), transp_enabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN), transp_enabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE), transp_enabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_MAKE_TRANSP_PROPORTIONAL), transp_enabled); + break; + } case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: @@ -331,19 +331,19 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar break; case WM_DRAWITEM: - { - LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; - if (dis->CtlType == ODT_BUTTON && dis->CtlID == IDC_PROTOPIC) { - AVATARDRAWREQUEST avdrq = { 0 }; - avdrq.cbSize = sizeof(avdrq); - avdrq.hTargetDC = dis->hDC; - avdrq.dwFlags |= AVDRQ_PROTOPICT; - avdrq.szProto = g_selectedProto; - GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), &avdrq.rcDraw); - CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&avdrq); + { + LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; + if (dis->CtlType == ODT_BUTTON && dis->CtlID == IDC_PROTOPIC) { + AVATARDRAWREQUEST avdrq = { 0 }; + avdrq.cbSize = sizeof(avdrq); + avdrq.hTargetDC = dis->hDC; + avdrq.dwFlags |= AVDRQ_PROTOPICT; + avdrq.szProto = g_selectedProto; + GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), &avdrq.rcDraw); + CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&avdrq); + } } - } - return TRUE; + return TRUE; case WM_NOTIFY: if (dialoginit) @@ -353,20 +353,20 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar case IDC_PROTOCOLS: switch (((LPNMHDR)lParam)->code) { case LVN_KEYDOWN: - { - NMLVKEYDOWN* ptkd = (NMLVKEYDOWN*)lParam; - if (ptkd&&ptkd->wVKey == VK_SPACE&&ListView_GetSelectedCount(ptkd->hdr.hwndFrom) == 1) - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - break; + { + NMLVKEYDOWN* ptkd = (NMLVKEYDOWN*)lParam; + if (ptkd&&ptkd->wVKey == VK_SPACE && ListView_GetSelectedCount(ptkd->hdr.hwndFrom) == 1) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + break; case LVN_ITEMCHANGED: - { - NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; - if (IsWindowVisible(GetDlgItem(hwndDlg, IDC_PROTOCOLS)) && ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK)) - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - break; + { + NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; + if (IsWindowVisible(GetDlgItem(hwndDlg, IDC_PROTOCOLS)) && ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK)) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + break; case NM_CLICK: EnableWindow(hwndChoosePic, TRUE); @@ -515,28 +515,28 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA break; case IDOK: - { - BOOL locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR); - int hidden = IsDlgButtonChecked(hwndDlg, IDC_HIDEAVATAR) ? 1 : 0; - SetAvatarAttribute(hContact, AVS_HIDEONCLIST, hidden); - if (hidden != db_get_b(hContact, "ContactPhoto", "Hidden", 0)) - db_set_b(hContact, "ContactPhoto", "Hidden", hidden); + { + BOOL locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR); + int hidden = IsDlgButtonChecked(hwndDlg, IDC_HIDEAVATAR) ? 1 : 0; + SetAvatarAttribute(hContact, AVS_HIDEONCLIST, hidden); + if (hidden != db_get_b(hContact, "ContactPhoto", "Hidden", 0)) + db_set_b(hContact, "ContactPhoto", "Hidden", hidden); - if (!locked && db_get_b(hContact, "ContactPhoto", "NeedUpdate", 0)) - QueueAdd(hContact); - } - // Continue to the cancel handle + if (!locked && db_get_b(hContact, "ContactPhoto", "NeedUpdate", 0)) + QueueAdd(hContact); + } + // Continue to the cancel handle case IDCANCEL: DestroyWindow(hwndDlg); break; case IDC_PROTECTAVATAR: - { - BOOL locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR); - ProtectAvatar(hContact, locked ? 1 : 0); - } - break; + { + BOOL locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR); + ProtectAvatar(hContact, locked ? 1 : 0); + } + break; case IDC_CHANGE: SetAvatar(hContact, 0); @@ -550,18 +550,18 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA break; case IDC_MAKETRANSPBKG: - { - BOOL enable = IsDlgButtonChecked(hwndDlg, IDC_MAKETRANSPBKG); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_L), enable); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_SPIN), enable); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS), enable); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_L), enable); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN), enable); - EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE), enable); + { + BOOL enable = IsDlgButtonChecked(hwndDlg, IDC_MAKETRANSPBKG); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_L), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS_SPIN), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_L), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE_SPIN), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE), enable); - SendMessage(hwndDlg, DM_REALODAVATAR, 0, 0); - } - break; + SendMessage(hwndDlg, DM_REALODAVATAR, 0, 0); + } + break; case IDC_RESET: ProtectAvatar(hContact, 0); @@ -610,69 +610,69 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA break; case WM_DRAWITEM: - { - LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; - if (dis->CtlType == ODT_BUTTON && dis->CtlID == IDC_PROTOPIC) { - AVATARDRAWREQUEST avdrq = { 0 }; - GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), &avdrq.rcDraw); - - FillRect(dis->hDC, &avdrq.rcDraw, GetSysColorBrush(COLOR_BTNFACE)); - - avdrq.hContact = hContact; - avdrq.cbSize = sizeof(avdrq); - avdrq.hTargetDC = dis->hDC; - avdrq.dwFlags |= AVDRQ_DRAWBORDER; - avdrq.clrBorder = GetSysColor(COLOR_BTNTEXT); - avdrq.radius = 6; - if (!CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&avdrq)) { - // Get text rectangle - RECT rc = avdrq.rcDraw; - rc.top += 10; - rc.bottom -= 10; - rc.left += 10; - rc.right -= 10; - - // Calc text size - RECT rc_ret = rc; - DrawText(dis->hDC, TranslateT("Contact has no avatar"), -1, &rc_ret, - DT_WORDBREAK | DT_NOPREFIX | DT_CENTER | DT_CALCRECT); - - // Calc needed size - rc.top += ((rc.bottom - rc.top) - (rc_ret.bottom - rc_ret.top)) / 2; - rc.bottom = rc.top + (rc_ret.bottom - rc_ret.top); - DrawText(dis->hDC, TranslateT("Contact has no avatar"), -1, &rc, - DT_WORDBREAK | DT_NOPREFIX | DT_CENTER); - } + { + LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; + if (dis->CtlType == ODT_BUTTON && dis->CtlID == IDC_PROTOPIC) { + AVATARDRAWREQUEST avdrq = { 0 }; + GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), &avdrq.rcDraw); + + FillRect(dis->hDC, &avdrq.rcDraw, GetSysColorBrush(COLOR_BTNFACE)); + + avdrq.hContact = hContact; + avdrq.cbSize = sizeof(avdrq); + avdrq.hTargetDC = dis->hDC; + avdrq.dwFlags |= AVDRQ_DRAWBORDER; + avdrq.clrBorder = GetSysColor(COLOR_BTNTEXT); + avdrq.radius = 6; + if (!CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&avdrq)) { + // Get text rectangle + RECT rc = avdrq.rcDraw; + rc.top += 10; + rc.bottom -= 10; + rc.left += 10; + rc.right -= 10; + + // Calc text size + RECT rc_ret = rc; + DrawText(dis->hDC, TranslateT("Contact has no avatar"), -1, &rc_ret, + DT_WORDBREAK | DT_NOPREFIX | DT_CENTER | DT_CALCRECT); + + // Calc needed size + rc.top += ((rc.bottom - rc.top) - (rc_ret.bottom - rc_ret.top)) / 2; + rc.bottom = rc.top + (rc_ret.bottom - rc_ret.top); + DrawText(dis->hDC, TranslateT("Contact has no avatar"), -1, &rc, + DT_WORDBREAK | DT_NOPREFIX | DT_CENTER); + } - FrameRect(dis->hDC, &avdrq.rcDraw, GetSysColorBrush(COLOR_BTNSHADOW)); + FrameRect(dis->hDC, &avdrq.rcDraw, GetSysColorBrush(COLOR_BTNSHADOW)); + } } - } - return TRUE; + return TRUE; case DM_SETAVATARNAME: - { - wchar_t szFinalName[MAX_PATH]; - DBVARIANT dbv = { 0 }; - BYTE is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); + { + wchar_t szFinalName[MAX_PATH]; + DBVARIANT dbv = { 0 }; + BYTE is_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); - szFinalName[0] = 0; + szFinalName[0] = 0; - if (is_locked && !db_get_ws(hContact, "ContactPhoto", "Backup", &dbv)) { - MyPathToAbsolute(dbv.ptszVal, szFinalName); - db_free(&dbv); - } - else if (!db_get_ws(hContact, "ContactPhoto", "RFile", &dbv)) { - MyPathToAbsolute(dbv.ptszVal, szFinalName); - db_free(&dbv); - } - else if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) { - MyPathToAbsolute(dbv.ptszVal, szFinalName); - db_free(&dbv); + if (is_locked && !db_get_ws(hContact, "ContactPhoto", "Backup", &dbv)) { + MyPathToAbsolute(dbv.ptszVal, szFinalName); + db_free(&dbv); + } + else if (!db_get_ws(hContact, "ContactPhoto", "RFile", &dbv)) { + MyPathToAbsolute(dbv.ptszVal, szFinalName); + db_free(&dbv); + } + else if (!db_get_ws(hContact, "ContactPhoto", "File", &dbv)) { + MyPathToAbsolute(dbv.ptszVal, szFinalName); + db_free(&dbv); + } + szFinalName[MAX_PATH - 1] = 0; + SetDlgItemText(hwndDlg, IDC_AVATARNAME, szFinalName); } - szFinalName[MAX_PATH - 1] = 0; - SetDlgItemText(hwndDlg, IDC_AVATARNAME, szFinalName); - } - break; + break; case DM_REALODAVATAR: SaveTransparentData(hwndDlg, hContact, IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR)); @@ -1026,28 +1026,28 @@ static INT_PTR CALLBACK DlgProcAvatarProtoInfo(HWND hwndDlg, UINT msg, WPARAM wP break; case WM_NOTIFY: - { - LPNMHDR nm = (LPNMHDR)lParam; - switch (nm->idFrom) { - case IDC_PROTOCOLS: - switch (nm->code) { - case LVN_ITEMCHANGED: - LPNMLISTVIEW li = (LPNMLISTVIEW)nm; - if (li->uNewState & LVIS_SELECTED) { - SendDlgItemMessage(hwndDlg, IDC_PROTOPIC, AVATAR_SETPROTOCOL, 0, li->lParam); - EnableDisableControls(hwndDlg, (char*)li->lParam); + { + LPNMHDR nm = (LPNMHDR)lParam; + switch (nm->idFrom) { + case IDC_PROTOCOLS: + switch (nm->code) { + case LVN_ITEMCHANGED: + LPNMLISTVIEW li = (LPNMLISTVIEW)nm; + if (li->uNewState & LVIS_SELECTED) { + SendDlgItemMessage(hwndDlg, IDC_PROTOPIC, AVATAR_SETPROTOCOL, 0, li->lParam); + EnableDisableControls(hwndDlg, (char*)li->lParam); + } } - } - break; - - case IDC_PROTOPIC: - if (nm->code == NM_AVATAR_CHANGED) { - EnableDisableControls(hwndDlg, GetSelectedProtocol(hwndDlg)); break; + + case IDC_PROTOPIC: + if (nm->code == NM_AVATAR_CHANGED) { + EnableDisableControls(hwndDlg, GetSelectedProtocol(hwndDlg)); + break; + } } } - } - break; + break; case WM_COMMAND: switch (LOWORD(wParam)) { diff --git a/plugins/Scriver/src/chat_options.cpp b/plugins/Scriver/src/chat_options.cpp index 7ddb5ac90c..6f6a664edc 100644 --- a/plugins/Scriver/src/chat_options.cpp +++ b/plugins/Scriver/src/chat_options.cpp @@ -309,6 +309,11 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case 0: switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + pci->ReloadSettings(); + Chat_UpdateOptions(); + break; + case PSN_APPLY: int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_GROUP)); if (iLen > 0) { @@ -325,9 +330,6 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM db_unset(0, CHAT_MODULE, "NicklistRowDist"); SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch1, _countof(branch1)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch4, _countof(branch4)); - - pci->ReloadSettings(); - Chat_UpdateOptions(); } return TRUE; } @@ -502,112 +504,115 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM hti.pt.y = (short)HIWORD(GetMessagePos()); ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt); if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti)) - if (hti.flags&TVHT_ONITEMSTATEICON) { + if (hti.flags & TVHT_ONITEMSTATEICON) SendMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom, (LPARAM)hti.hItem); - } } else if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) { - if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE) { - SendMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom, - (LPARAM)TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom)); - } + if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE) + SendMessage(hwndDlg, UM_CHECKSTATECHANGE, (WPARAM)((LPNMHDR)lParam)->hwndFrom, (LPARAM)TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom)); } } - else if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) { - char *pszText = nullptr; - int iLen; - - iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_HIGHLIGHTWORDS)); - if (iLen > 0) { - wchar_t *ptszText = (wchar_t*)mir_alloc((iLen + 2) * sizeof(wchar_t)); - wchar_t *p2 = nullptr; - - if (ptszText) { - GetDlgItemText(hwndDlg, IDC_CHAT_HIGHLIGHTWORDS, ptszText, iLen + 1); - p2 = wcschr(ptszText, (wchar_t)','); - while (p2) { - *p2 = ' '; + else if (((LPNMHDR)lParam)->idFrom == 0) { + switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + pci->ReloadSettings(); + Chat_UpdateOptions(); + break; + + case PSN_APPLY: + char *pszText = nullptr; + int iLen; + + iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_HIGHLIGHTWORDS)); + if (iLen > 0) { + wchar_t *ptszText = (wchar_t*)mir_alloc((iLen + 2) * sizeof(wchar_t)); + wchar_t *p2 = nullptr; + + if (ptszText) { + GetDlgItemText(hwndDlg, IDC_CHAT_HIGHLIGHTWORDS, ptszText, iLen + 1); p2 = wcschr(ptszText, (wchar_t)','); + while (p2) { + *p2 = ' '; + p2 = wcschr(ptszText, (wchar_t)','); + } + db_set_ws(0, CHAT_MODULE, "HighlightWords", ptszText); + mir_free(ptszText); } - db_set_ws(0, CHAT_MODULE, "HighlightWords", ptszText); - mir_free(ptszText); } - } - else db_unset(0, CHAT_MODULE, "HighlightWords"); - - iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY)); - if (iLen > 0) { - wchar_t *pszText1 = (wchar_t*)malloc(iLen*sizeof(wchar_t) + 2); - GetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, pszText1, iLen + 1); - db_set_ws(0, CHAT_MODULE, "LogDirectory", pszText1); - free(pszText1); - } - else { - mir_wstrncpy(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH); - db_unset(0, CHAT_MODULE, "LogDirectory"); - } - pci->SM_InvalidateLogDirectories(); + else db_unset(0, CHAT_MODULE, "HighlightWords"); - iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGTIMESTAMP)); - if (iLen > 0) { - pszText = (char*)mir_realloc(pszText, iLen + 1); - GetDlgItemTextA(hwndDlg, IDC_CHAT_LOGTIMESTAMP, pszText, iLen + 1); - db_set_s(0, CHAT_MODULE, "LogTimestamp", pszText); - } - else db_unset(0, CHAT_MODULE, "LogTimestamp"); + iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY)); + if (iLen > 0) { + wchar_t *pszText1 = (wchar_t*)malloc(iLen * sizeof(wchar_t) + 2); + GetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, pszText1, iLen + 1); + db_set_ws(0, CHAT_MODULE, "LogDirectory", pszText1); + free(pszText1); + } + else { + mir_wstrncpy(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH); + db_unset(0, CHAT_MODULE, "LogDirectory"); + } + pci->SM_InvalidateLogDirectories(); - iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_TIMESTAMP)); - if (iLen > 0) { - pszText = (char*)mir_realloc(pszText, iLen + 1); - GetDlgItemTextA(hwndDlg, IDC_CHAT_TIMESTAMP, pszText, iLen + 1); - db_set_s(0, CHAT_MODULE, "HeaderTime", pszText); - } - else db_unset(0, CHAT_MODULE, "HeaderTime"); + iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGTIMESTAMP)); + if (iLen > 0) { + pszText = (char*)mir_realloc(pszText, iLen + 1); + GetDlgItemTextA(hwndDlg, IDC_CHAT_LOGTIMESTAMP, pszText, iLen + 1); + db_set_s(0, CHAT_MODULE, "LogTimestamp", pszText); + } + else db_unset(0, CHAT_MODULE, "LogTimestamp"); - iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_INSTAMP)); - if (iLen > 0) { - pszText = (char*)mir_realloc(pszText, iLen + 1); - GetDlgItemTextA(hwndDlg, IDC_CHAT_INSTAMP, pszText, iLen + 1); - db_set_s(0, CHAT_MODULE, "HeaderIncoming", pszText); - } - else db_unset(0, CHAT_MODULE, "HeaderIncoming"); + iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_TIMESTAMP)); + if (iLen > 0) { + pszText = (char*)mir_realloc(pszText, iLen + 1); + GetDlgItemTextA(hwndDlg, IDC_CHAT_TIMESTAMP, pszText, iLen + 1); + db_set_s(0, CHAT_MODULE, "HeaderTime", pszText); + } + else db_unset(0, CHAT_MODULE, "HeaderTime"); - iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_OUTSTAMP)); - if (iLen > 0) { - pszText = (char*)mir_realloc(pszText, iLen + 1); - GetDlgItemTextA(hwndDlg, IDC_CHAT_OUTSTAMP, pszText, iLen + 1); - db_set_s(0, CHAT_MODULE, "HeaderOutgoing", pszText); - } - else db_unset(0, CHAT_MODULE, "HeaderOutgoing"); + iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_INSTAMP)); + if (iLen > 0) { + pszText = (char*)mir_realloc(pszText, iLen + 1); + GetDlgItemTextA(hwndDlg, IDC_CHAT_INSTAMP, pszText, iLen + 1); + db_set_s(0, CHAT_MODULE, "HeaderIncoming", pszText); + } + else db_unset(0, CHAT_MODULE, "HeaderIncoming"); + + iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_OUTSTAMP)); + if (iLen > 0) { + pszText = (char*)mir_realloc(pszText, iLen + 1); + GetDlgItemTextA(hwndDlg, IDC_CHAT_OUTSTAMP, pszText, iLen + 1); + db_set_s(0, CHAT_MODULE, "HeaderOutgoing", pszText); + } + else db_unset(0, CHAT_MODULE, "HeaderOutgoing"); - g_Settings.bHighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHAT_HIGHLIGHT) == BST_CHECKED ? TRUE : FALSE; - db_set_b(0, CHAT_MODULE, "HighlightEnabled", (BYTE)g_Settings.bHighlightEnabled); + g_Settings.bHighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHAT_HIGHLIGHT) == BST_CHECKED ? TRUE : FALSE; + db_set_b(0, CHAT_MODULE, "HighlightEnabled", (BYTE)g_Settings.bHighlightEnabled); - g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED ? TRUE : FALSE; - db_set_b(0, CHAT_MODULE, "LoggingEnabled", (BYTE)g_Settings.bLoggingEnabled); + g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED ? TRUE : FALSE; + db_set_b(0, CHAT_MODULE, "LoggingEnabled", (BYTE)g_Settings.bLoggingEnabled); - iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0); - db_set_w(0, CHAT_MODULE, "LogLimit", (WORD)iLen); - iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0); - db_set_w(0, CHAT_MODULE, "LoggingLimit", (WORD)iLen); + iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0); + db_set_w(0, CHAT_MODULE, "LogLimit", (WORD)iLen); + iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0); + db_set_w(0, CHAT_MODULE, "LoggingLimit", (WORD)iLen); - SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch2, _countof(branch2)); - SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch3, _countof(branch3)); + SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch2, _countof(branch2)); + SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch3, _countof(branch3)); - mir_free(pszText); + mir_free(pszText); - g_Settings.dwIconFlags = db_get_dw(0, CHAT_MODULE, "IconFlags", 0x0000); - g_Settings.dwTrayIconFlags = db_get_dw(0, CHAT_MODULE, "TrayIconFlags", 0x1000); - g_Settings.dwPopupFlags = db_get_dw(0, CHAT_MODULE, "PopupFlags", 0x0000); - g_Settings.bStripFormat = db_get_b(0, CHAT_MODULE, "TrimFormatting", 0) != 0; - g_Settings.bTrayIconInactiveOnly = db_get_b(0, CHAT_MODULE, "TrayIconInactiveOnly", 1) != 0; - g_Settings.bPopupInactiveOnly = db_get_b(0, CHAT_MODULE, "PopUpInactiveOnly", 1) != 0; - g_Settings.bLogIndentEnabled = (db_get_b(0, CHAT_MODULE, "LogIndentEnabled", 1) != 0) ? TRUE : FALSE; + g_Settings.dwIconFlags = db_get_dw(0, CHAT_MODULE, "IconFlags", 0x0000); + g_Settings.dwTrayIconFlags = db_get_dw(0, CHAT_MODULE, "TrayIconFlags", 0x1000); + g_Settings.dwPopupFlags = db_get_dw(0, CHAT_MODULE, "PopupFlags", 0x0000); + g_Settings.bStripFormat = db_get_b(0, CHAT_MODULE, "TrimFormatting", 0) != 0; + g_Settings.bTrayIconInactiveOnly = db_get_b(0, CHAT_MODULE, "TrayIconInactiveOnly", 1) != 0; + g_Settings.bPopupInactiveOnly = db_get_b(0, CHAT_MODULE, "PopUpInactiveOnly", 1) != 0; + g_Settings.bLogIndentEnabled = (db_get_b(0, CHAT_MODULE, "LogIndentEnabled", 1) != 0) ? TRUE : FALSE; - pci->MM_FontsChanged(); - pci->ReloadSettings(); - Chat_UpdateOptions(); - return TRUE; + pci->MM_FontsChanged(); + return TRUE; + } } break; diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index e790cd41a1..741f64191a 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -230,23 +230,12 @@ static DWORD MakeCheckBoxTreeFlags(HWND hwndTree) return flags; } -static int changed = 0; - -static void ApplyChanges(int i) -{ - changed &= ~i; - if (changed == 0) { - ReloadGlobals(); - WindowList_Broadcast(g_dat.hParentWindowList, DM_OPTIONSAPPLIED, 0, 0); - Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0); - Chat_UpdateOptions(); - } -} - -static void MarkChanges(int i, HWND hWnd) +static void ApplyOptions() { - SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); - changed |= i; + ReloadGlobals(); + WindowList_Broadcast(g_dat.hParentWindowList, DM_OPTIONSAPPLIED, 0, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0); + Chat_UpdateOptions(); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -341,13 +330,17 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam return 0; break; } - MarkChanges(8, hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + ApplyOptions(); + break; + case PSN_APPLY: db_set_b(0, SRMM_MODULE, SRMSGSET_USETABS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USETABS)); db_set_b(0, SRMM_MODULE, SRMSGSET_TABSATBOTTOM, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TABSATBOTTOM)); @@ -363,8 +356,6 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam db_set_b(0, SRMM_MODULE, SRMSGSET_SWITCHTOACTIVE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SWITCHTOACTIVE)); db_set_b(0, SRMM_MODULE, SRMSGSET_TABCLOSEBUTTON, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TABCLOSEBUTTON)); db_set_b(0, SRMM_MODULE, SRMSGSET_SEPARATECHATSCONTAINERS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS)); - - ApplyChanges(8); return TRUE; } } @@ -429,7 +420,7 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar return 0; break; } - MarkChanges(16, hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_HSCROLL: @@ -437,13 +428,17 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar SetDlgItemTextA(hwndDlg, IDC_ATRANSPARENCYPERC, str); mir_snprintf(str, "%d%%", (int)(100 * SendDlgItemMessage(hwndDlg, IDC_ITRANSPARENCYVALUE, TBM_GETPOS, 0, 0) / 256)); SetDlgItemTextA(hwndDlg, IDC_ITRANSPARENCYPERC, str); - MarkChanges(16, hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + ApplyOptions(); + break; + case PSN_APPLY: db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWSTATUSBAR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSBAR)); db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWTITLEBAR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR)); @@ -461,8 +456,6 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar db_set_w(0, SRMM_MODULE, SRMSGSET_AUTORESIZELINES, (WORD)SendDlgItemMessage(hwndDlg, IDC_INPUTLINESSPIN, UDM_GETPOS, 0, 0)); LoadInfobarFonts(); - - ApplyChanges(16); return TRUE; } } @@ -527,7 +520,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP CheckDlgButton(hwndDlg, IDC_CASCADE, BST_UNCHECKED); break; } - MarkChanges(2, hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: @@ -546,18 +539,22 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1; TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi); - MarkChanges(2, hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } } else if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) { if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE) - MarkChanges(2, hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } break; case 0: switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + ApplyOptions(); + break; + case PSN_APPLY: db_set_dw(0, SRMM_MODULE, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST))); db_set_b(0, SRMM_MODULE, SRMSGSET_AUTOPOPUP, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP)); @@ -574,9 +571,6 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_b(0, SRMM_MODULE, SRMSGSET_CASCADE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CASCADE)); db_set_b(0, SRMM_MODULE, SRMSGSET_HIDECONTAINERS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDECONTAINERS)); - - ApplyChanges(2); - return TRUE; } } @@ -768,13 +762,17 @@ public: case IDC_SRMM_LOG: return 0; } - MarkChanges(4, m_hwnd); + SendMessage(GetParent(m_hwnd), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + ApplyOptions(); + break; + case PSN_APPLY: if (IsDlgButtonChecked(m_hwnd, IDC_LOADCOUNT)) db_set_b(0, SRMM_MODULE, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT); @@ -801,7 +799,6 @@ public: FreeMsgLogIcons(); LoadMsgLogIcons(); - ApplyChanges(4); return TRUE; } } @@ -895,7 +892,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), FALSE); } - MarkChanges(4, hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_SHOWNOTIFY: @@ -909,7 +906,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam case IDC_NOTIFYTRAY: case IDC_NOTIFYBALLOON: case IDC_TYPINGSWITCH: - MarkChanges(4, hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } break; @@ -922,7 +919,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam ResetCList(hwndDlg); break; case CLN_CHECKCHANGED: - MarkChanges(4, hwndDlg); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case CLN_LISTREBUILT: RebuildList(hwndDlg, hItemNew, hItemUnknown); @@ -983,16 +980,17 @@ int OptInitialise(WPARAM wParam, LPARAM) odp.pDialog = nullptr; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS1); odp.pfnDlgProc = DlgProcOptions1; - odp.szTab.a = LPGEN("Group chat"); + odp.szGroup.a = LPGEN("Message sessions"); + odp.szTitle.a = LPGEN("Group chats"); + odp.szTab.a = LPGEN("General"); Options_AddPage(wParam, &odp); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS2); odp.pfnDlgProc = DlgProcOptions2; - odp.szTab.a = LPGEN("Group chat log"); + odp.szTab.a = LPGEN("Event log"); Options_AddPage(wParam, &odp); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGTYPE); - odp.szGroup.a = LPGEN("Message sessions"); odp.szTitle.a = LPGEN("Typing notify"); odp.pfnDlgProc = DlgProcTypeOptions; odp.szTab.a = nullptr; diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp index ef10baf786..3d98745d1a 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp @@ -160,6 +160,10 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + AAALoadOptions(); + break; + case PSN_APPLY: SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_STATUS, CBN_SELCHANGE), 0); for (int i = 0; i < count; i++) { diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp index 5e3f18e92c..3e69ef472a 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp @@ -329,6 +329,10 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM } switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + AAALoadOptions(); + break; + case PSN_APPLY: if (bSettingSame) WriteAutoAwaySetting(*sameSetting, SETTING_ALL); @@ -336,7 +340,6 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM for (auto &it : optionSettings) WriteAutoAwaySetting(*it, it->m_szName); } - AAALoadOptions(); } break; @@ -392,16 +395,22 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA break; case WM_NOTIFY: - if (((LPNMHDR)lParam)->code == PSN_APPLY) { - db_set_b(0, AAAMODULENAME, SETTING_IGNLOCK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNLOCK)); - db_set_b(0, AAAMODULENAME, SETTING_IGNSYSKEYS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNSYSKEYS)); - db_set_b(0, AAAMODULENAME, SETTING_IGNALTCOMBO, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNALTCOMBO)); - db_set_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, (BYTE)bSettingSame); - db_set_w(0, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, (WORD)GetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, nullptr, FALSE)); - db_set_w(0, AAAMODULENAME, SETTING_CONFIRMDELAY, (WORD)GetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, nullptr, FALSE)); - db_set_b(0, AAAMODULENAME, SETTING_MONITORMOUSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORMOUSE)); - db_set_b(0, AAAMODULENAME, SETTING_MONITORKEYBOARD, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORKEYBOARD)); - AAALoadOptions(); + if (((LPNMHDR)lParam)->idFrom == 0) { + switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + AAALoadOptions(); + break; + + case PSN_APPLY: + db_set_b(0, AAAMODULENAME, SETTING_IGNLOCK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNLOCK)); + db_set_b(0, AAAMODULENAME, SETTING_IGNSYSKEYS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNSYSKEYS)); + db_set_b(0, AAAMODULENAME, SETTING_IGNALTCOMBO, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNALTCOMBO)); + db_set_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, (BYTE)bSettingSame); + db_set_w(0, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, (WORD)GetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, nullptr, FALSE)); + db_set_w(0, AAAMODULENAME, SETTING_CONFIRMDELAY, (WORD)GetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, nullptr, FALSE)); + db_set_b(0, AAAMODULENAME, SETTING_MONITORMOUSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORMOUSE)); + db_set_b(0, AAAMODULENAME, SETTING_MONITORKEYBOARD, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORKEYBOARD)); + } } break; } diff --git a/plugins/StatusManager/src/KeepStatus/ks_options.cpp b/plugins/StatusManager/src/KeepStatus/ks_options.cpp index 3a34470d06..812d26ad6c 100644 --- a/plugins/StatusManager/src/KeepStatus/ks_options.cpp +++ b/plugins/StatusManager/src/KeepStatus/ks_options.cpp @@ -111,19 +111,19 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam if (((NMHDR*)lParam)->idFrom == IDC_PROTOCOLLIST) { switch (((NMHDR*)lParam)->code) { case LVN_ITEMCHANGED: - { - NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; - if (IsWindowVisible(GetDlgItem(hwndDlg, IDC_PROTOCOLLIST)) && ((nmlv->uNewState^nmlv->uOldState)&LVIS_STATEIMAGEMASK)) - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } + NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; + if (IsWindowVisible(GetDlgItem(hwndDlg, IDC_PROTOCOLLIST)) && ((nmlv->uNewState^nmlv->uOldState)&LVIS_STATEIMAGEMASK)) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } } - if (((LPNMHDR)lParam)->code == PSN_APPLY) { - int i; - LVITEM lvItem; + switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + KSLoadOptions(); + break; + case PSN_APPLY: db_set_b(0, KSMODULENAME, SETTING_MAXRETRIES, (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXRETRIES, nullptr, FALSE)); db_set_b(0, KSMODULENAME, SETTING_CHECKCONNECTION, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)); db_set_b(0, KSMODULENAME, SETTING_SHOWCONNECTIONPOPUPS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCONNECTIONPOPUPS)); @@ -132,22 +132,18 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam db_set_b(0, KSMODULENAME, SETTING_CONTCHECK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK)); db_set_b(0, KSMODULENAME, SETTING_BYPING, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BYPING)); if (IsDlgButtonChecked(hwndDlg, IDC_BYPING)) { - char *host; - int len = SendDlgItemMessage(hwndDlg, IDC_PINGHOST, WM_GETTEXTLENGTH, 0, 0); if (len > 0) { - host = (char*)mir_alloc(len + 1); - if (host != nullptr) { - memset(host, '\0', len + 1); - GetDlgItemTextA(hwndDlg, IDC_PINGHOST, host, len + 1); - db_set_s(0, KSMODULENAME, SETTING_PINGHOST, host); - } + ptrA host((char*)mir_alloc(len + 1)); + GetDlgItemTextA(hwndDlg, IDC_PINGHOST, host, len + 1); + db_set_s(0, KSMODULENAME, SETTING_PINGHOST, host); } } + HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST); - memset(&lvItem, 0, sizeof(lvItem)); + LVITEM lvItem; lvItem.mask = LVIF_PARAM; - for (i = 0; i < ListView_GetItemCount(hList); i++) { + for (int i = 0; i < ListView_GetItemCount(hList); i++) { lvItem.iItem = i; lvItem.iSubItem = 0; ListView_GetItem(hList, &lvItem); @@ -196,7 +192,6 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_CANCEL), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)); EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_SETDELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)); EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_DELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY) && IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)); - break; case WM_COMMAND: @@ -210,6 +205,7 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_SETDELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)); EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_DELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY) && IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)); break; + case IDC_LOGINERR_CANCEL: case IDC_LOGINERR_SETDELAY: CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, LOWORD(wParam)); @@ -219,7 +215,12 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, break; case WM_NOTIFY: - if (((LPNMHDR)lParam)->code == PSN_APPLY) { + switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + KSLoadOptions(); + break; + + case PSN_APPLY: db_set_b(0, KSMODULENAME, SETTING_INCREASEEXPONENTIAL, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_INCREASEEXPONENTIAL)); db_set_dw(0, KSMODULENAME, SETTING_MAXDELAY, (DWORD)GetDlgItemInt(hwndDlg, IDC_MAXDELAY, nullptr, FALSE)); db_set_dw(0, KSMODULENAME, SETTING_MAXCONNECTINGTIME, (DWORD)GetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, nullptr, FALSE)); @@ -274,6 +275,7 @@ static INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_LNOTHING, BST_CHECKED); break; } + // right action switch (db_get_b(0, KSMODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CANCEL)) { case POPUP_ACT_CLOSEPOPUP: @@ -289,6 +291,7 @@ static INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_RNOTHING, BST_CHECKED); break; } + // delay EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYCUSTOM), ServiceExists(MS_POPUP_ADDPOPUPT)); EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYFROMPU), ServiceExists(MS_POPUP_ADDPOPUPT)); diff --git a/plugins/StatusManager/src/StartupStatus/ss_options.cpp b/plugins/StatusManager/src/StartupStatus/ss_options.cpp index c3400120bd..af4e8f79c9 100644 --- a/plugins/StatusManager/src/StartupStatus/ss_options.cpp +++ b/plugins/StatusManager/src/StartupStatus/ss_options.cpp @@ -394,16 +394,18 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w break; case WM_NOTIFY: - if (((LPNMHDR)lParam)->code == PSN_APPLY) { - int val; + switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + SSLoadMainOptions(); + break; + case PSN_APPLY: db_set_b(0, SSMODULENAME, SETTING_SETPROFILE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETPROFILE)); if (IsDlgButtonChecked(hwndDlg, IDC_SETPROFILE)) db_set_dw(0, SSMODULENAME, SETTING_SETPROFILEDELAY, GetDlgItemInt(hwndDlg, IDC_SETPROFILEDELAY, nullptr, FALSE)); if (IsDlgButtonChecked(hwndDlg, IDC_SETPROFILE) || IsDlgButtonChecked(hwndDlg, IDC_SHOWDIALOG)) { - val = (int)SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETITEMDATA, - SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0), 0); + int val = (int)SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0), 0); db_set_w(0, SSMODULENAME, SETTING_DEFAULTPROFILE, (WORD)val); } db_set_b(0, SSMODULENAME, SETTING_OVERRIDE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE)); @@ -413,14 +415,12 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w db_set_b(0, SSMODULENAME, SETTING_SETWINSTATE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINSTATE)); if (IsDlgButtonChecked(hwndDlg, IDC_SETWINSTATE)) { - val = (int)SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_GETITEMDATA, - SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_GETCURSEL, 0, 0), 0); + int val = (int)SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_GETCURSEL, 0, 0), 0); db_set_b(0, SSMODULENAME, SETTING_WINSTATE, (BYTE)val); } db_set_b(0, SSMODULENAME, SETTING_SETDOCKED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETDOCKED)); if (IsDlgButtonChecked(hwndDlg, IDC_SETDOCKED)) { - val = (int)SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_GETITEMDATA, - SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_GETCURSEL, 0, 0), 0); + int val = (int)SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_GETCURSEL, 0, 0), 0); db_set_b(0, SSMODULENAME, SETTING_DOCKED, (BYTE)val); } db_set_b(0, SSMODULENAME, SETTING_SETWINLOCATION, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINLOCATION)); @@ -623,6 +623,13 @@ public: lstStatus.OnSelChange = Callback(this, &CSSAdvancedOptDlg::onChange_Status); lstAccount.OnSelChange = Callback(this, &CSSAdvancedOptDlg::onChange_Account); + + m_OnFinishWizard = Callback(this, &CSSAdvancedOptDlg::OnFinishWizard); + } + + void OnFinishWizard(void*) + { + SSLoadMainOptions(); } virtual void OnInitDialog() override @@ -713,8 +720,6 @@ public: // Rebuild status menu if (bNeedRebuildMenu) pcli->pfnReloadProtoMenus(); - - SSLoadMainOptions(); } // add a profile diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index ad7c49b08a..c53cfd235a 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -302,6 +302,19 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM) return 0; } +void Chat_ApplyOptions() +{ + pci->ReloadSettings(); + pci->MM_IconsChanged(); + pci->MM_FontsChanged(); + Chat_UpdateOptions(); + SM_ReconfigureFilters(); + + PluginConfig.reloadSettings(); + CacheMsgLogIcons(); + CacheLogFonts(); +} + static IconItem _icons[] = { { LPGEN("Window Icon"), "chat_window", IDI_CHANMGR }, @@ -422,6 +435,10 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case 0: switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + Chat_ApplyOptions(); + break; + case PSN_APPLY: int iLen; wchar_t *pszText = nullptr; @@ -440,12 +457,6 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM b = M.GetByte(CHAT_MODULE, "Tabs", 1); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, _countof(branch1)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, _countof(branch2)); - - pci->ReloadSettings(); - pci->MM_IconsChanged(); - pci->MM_FontsChanged(); - Chat_UpdateOptions(); - SM_ReconfigureFilters(); return TRUE; } } @@ -804,12 +815,20 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM break; case WM_NOTIFY: - if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) { + if (((LPNMHDR)lParam)->idFrom != 0) + break; + + switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + Chat_ApplyOptions(); + break; + + case PSN_APPLY: char *pszText = nullptr; int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY)); if (iLen > 0) { - wchar_t *pszText1 = (wchar_t*)mir_alloc(iLen*sizeof(wchar_t) + 2); + wchar_t *pszText1 = (wchar_t*)mir_alloc(iLen * sizeof(wchar_t) + 2); GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText1, iLen + 1); db_set_ws(0, CHAT_MODULE, "LogDirectory", pszText1); mir_free(pszText1); @@ -870,14 +889,6 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (pci->hListBkgBrush) DeleteObject(pci->hListBkgBrush); pci->hListBkgBrush = CreateSolidBrush(M.GetDword(CHAT_MODULE, "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR)); - - pci->ReloadSettings(); - pci->MM_FontsChanged(); - Chat_UpdateOptions(); - - PluginConfig.reloadSettings(); - CacheMsgLogIcons(); - CacheLogFonts(); return TRUE; } break; @@ -955,6 +966,10 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lParam) switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + Chat_ApplyOptions(); + break; + case PSN_APPLY: DWORD dwFilterFlags = 0, dwTrayFlags = 0, dwPopupFlags = 0, dwLogFlags = 0; @@ -978,11 +993,6 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lParam) db_set_b(0, CHAT_MODULE, "LogSymbols", lr == 2 ? 1 : 0); db_set_b(0, CHAT_MODULE, "TrayIconInactiveOnly", IsDlgButtonChecked(hwndDlg, IDC_TRAYONLYFORINACTIVE) ? 1 : 0); - - pci->ReloadSettings(); - pci->MM_FontsChanged(); - Chat_UpdateOptions(); - SM_ReconfigureFilters(); return TRUE; } } diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 6ab0d4fb6d..e2caa252ed 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -1371,8 +1371,7 @@ static int OptInitialise(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = DlgProcTabConfig; Options_AddPage(wParam, &odp); - /* group chats */ - + // group chats odp.szGroup.a = LPGEN("Message sessions"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS1); odp.szTitle.a = LPGEN("Group chats"); diff --git a/plugins/TabSRMM/src/muchighlight.cpp b/plugins/TabSRMM/src/muchighlight.cpp index 01390be456..d0744e2dcf 100644 --- a/plugins/TabSRMM/src/muchighlight.cpp +++ b/plugins/TabSRMM/src/muchighlight.cpp @@ -28,6 +28,8 @@ #include "stdafx.h" +void Chat_ApplyOptions(); + void CMUCHighlight::cleanup() { mir_free(m_NickPatternString); @@ -238,8 +240,11 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { + case PSN_WIZFINISH: + Chat_ApplyOptions(); + break; + case PSN_APPLY: - { wchar_t* szBuf = nullptr; int iLen = ::GetWindowTextLength(::GetDlgItem(hwndDlg, IDC_HIGHLIGHTNICKPATTERN)); if (iLen) { @@ -267,8 +272,7 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L db_set_b(0, CHAT_MODULE, "HighlightEnabled", dwFlags); db_set_b(0, CHAT_MODULE, "HighlightMe", ::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTME) ? 1 : 0); g_Settings.Highlight->init(); - } - return TRUE; + return TRUE; } } break; -- cgit v1.2.3