summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-06-14 19:23:29 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-06-14 19:23:29 +0300
commitb0c120d39b13cde7b52a16d0343d8d38c1ce489e (patch)
tree05f32e28eea8ecbd77f0565e80b3e3f859582ad1
parent4c1ad067e0de275f1113aa1ee5368d7b528f0168 (diff)
tabSRMM: chat options -> UI Classes
-rw-r--r--plugins/TabSRMM/src/chat_options.cpp1032
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp37
-rw-r--r--plugins/TabSRMM/src/muchighlight.cpp104
-rw-r--r--plugins/TabSRMM/src/muchighlight.h30
-rw-r--r--plugins/TabSRMM/src/stdafx.h4
-rw-r--r--plugins/TabSRMM/src/version.h2
6 files changed, 573 insertions, 636 deletions
diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp
index ddaeec4e78..24a17cb92a 100644
--- a/plugins/TabSRMM/src/chat_options.cpp
+++ b/plugins/TabSRMM/src/chat_options.cpp
@@ -171,8 +171,6 @@ static branch_t branch2[] = {
{ LPGENW("Scale down icons to 10x10 pixels in the chat log"), "ScaleIcons", 0, 1, nullptr }
};
-static HWND hPathTip = nullptr;
-
void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szMod)
{
char str[32];
@@ -230,90 +228,6 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM
}
}
-static HTREEITEM InsertBranch(HWND hwndTree, wchar_t* pszDescr, BOOL bExpanded)
-{
- TVINSERTSTRUCT tvis;
- tvis.hParent = nullptr;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvis.item.pszText = TranslateW(pszDescr);
- tvis.item.stateMask = TVIS_EXPANDED | TVIS_BOLD;
- tvis.item.state = (bExpanded ? TVIS_EXPANDED : 0) | TVIS_BOLD;
- tvis.item.iImage = tvis.item.iSelectedImage = (bExpanded ? IMG_GRPOPEN : IMG_GRPCLOSED);
- return TreeView_InsertItem(hwndTree, &tvis);
-}
-
-static void FillBranch(HWND hwndTree, HTREEITEM hParent, branch_t *branch, int nValues, DWORD defaultval)
-{
- if (hParent == nullptr)
- return;
-
- TVINSERTSTRUCT tvis = {};
-
- for (int i = 0; i < nValues; i++) {
- tvis.hParent = hParent;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvis.item.pszText = TranslateW(branch[i].szDescr);
- if (branch[i].iMode)
- tvis.item.iImage = tvis.item.iSelectedImage = ((((M.GetDword(CHAT_MODULE, branch[i].szDBName, defaultval) & branch[i].iMode) & branch[i].iMode) != 0) ? IMG_CHECK : IMG_NOCHECK);
- else
- tvis.item.iImage = tvis.item.iSelectedImage = ((M.GetByte(CHAT_MODULE, branch[i].szDBName, branch[i].bDefault) != 0) ? IMG_CHECK : IMG_NOCHECK);
- branch[i].hItem = TreeView_InsertItem(hwndTree, &tvis);
- }
-}
-
-static void SaveBranch(HWND hwndTree, branch_t *branch, int nValues)
-{
- TVITEM tvi = { 0 };
- BYTE bChecked;
- DWORD iState = 0;
-
- for (int i = 0; i < nValues; i++) {
- tvi.mask = TVIF_HANDLE | TVIF_IMAGE;
- tvi.hItem = branch[i].hItem;
- TreeView_GetItem(hwndTree, &tvi);
- bChecked = ((tvi.iImage == IMG_CHECK) ? 1 : 0);
- if (branch[i].iMode) {
- if (bChecked)
- iState |= branch[i].iMode;
- if (iState & GC_EVENT_ADDSTATUS)
- iState |= GC_EVENT_REMOVESTATUS;
- db_set_dw(0, CHAT_MODULE, branch[i].szDBName, iState);
- }
- else db_set_b(0, CHAT_MODULE, branch[i].szDBName, bChecked);
- }
-}
-
-static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM)
-{
- char szDir[MAX_PATH];
- switch (uMsg) {
- case BFFM_INITIALIZED:
- SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)M.getUserDir());
- break;
-
- case BFFM_SELCHANGED:
- if (SHGetPathFromIDListA((LPITEMIDLIST)lp, szDir))
- SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir);
- break;
- }
- return 0;
-}
-
-void Chat_ApplyOptions()
-{
- g_chatApi.ReloadSettings();
- g_chatApi.MM_IconsChanged();
- g_chatApi.MM_FontsChanged();
- Chat_UpdateOptions();
- SM_ReconfigureFilters();
-
- PluginConfig.reloadSettings();
- CacheMsgLogIcons();
- CacheLogFonts();
-}
-
static IconItem _icons[] =
{
{ LPGEN("Window Icon"), "chat_window", IDI_CHANMGR },
@@ -361,115 +275,7 @@ HICON LoadIconEx(char *pszIcoLibName)
return IcoLib_GetIcon(szTemp);
}
-#define OPT_FIXHEADINGS (WM_USER+1)
-
-static UINT _o1controls[] = { IDC_CHECKBOXES, IDC_GROUP, IDC_STATIC_ADD };
-
-HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle)
-{
- HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST,
- TOOLTIPS_CLASS, nullptr,
- WS_POPUP | TTS_NOPREFIX,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- hwndParent, nullptr, g_plugin.getInst(), nullptr);
-
- SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
-
- TOOLINFO ti = { 0 };
- ti.cbSize = sizeof(TOOLINFO);
- ti.uFlags = TTF_SUBCLASS | TTF_CENTERTIP;
- ti.hwnd = hwndParent;
- ti.hinst = g_plugin.getInst();
- ti.lpszText = ptszText;
- GetClientRect(hwndParent, &ti.rect);
- ti.rect.left = -65;
-
- SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)&ti);
- SendMessage(hwndTT, TTM_SETTITLE, 1, (LPARAM)ptszTitle);
- SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, (LPARAM)640);
- return hwndTT;
-}
-
-INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- static HTREEITEM hListHeading1 = nullptr;
- static HTREEITEM hListHeading2 = nullptr;
-
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE) | (TVS_NOHSCROLL));
- /* Replace image list, destroy old. */
- ImageList_Destroy(TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_CHECKBOXES), CreateStateImageList(), TVSIL_NORMAL));
-
- hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), TranslateT("Appearance and functionality of chat room windows"), TRUE);
- hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), TranslateT("Appearance of the message log"), TRUE);
-
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, _countof(branch1), 0x0000);
- FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, _countof(branch2), 0x0000);
-
- ptrW pszGroup(db_get_wsa(0, CHAT_MODULE, "AddToGroup"));
- SetDlgItemText(hwndDlg, IDC_GROUP, (pszGroup != nullptr) ? pszGroup : TranslateT("Chat rooms"));
- }
- break;
-
- case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_GROUP) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
-
- if (lParam != 0)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_CHECKBOXES:
- return TreeViewHandleClick(hwndDlg, ((LPNMHDR)lParam)->hwndFrom, wParam, lParam);
- break;
-
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_WIZFINISH:
- Chat_ApplyOptions();
- break;
-
- case PSN_APPLY:
- int iLen;
- wchar_t *pszText = nullptr;
- BYTE b;
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP));
- if (iLen > 0) {
- pszText = (wchar_t*)mir_realloc(pszText, (iLen + 2) * sizeof(wchar_t));
- GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1);
- db_set_ws(0, CHAT_MODULE, "AddToGroup", pszText);
- }
- else db_set_ws(0, CHAT_MODULE, "AddToGroup", L"");
-
- mir_free(pszText);
-
- b = M.GetByte(CHAT_MODULE, "Tabs", 1);
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, _countof(branch1));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, _countof(branch2));
- return TRUE;
- }
- }
- break;
-
- case WM_DESTROY:
- BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0;
- db_set_b(0, CHAT_MODULE, "Branch1Exp", b);
- b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0;
- db_set_b(0, CHAT_MODULE, "Branch2Exp", b);
- TreeViewDestroy(GetDlgItem(hwndDlg, IDC_CHECKBOXES));
- }
- return FALSE;
-}
-
-static wchar_t* chatcolorsnames[] =
+static wchar_t *chatcolorsnames[] =
{
LPGENW("Voiced"),
LPGENW("Half operators"),
@@ -651,260 +457,444 @@ int FontServiceFontsChanged(WPARAM, LPARAM)
return 0;
}
-static UINT _o2chatcontrols[] =
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM)
+{
+ char szDir[MAX_PATH];
+ switch (uMsg) {
+ case BFFM_INITIALIZED:
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)M.getUserDir());
+ break;
+
+ case BFFM_SELCHANGED:
+ if (SHGetPathFromIDListA((LPITEMIDLIST)lp, szDir))
+ SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir);
+ break;
+ }
+ return 0;
+}
+
+static HWND CreateToolTip(HWND hwndParent, LPCWSTR ptszText, LPCTSTR ptszTitle)
+{
+ HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST,
+ TOOLTIPS_CLASS, nullptr,
+ WS_POPUP | TTS_NOPREFIX,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ hwndParent, nullptr, g_plugin.getInst(), nullptr);
+
+ SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+ TOOLINFO ti = { 0 };
+ ti.cbSize = sizeof(TOOLINFO);
+ ti.uFlags = TTF_SUBCLASS | TTF_CENTERTIP;
+ ti.hwnd = hwndParent;
+ ti.hinst = g_plugin.getInst();
+ ti.lpszText = (LPWSTR)ptszText;
+ GetClientRect(hwndParent, &ti.rect);
+ ti.rect.left = -65;
+
+ SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)&ti);
+ SendMessage(hwndTT, TTM_SETTITLE, 1, (LPARAM)ptszTitle);
+ SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, (LPARAM)640);
+ return hwndTT;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// base class for chat options
+
+class CChatBaseOptionDlg : public CDlgBase
{
- IDC_CHAT_SPIN2, IDC_LIMIT, IDC_CHAT_SPIN4, IDC_LOGTIMESTAMP, IDC_TIMESTAMP,
- IDC_OUTSTAMP, IDC_FONTCHOOSE, IDC_LOGGING, IDC_LOGDIRECTORY, IDC_INSTAMP, IDC_CHAT_SPIN2, IDC_CHAT_SPIN3, IDC_NICKROW2, IDC_LOGLIMIT,
- IDC_STATIC110, IDC_STATIC112, 0
+
+protected:
+ CChatBaseOptionDlg(int iDlg) :
+ CDlgBase(g_plugin, iDlg)
+ {
+ m_OnFinishWizard = Callback(this, &CChatBaseOptionDlg::onFinalOptions);
+ }
+
+ void onFinalOptions(void*)
+ {
+ g_chatApi.ReloadSettings();
+ g_chatApi.MM_IconsChanged();
+ g_chatApi.MM_FontsChanged();
+ Chat_UpdateOptions();
+ SM_ReconfigureFilters();
+
+ PluginConfig.reloadSettings();
+ CacheMsgLogIcons();
+ CacheLogFonts();
+ }
};
-static UINT _o3chatcontrols[] = { 0 };
+/////////////////////////////////////////////////////////////////////////////////////////
+// Group chat - Settings
-INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+class CChatSettingsDlg : public CChatBaseOptionDlg
{
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(0, CHAT_MODULE, "LogLimit", 100), 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETRANGE, 0, MAKELONG(255, 10));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(M.GetByte(CHAT_MODULE, "NicklistRowDist", 12), 0));
- SetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, g_Settings.pszTimeStampLog);
- SetDlgItemText(hwndDlg, IDC_TIMESTAMP, g_Settings.pszTimeStamp);
- SetDlgItemText(hwndDlg, IDC_OUTSTAMP, g_Settings.pszOutgoingNick);
- SetDlgItemText(hwndDlg, IDC_INSTAMP, g_Settings.pszIncomingNick);
- CheckDlgButton(hwndDlg, IDC_LOGGING, g_Settings.bLoggingEnabled ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, g_Settings.pszLogDir);
- Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, g_Settings.bLoggingEnabled);
- Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, g_Settings.bLoggingEnabled);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETRANGE, 0, MAKELONG(10000, 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(0, CHAT_MODULE, "LoggingLimit", 100), 0));
- Utils::enableDlgControl(hwndDlg, IDC_LIMIT, g_Settings.bLoggingEnabled);
-
- wchar_t tszTooltipText[2048];
-
- mir_snwprintf(tszTooltipText,
- L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n"
- L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n"
- L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
- // contact vars
- L"%nick%", TranslateT("nick of current contact (if defined)"),
- L"%proto%", TranslateT("protocol name of current contact (if defined). Account name is used when protocol supports multiple accounts"),
- L"%accountname%", TranslateT("user-defined account name of current contact (if defined)."),
- L"%userid%", TranslateT("user ID of current contact (if defined). It is like UIN for ICQ, JID for Jabber, etc."),
- // global vars
- L"%miranda_path%", TranslateT("path to Miranda root folder"),
- L"%miranda_profilesdir%", TranslateT("path to folder containing Miranda profiles"),
- L"%miranda_profilename%", TranslateT("name of current Miranda profile (filename, without extension)"),
- L"%miranda_userdata%", TranslateT("will return parsed string %miranda_profilesdir%\\%miranda_profilename%"),
- L"%miranda_logpath%", TranslateT("will return parsed string %miranda_userdata%\\Logs"),
- L"%appdata%", TranslateT("same as environment variable %APPDATA% for currently logged-on Windows user"),
- L"%username%", TranslateT("username for currently logged-on Windows user"),
- L"%mydocuments%", TranslateT("\"My Documents\" folder for currently logged-on Windows user"),
- L"%desktop%", TranslateT("\"Desktop\" folder for currently logged-on Windows user"),
- L"%xxxxxxx%", TranslateT("any environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)"),
- // date/time vars
- L"%d%", TranslateT("day of month, 1-31"),
- L"%dd%", TranslateT("day of month, 01-31"),
- L"%m%", TranslateT("month number, 1-12"),
- L"%mm%", TranslateT("month number, 01-12"),
- L"%mon%", TranslateT("abbreviated month name"),
- L"%month%", TranslateT("full month name"),
- L"%yy%", TranslateT("year without century, 01-99"),
- L"%yyyy%", TranslateT("year with century, 1901-9999"),
- L"%wday%", TranslateT("abbreviated weekday name"),
- L"%weekday%", TranslateT("full weekday name"));
- hPathTip = CreateToolTip(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), tszTooltipText, TranslateT("Variables"));
+ HTREEITEM hListHeading1 = nullptr;
+ HTREEITEM hListHeading2 = nullptr;
+
+ CCtrlTreeView treeCheck;
+
+ HTREEITEM InsertBranch(wchar_t* pszDescr, BOOL bExpanded)
+ {
+ TVINSERTSTRUCT tvis;
+ tvis.hParent = nullptr;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ tvis.item.pszText = TranslateW(pszDescr);
+ tvis.item.stateMask = TVIS_EXPANDED | TVIS_BOLD;
+ tvis.item.state = (bExpanded ? TVIS_EXPANDED : 0) | TVIS_BOLD;
+ tvis.item.iImage = tvis.item.iSelectedImage = (bExpanded ? IMG_GRPOPEN : IMG_GRPCLOSED);
+ return treeCheck.InsertItem(&tvis);
+ }
+
+ void FillBranch(HTREEITEM hParent, branch_t *branch, size_t nValues, DWORD defaultval)
+ {
+ if (hParent == nullptr)
+ return;
+
+ TVINSERTSTRUCT tvis = {};
+
+ for (int i = 0; i < nValues; i++) {
+ tvis.hParent = hParent;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ tvis.item.pszText = TranslateW(branch[i].szDescr);
+ if (branch[i].iMode)
+ tvis.item.iImage = tvis.item.iSelectedImage = ((((M.GetDword(CHAT_MODULE, branch[i].szDBName, defaultval) & branch[i].iMode) & branch[i].iMode) != 0) ? IMG_CHECK : IMG_NOCHECK);
+ else
+ tvis.item.iImage = tvis.item.iSelectedImage = ((M.GetByte(CHAT_MODULE, branch[i].szDBName, branch[i].bDefault) != 0) ? IMG_CHECK : IMG_NOCHECK);
+ branch[i].hItem = treeCheck.InsertItem(&tvis);
}
- if (hPathTip)
- SetTimer(hwndDlg, 0, 3000, nullptr);
- break;
+ }
- case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_INSTAMP
- || LOWORD(wParam) == IDC_OUTSTAMP
- || LOWORD(wParam) == IDC_TIMESTAMP
- || LOWORD(wParam) == IDC_LOGLIMIT
- || LOWORD(wParam) == IDC_NICKROW2
- || LOWORD(wParam) == IDC_LOGDIRECTORY
- || LOWORD(wParam) == IDC_LIMIT
- || LOWORD(wParam) == IDC_LOGTIMESTAMP)
- && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
-
- // open the base directory for MUC logs, using a standard file selector
- // dialog. Simply allows the user to view what log files are there
- // and possibly delete archived logs.
- switch (LOWORD(wParam)) {
- case IDC_MUC_OPENLOGBASEDIR:
- {
- wchar_t tszTemp[MAX_PATH + 20];
- wcsncpy_s(tszTemp, g_Settings.pszLogDir, _TRUNCATE);
-
- wchar_t *p = tszTemp;
- while (*p && (*p == '\\' || *p == '.'))
- p++;
-
- if (*p)
- if (wchar_t *p1 = wcschr(p, '\\'))
- *p1 = 0;
-
- wchar_t tszInitialDir[_MAX_DRIVE + _MAX_PATH + 10];
- mir_snwprintf(tszInitialDir, L"%s%s", M.getChatLogPath(), p);
- if (!PathFileExists(tszInitialDir))
- wcsncpy_s(tszInitialDir, M.getChatLogPath(), _TRUNCATE);
-
- wchar_t tszReturnName[MAX_PATH]; tszReturnName[0] = 0;
- mir_snwprintf(tszTemp, L"%s%c*.*%c%c", TranslateT("All files"), 0, 0, 0);
-
- OPENFILENAME ofn = { 0 };
- ofn.lpstrInitialDir = tszInitialDir;
- ofn.lpstrFilter = tszTemp;
- ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- ofn.lpstrFile = tszReturnName;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
- ofn.lpstrDefExt = L"log";
- GetOpenFileName(&ofn);
+ void SaveBranch(branch_t *branch, int nValues)
+ {
+ TVITEMEX tvi = { 0 };
+ BYTE bChecked;
+ DWORD iState = 0;
+
+ for (int i = 0; i < nValues; i++) {
+ tvi.mask = TVIF_HANDLE | TVIF_IMAGE;
+ tvi.hItem = branch[i].hItem;
+ treeCheck.GetItem(&tvi);
+ bChecked = ((tvi.iImage == IMG_CHECK) ? 1 : 0);
+ if (branch[i].iMode) {
+ if (bChecked)
+ iState |= branch[i].iMode;
+ if (iState & GC_EVENT_ADDSTATUS)
+ iState |= GC_EVENT_REMOVESTATUS;
+ db_set_dw(0, CHAT_MODULE, branch[i].szDBName, iState);
}
- break;
+ else db_set_b(0, CHAT_MODULE, branch[i].szDBName, bChecked);
+ }
+ }
- case IDC_FONTCHOOSE:
- {
- wchar_t tszDirectory[MAX_PATH];
- LPMALLOC psMalloc;
-
- if (SUCCEEDED(CoGetMalloc(1, &psMalloc))) {
- BROWSEINFO bi = {};
- bi.hwndOwner = hwndDlg;
- bi.pszDisplayName = tszDirectory;
- bi.lpszTitle = TranslateT("Select folder");
- bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
- bi.lpfn = BrowseCallbackProc;
- bi.lParam = (LPARAM)tszDirectory;
-
- LPITEMIDLIST idList = SHBrowseForFolder(&bi);
- if (idList) {
- const wchar_t *szUserDir = M.getUserDir();
- SHGetPathFromIDList(idList, tszDirectory);
- mir_wstrcat(tszDirectory, L"\\");
-
- wchar_t tszTemp[MAX_PATH];
- PathToRelativeW(tszDirectory, tszTemp, szUserDir);
- SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_wstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
- }
- psMalloc->Free(idList);
- psMalloc->Release();
- }
- }
- break;
+public:
+ CChatSettingsDlg() :
+ CChatBaseOptionDlg(IDD_OPTIONS1),
+ treeCheck(this, IDC_CHECKBOXES)
+ {}
- case IDC_LOGGING:
- Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
- Utils::enableDlgControl(hwndDlg, IDC_LIMIT, IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED ? TRUE : FALSE);
- break;
+ void OnInitDialog() override
+ {
+ SetWindowLongPtr(treeCheck.GetHwnd(), GWL_STYLE, GetWindowLongPtr(treeCheck.GetHwnd(), GWL_STYLE) | (TVS_NOHSCROLL));
+
+ // Replace image list
+ treeCheck.SetImageList(CreateStateImageList(), TVSIL_NORMAL);
+
+ hListHeading1 = InsertBranch(TranslateT("Appearance and functionality of chat room windows"), TRUE);
+ hListHeading2 = InsertBranch(TranslateT("Appearance of the message log"), TRUE);
+
+ FillBranch(hListHeading1, branch1, _countof(branch1), 0x0000);
+ FillBranch(hListHeading2, branch2, _countof(branch2), 0x0000);
+
+ ptrW pszGroup(db_get_wsa(0, CHAT_MODULE, "AddToGroup"));
+ SetDlgItemText(m_hwnd, IDC_GROUP, (pszGroup != nullptr) ? pszGroup : TranslateT("Chat rooms"));
+ }
+
+ void OnApply() override
+ {
+ int iLen = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_GROUP));
+ if (iLen > 0) {
+ wchar_t *pszText = (wchar_t*)mir_alloc((iLen + 2) * sizeof(wchar_t));
+ GetDlgItemText(m_hwnd, IDC_GROUP, pszText, iLen + 1);
+ db_set_ws(0, CHAT_MODULE, "AddToGroup", pszText);
+ mir_free(pszText);
}
+ else db_set_ws(0, CHAT_MODULE, "AddToGroup", L"");
- if (lParam != 0)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+ SaveBranch(branch1, _countof(branch1));
+ SaveBranch(branch2, _countof(branch2));
+ }
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom != 0)
- break;
+ void OnDestroy() override
+ {
+ BYTE b = treeCheck.GetItemState(hListHeading1, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0;
+ db_set_b(0, CHAT_MODULE, "Branch1Exp", b);
- switch (((LPNMHDR)lParam)->code) {
- case PSN_WIZFINISH:
- Chat_ApplyOptions();
- break;
+ b = treeCheck.GetItemState(hListHeading2, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0;
+ db_set_b(0, CHAT_MODULE, "Branch2Exp", b);
- 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);
- GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText1, iLen + 1);
- db_set_ws(0, CHAT_MODULE, "LogDirectory", pszText1);
- mir_free(pszText1);
- g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED;
- db_set_b(0, CHAT_MODULE, "LoggingEnabled", g_Settings.bLoggingEnabled);
- }
- else {
- db_unset(0, CHAT_MODULE, "LogDirectory");
- db_set_b(0, CHAT_MODULE, "LoggingEnabled", 0);
- }
- g_chatApi.SM_InvalidateLogDirectories();
+ TreeViewDestroy(treeCheck.GetHwnd());
+ }
- iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_GETPOS, 0, 0);
- db_set_w(0, CHAT_MODULE, "LoggingLimit", (WORD)iLen);
+ virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
+ {
+ if (msg == WM_NOTIFY && ((LPNMHDR)lParam)->idFrom == IDC_CHECKBOXES)
+ return TreeViewHandleClick(m_hwnd, ((LPNMHDR)lParam)->hwndFrom, wParam, lParam);
- iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0);
- if (iLen > 0)
- db_set_b(0, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen);
- else
- db_unset(0, CHAT_MODULE, "NicklistRowDist");
+ return CDlgBase::DlgProc(msg, wParam, lParam);
+ }
+};
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP));
- if (iLen > 0) {
- pszText = (char *)mir_realloc(pszText, iLen + 1);
- GetDlgItemTextA(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1);
- db_set_s(0, CHAT_MODULE, "LogTimestamp", pszText);
- }
- else db_unset(0, CHAT_MODULE, "LogTimestamp");
+/////////////////////////////////////////////////////////////////////////////////////////
+// Group chat - Log
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP));
- if (iLen > 0) {
- pszText = (char *)mir_realloc(pszText, iLen + 1);
- GetDlgItemTextA(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1);
- db_set_s(0, CHAT_MODULE, "HeaderTime", pszText);
- }
- else db_unset(0, CHAT_MODULE, "HeaderTime");
+class CChatLogOptionDlg : public CChatBaseOptionDlg
+{
+ CTimer m_timer;
+ CCtrlButton btnBaseDir, btnFontChoose;
+ CCtrlCheck chkLogging;
+ HWND hPathTip = nullptr;
+
+public:
+ CChatLogOptionDlg() :
+ CChatBaseOptionDlg(IDD_OPTIONS2),
+ m_timer(this, 1),
+ btnBaseDir(this, IDC_MUC_OPENLOGBASEDIR),
+ chkLogging(this, IDC_LOGGING),
+ btnFontChoose(this, IDC_FONTCHOOSE)
+ {
+ btnBaseDir.OnClick = Callback(this, &CChatLogOptionDlg::onClick_BaseDir);
+ btnFontChoose.OnClick = Callback(this, &CChatLogOptionDlg::onClick_FontChoose);
+
+ chkLogging.OnChange = Callback(this, &CChatLogOptionDlg::onChange_Logging);
+
+ m_timer.OnEvent = Callback(this, &CChatLogOptionDlg::onTimer);
+ }
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP));
- if (iLen > 0) {
- pszText = (char *)mir_realloc(pszText, iLen + 1);
- GetDlgItemTextA(hwndDlg, IDC_INSTAMP, pszText, iLen + 1);
- db_set_s(0, CHAT_MODULE, "HeaderIncoming", pszText);
- }
- else db_unset(0, CHAT_MODULE, "HeaderIncoming");
+ void OnInitDialog() override
+ {
+ SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0));
+ SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(0, CHAT_MODULE, "LogLimit", 100), 0));
+ SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN3, UDM_SETRANGE, 0, MAKELONG(255, 10));
+ SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(M.GetByte(CHAT_MODULE, "NicklistRowDist", 12), 0));
+ SetDlgItemText(m_hwnd, IDC_LOGTIMESTAMP, g_Settings.pszTimeStampLog);
+ SetDlgItemText(m_hwnd, IDC_TIMESTAMP, g_Settings.pszTimeStamp);
+ SetDlgItemText(m_hwnd, IDC_OUTSTAMP, g_Settings.pszOutgoingNick);
+ SetDlgItemText(m_hwnd, IDC_INSTAMP, g_Settings.pszIncomingNick);
+ CheckDlgButton(m_hwnd, IDC_LOGGING, g_Settings.bLoggingEnabled ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemText(m_hwnd, IDC_LOGDIRECTORY, g_Settings.pszLogDir);
+ Utils::enableDlgControl(m_hwnd, IDC_LOGDIRECTORY, g_Settings.bLoggingEnabled);
+ Utils::enableDlgControl(m_hwnd, IDC_FONTCHOOSE, g_Settings.bLoggingEnabled);
+ SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN4, UDM_SETRANGE, 0, MAKELONG(10000, 0));
+ SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(0, CHAT_MODULE, "LoggingLimit", 100), 0));
+ Utils::enableDlgControl(m_hwnd, IDC_LIMIT, g_Settings.bLoggingEnabled);
+
+ CMStringW tszTooltipText(FORMAT,
+ L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n"
+ L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n\n"
+ L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
+ // contact vars
+ L"%nick%", TranslateT("nick of current contact (if defined)"),
+ L"%proto%", TranslateT("protocol name of current contact (if defined). Account name is used when protocol supports multiple accounts"),
+ L"%accountname%", TranslateT("user-defined account name of current contact (if defined)."),
+ L"%userid%", TranslateT("user ID of current contact (if defined). It is like UIN for ICQ, JID for Jabber, etc."),
+ // global vars
+ L"%miranda_path%", TranslateT("path to Miranda root folder"),
+ L"%miranda_profilesdir%", TranslateT("path to folder containing Miranda profiles"),
+ L"%miranda_profilename%", TranslateT("name of current Miranda profile (filename, without extension)"),
+ L"%miranda_userdata%", TranslateT("will return parsed string %miranda_profilesdir%\\%miranda_profilename%"),
+ L"%miranda_logpath%", TranslateT("will return parsed string %miranda_userdata%\\Logs"),
+ L"%appdata%", TranslateT("same as environment variable %APPDATA% for currently logged-on Windows user"),
+ L"%username%", TranslateT("username for currently logged-on Windows user"),
+ L"%mydocuments%", TranslateT("\"My Documents\" folder for currently logged-on Windows user"),
+ L"%desktop%", TranslateT("\"Desktop\" folder for currently logged-on Windows user"),
+ L"%xxxxxxx%", TranslateT("any environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)"),
+ // date/time vars
+ L"%d%", TranslateT("day of month, 1-31"),
+ L"%dd%", TranslateT("day of month, 01-31"),
+ L"%m%", TranslateT("month number, 1-12"),
+ L"%mm%", TranslateT("month number, 01-12"),
+ L"%mon%", TranslateT("abbreviated month name"),
+ L"%month%", TranslateT("full month name"),
+ L"%yy%", TranslateT("year without century, 01-99"),
+ L"%yyyy%", TranslateT("year with century, 1901-9999"),
+ L"%wday%", TranslateT("abbreviated weekday name"),
+ L"%weekday%", TranslateT("full weekday name"));
+
+ hPathTip = CreateToolTip(GetDlgItem(m_hwnd, IDC_LOGDIRECTORY), tszTooltipText, TranslateT("Variables"));
+ if (hPathTip)
+ m_timer.Start(3000);
+ }
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP));
- if (iLen > 0) {
- pszText = (char *)mir_realloc(pszText, iLen + 1);
- GetDlgItemTextA(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1);
- db_set_s(0, CHAT_MODULE, "HeaderOutgoing", pszText);
- }
- else db_unset(0, CHAT_MODULE, "HeaderOutgoing");
+ void OnApply() override
+ {
+ char *pszText = nullptr;
+
+ int iLen = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_LOGDIRECTORY));
+ if (iLen > 0) {
+ wchar_t *pszText1 = (wchar_t*)mir_alloc(iLen * sizeof(wchar_t) + 2);
+ GetDlgItemText(m_hwnd, IDC_LOGDIRECTORY, pszText1, iLen + 1);
+ db_set_ws(0, CHAT_MODULE, "LogDirectory", pszText1);
+ mir_free(pszText1);
+ g_Settings.bLoggingEnabled = IsDlgButtonChecked(m_hwnd, IDC_LOGGING) == BST_CHECKED;
+ db_set_b(0, CHAT_MODULE, "LoggingEnabled", g_Settings.bLoggingEnabled);
+ }
+ else {
+ db_unset(0, CHAT_MODULE, "LogDirectory");
+ db_set_b(0, CHAT_MODULE, "LoggingEnabled", 0);
+ }
+ g_chatApi.SM_InvalidateLogDirectories();
- iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
- db_set_w(0, CHAT_MODULE, "LogLimit", (WORD)iLen);
- mir_free(pszText);
+ iLen = SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN4, UDM_GETPOS, 0, 0);
+ db_set_w(0, CHAT_MODULE, "LoggingLimit", (WORD)iLen);
- if (g_chatApi.hListBkgBrush)
- DeleteObject(g_chatApi.hListBkgBrush);
- g_chatApi.hListBkgBrush = CreateSolidBrush(M.GetDword(CHAT_MODULE, "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));
- return TRUE;
+ iLen = SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0);
+ if (iLen > 0)
+ db_set_b(0, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen);
+ else
+ db_unset(0, CHAT_MODULE, "NicklistRowDist");
+
+ iLen = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_LOGTIMESTAMP));
+ if (iLen > 0) {
+ pszText = (char *)mir_realloc(pszText, iLen + 1);
+ GetDlgItemTextA(m_hwnd, IDC_LOGTIMESTAMP, pszText, iLen + 1);
+ db_set_s(0, CHAT_MODULE, "LogTimestamp", pszText);
}
- break;
+ else db_unset(0, CHAT_MODULE, "LogTimestamp");
- case WM_TIMER:
- if (IsWindow(hPathTip))
- KillTimer(hPathTip, 4); // It will prevent tooltip autoclosing
- break;
+ iLen = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_TIMESTAMP));
+ if (iLen > 0) {
+ pszText = (char *)mir_realloc(pszText, iLen + 1);
+ GetDlgItemTextA(m_hwnd, IDC_TIMESTAMP, pszText, iLen + 1);
+ db_set_s(0, CHAT_MODULE, "HeaderTime", pszText);
+ }
+ else db_unset(0, CHAT_MODULE, "HeaderTime");
+
+ iLen = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_INSTAMP));
+ if (iLen > 0) {
+ pszText = (char *)mir_realloc(pszText, iLen + 1);
+ GetDlgItemTextA(m_hwnd, IDC_INSTAMP, pszText, iLen + 1);
+ db_set_s(0, CHAT_MODULE, "HeaderIncoming", pszText);
+ }
+ else db_unset(0, CHAT_MODULE, "HeaderIncoming");
- case WM_DESTROY:
+ iLen = GetWindowTextLength(GetDlgItem(m_hwnd, IDC_OUTSTAMP));
+ if (iLen > 0) {
+ pszText = (char *)mir_realloc(pszText, iLen + 1);
+ GetDlgItemTextA(m_hwnd, IDC_OUTSTAMP, pszText, iLen + 1);
+ db_set_s(0, CHAT_MODULE, "HeaderOutgoing", pszText);
+ }
+ else db_unset(0, CHAT_MODULE, "HeaderOutgoing");
+
+ iLen = SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
+ db_set_w(0, CHAT_MODULE, "LogLimit", (WORD)iLen);
+ mir_free(pszText);
+
+ if (g_chatApi.hListBkgBrush)
+ DeleteObject(g_chatApi.hListBkgBrush);
+ g_chatApi.hListBkgBrush = CreateSolidBrush(M.GetDword(CHAT_MODULE, "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));
+ }
+
+ void OnDestroy() override
+ {
if (hPathTip) {
- KillTimer(hwndDlg, 0);
+ KillTimer(m_hwnd, 0);
DestroyWindow(hPathTip);
hPathTip = nullptr;
}
- break;
}
- return FALSE;
-}
+
+ // open the base directory for MUC logs, using a standard file selector
+ // dialog. Simply allows the user to view what log files are there
+ // and possibly delete archived logs.
+
+ void onClick_BaseDir(CCtrlButton*)
+ {
+ wchar_t tszTemp[MAX_PATH + 20];
+ wcsncpy_s(tszTemp, g_Settings.pszLogDir, _TRUNCATE);
+
+ wchar_t *p = tszTemp;
+ while (*p && (*p == '\\' || *p == '.'))
+ p++;
+
+ if (*p)
+ if (wchar_t *p1 = wcschr(p, '\\'))
+ *p1 = 0;
+
+ wchar_t tszInitialDir[_MAX_DRIVE + _MAX_PATH + 10];
+ mir_snwprintf(tszInitialDir, L"%s%s", M.getChatLogPath(), p);
+ if (!PathFileExists(tszInitialDir))
+ wcsncpy_s(tszInitialDir, M.getChatLogPath(), _TRUNCATE);
+
+ wchar_t tszReturnName[MAX_PATH]; tszReturnName[0] = 0;
+ mir_snwprintf(tszTemp, L"%s%c*.*%c%c", TranslateT("All files"), 0, 0, 0);
+
+ OPENFILENAME ofn = { 0 };
+ ofn.lpstrInitialDir = tszInitialDir;
+ ofn.lpstrFilter = tszTemp;
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ ofn.lpstrFile = tszReturnName;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.Flags = OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
+ ofn.lpstrDefExt = L"log";
+ GetOpenFileName(&ofn);
+ }
+
+ void onClick_FontChoose(CCtrlButton*)
+ {
+ wchar_t tszDirectory[MAX_PATH];
+
+ LPMALLOC psMalloc;
+ if (FAILED(CoGetMalloc(1, &psMalloc)))
+ return;
+
+ BROWSEINFO bi = {};
+ bi.hwndOwner = m_hwnd;
+ bi.pszDisplayName = tszDirectory;
+ bi.lpszTitle = TranslateT("Select folder");
+ bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
+ bi.lpfn = BrowseCallbackProc;
+ bi.lParam = (LPARAM)tszDirectory;
+
+ LPITEMIDLIST idList = SHBrowseForFolder(&bi);
+ if (idList) {
+ const wchar_t *szUserDir = M.getUserDir();
+ SHGetPathFromIDList(idList, tszDirectory);
+ mir_wstrcat(tszDirectory, L"\\");
+
+ wchar_t tszTemp[MAX_PATH];
+ PathToRelativeW(tszDirectory, tszTemp, szUserDir);
+ SetDlgItemText(m_hwnd, IDC_LOGDIRECTORY, mir_wstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
+ }
+ psMalloc->Free(idList);
+ psMalloc->Release();
+ }
+
+ void onChange_Logging(CCtrlCheck*)
+ {
+ bool bChecked = chkLogging.GetState();
+ Utils::enableDlgControl(m_hwnd, IDC_LOGDIRECTORY, bChecked);
+ Utils::enableDlgControl(m_hwnd, IDC_FONTCHOOSE, bChecked);
+ Utils::enableDlgControl(m_hwnd, IDC_LIMIT, bChecked);
+ }
+
+ void onTimer(CTimer*)
+ {
+ if (IsWindow(hPathTip))
+ KillTimer(hPathTip, 4); // It will prevent tooltip autoclosing
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Group chat - Events
#define NR_GC_EVENTS 12
@@ -924,76 +914,158 @@ static UINT _eventorder[] =
GC_EVENT_HIGHLIGHT
};
-// Dialog procedure for group chat options tab #3 (event filter configuration)
-INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lParam)
+class CChatEventOptionDlg : public CChatBaseOptionDlg
{
- switch (uMsg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- DWORD dwFilterFlags = M.GetDword(CHAT_MODULE, "FilterFlags", GC_EVENT_ALL);
- DWORD dwTrayFlags = M.GetDword(CHAT_MODULE, "TrayIconFlags", GC_EVENT_HIGHLIGHT);
- DWORD dwPopupFlags = M.GetDword(CHAT_MODULE, "PopupFlags", GC_EVENT_HIGHLIGHT);
- DWORD dwLogFlags = M.GetDword(CHAT_MODULE, "DiskLogFlags", GC_EVENT_ALL);
-
- for (int i = 0; i < _countof(_eventorder); i++) {
- if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
- CheckDlgButton(hwndDlg, IDC_1 + i, dwFilterFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_L1 + i, dwLogFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
- }
- CheckDlgButton(hwndDlg, IDC_P1 + i, dwPopupFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_T1 + i, dwTrayFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
+
+public:
+ CChatEventOptionDlg() :
+ CChatBaseOptionDlg(IDD_OPTIONS3)
+ {}
+
+ void OnInitDialog() override
+ {
+ DWORD dwFilterFlags = M.GetDword(CHAT_MODULE, "FilterFlags", GC_EVENT_ALL);
+ DWORD dwTrayFlags = M.GetDword(CHAT_MODULE, "TrayIconFlags", GC_EVENT_HIGHLIGHT);
+ DWORD dwPopupFlags = M.GetDword(CHAT_MODULE, "PopupFlags", GC_EVENT_HIGHLIGHT);
+ DWORD dwLogFlags = M.GetDword(CHAT_MODULE, "DiskLogFlags", GC_EVENT_ALL);
+
+ for (int i = 0; i < _countof(_eventorder); i++) {
+ if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
+ CheckDlgButton(m_hwnd, IDC_1 + i, dwFilterFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_L1 + i, dwLogFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
}
+ CheckDlgButton(m_hwnd, IDC_P1 + i, dwPopupFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_T1 + i, dwTrayFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
}
- SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("No markers"));
- SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("Show as icons"));
- SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("Show as text symbols"));
- SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_SETCURSEL, (g_Settings.bLogSymbols ? 2 : (g_Settings.dwIconFlags ? 1 : 0)), 0);
+ SendDlgItemMessage(m_hwnd, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("No markers"));
+ SendDlgItemMessage(m_hwnd, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("Show as icons"));
+ SendDlgItemMessage(m_hwnd, IDC_LOGICONTYPE, CB_ADDSTRING, -1, (LPARAM)TranslateT("Show as text symbols"));
- CheckDlgButton(hwndDlg, IDC_TRAYONLYFORINACTIVE, M.GetByte(CHAT_MODULE, "TrayIconInactiveOnly", 0) ? BST_CHECKED : BST_UNCHECKED);
- break;
+ SendDlgItemMessage(m_hwnd, IDC_LOGICONTYPE, CB_SETCURSEL, (g_Settings.bLogSymbols ? 2 : (g_Settings.dwIconFlags ? 1 : 0)), 0);
- case WM_COMMAND:
- if (lParam != 0)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+ CheckDlgButton(m_hwnd, IDC_TRAYONLYFORINACTIVE, M.GetByte(CHAT_MODULE, "TrayIconInactiveOnly", 0) ? BST_CHECKED : BST_UNCHECKED);
+ }
- case WM_NOTIFY:
- 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;
-
- for (int i = 0; i < _countof(_eventorder); i++) {
- if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
- dwFilterFlags |= (IsDlgButtonChecked(hwndDlg, IDC_1 + i) ? _eventorder[i] : 0);
- dwLogFlags |= (IsDlgButtonChecked(hwndDlg, IDC_L1 + i) ? _eventorder[i] : 0);
- }
- dwPopupFlags |= (IsDlgButtonChecked(hwndDlg, IDC_P1 + i) ? _eventorder[i] : 0);
- dwTrayFlags |= (IsDlgButtonChecked(hwndDlg, IDC_T1 + i) ? _eventorder[i] : 0);
- }
- db_set_dw(0, CHAT_MODULE, "FilterFlags", dwFilterFlags);
- db_set_dw(0, CHAT_MODULE, "PopupFlags", dwPopupFlags);
- db_set_dw(0, CHAT_MODULE, "TrayIconFlags", dwTrayFlags);
- db_set_dw(0, CHAT_MODULE, "DiskLogFlags", dwLogFlags);
-
- LRESULT lr = SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_GETCURSEL, 0, 0);
-
- db_set_dw(0, CHAT_MODULE, "IconFlags", lr == 1 ? 1 : 0);
- db_set_b(0, CHAT_MODULE, "LogSymbols", lr == 2 ? 1 : 0);
-
- db_set_b(0, CHAT_MODULE, "TrayIconInactiveOnly", IsDlgButtonChecked(hwndDlg, IDC_TRAYONLYFORINACTIVE) ? 1 : 0);
- return TRUE;
+ void OnApply() override
+ {
+ DWORD dwFilterFlags = 0, dwTrayFlags = 0,
+ dwPopupFlags = 0, dwLogFlags = 0;
+
+ for (int i = 0; i < _countof(_eventorder); i++) {
+ if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
+ dwFilterFlags |= (IsDlgButtonChecked(m_hwnd, IDC_1 + i) ? _eventorder[i] : 0);
+ dwLogFlags |= (IsDlgButtonChecked(m_hwnd, IDC_L1 + i) ? _eventorder[i] : 0);
}
+ dwPopupFlags |= (IsDlgButtonChecked(m_hwnd, IDC_P1 + i) ? _eventorder[i] : 0);
+ dwTrayFlags |= (IsDlgButtonChecked(m_hwnd, IDC_T1 + i) ? _eventorder[i] : 0);
}
- break;
+ db_set_dw(0, CHAT_MODULE, "FilterFlags", dwFilterFlags);
+ db_set_dw(0, CHAT_MODULE, "PopupFlags", dwPopupFlags);
+ db_set_dw(0, CHAT_MODULE, "TrayIconFlags", dwTrayFlags);
+ db_set_dw(0, CHAT_MODULE, "DiskLogFlags", dwLogFlags);
+
+ LRESULT lr = SendDlgItemMessage(m_hwnd, IDC_LOGICONTYPE, CB_GETCURSEL, 0, 0);
+
+ db_set_dw(0, CHAT_MODULE, "IconFlags", lr == 1 ? 1 : 0);
+ db_set_b(0, CHAT_MODULE, "LogSymbols", lr == 2 ? 1 : 0);
+
+ db_set_b(0, CHAT_MODULE, "TrayIconInactiveOnly", IsDlgButtonChecked(m_hwnd, IDC_TRAYONLYFORINACTIVE) ? 1 : 0);
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Group chat - Highlight
+
+class CHighlighOptionDlg : public CChatBaseOptionDlg
+{
+ CCtrlEdit edtNick, edtText;
+ CCtrlCheck chkNick, chkText;
+
+public:
+ CHighlighOptionDlg() :
+ CChatBaseOptionDlg(IDD_OPTIONS4),
+ edtNick(this, IDC_HIGHLIGHTNICKPATTERN),
+ edtText(this, IDC_HIGHLIGHTNICKPATTERN),
+ chkNick(this, IDC_HIGHLIGHTNICKENABLE),
+ chkText(this, IDC_HIGHLIGHTTEXTENABLE)
+ {
+ chkNick.OnChange = Callback(this, &CHighlighOptionDlg::onChange_Nick);
+ chkText.OnChange = Callback(this, &CHighlighOptionDlg::onChange_Text);
}
- return FALSE;
+
+ void OnInitDialog() override
+ {
+ ptrW wszText(db_get_wsa(0, CHAT_MODULE, "HighlightWords"));
+ if (wszText)
+ edtText.SetText(wszText);
+
+ wszText = db_get_wsa(0, CHAT_MODULE, "HighlightNames");
+ if (wszText)
+ edtNick.SetText(wszText);
+
+ DWORD dwFlags = M.GetByte(CHAT_MODULE, "HighlightEnabled", CMUCHighlight::MATCH_TEXT);
+
+ chkNick.SetState(dwFlags & CMUCHighlight::MATCH_NICKNAME); onChange_Nick(0);
+ chkText.SetState(dwFlags & CMUCHighlight::MATCH_TEXT); onChange_Text(0);
+
+ ::CheckDlgButton(m_hwnd, IDC_HIGHLIGHTNICKUID, dwFlags & CMUCHighlight::MATCH_UIN ? BST_CHECKED : BST_UNCHECKED);
+ ::CheckDlgButton(m_hwnd, IDC_HIGHLIGHTME, M.GetByte(CHAT_MODULE, "HighlightMe", 1) ? BST_CHECKED : BST_UNCHECKED);
+ }
+
+ void onChange_Text(CCtrlCheck*)
+ {
+ bool bChecked = chkText.GetState();
+ edtText.Enable(bChecked);
+ Utils::enableDlgControl(m_hwnd, IDC_HIGHLIGHTME, bChecked);
+ }
+
+ void onChange_Nick(CCtrlCheck*)
+ {
+ bool bChecked = chkNick.GetState();
+ edtNick.Enable(bChecked);
+ Utils::enableDlgControl(m_hwnd, IDC_HIGHLIGHTNICKUID, chkNick.GetState());
+ }
+
+ void OnApply() override
+ {
+ db_set_ws(0, CHAT_MODULE, "HighlightNames", ptrW(edtNick.GetText()));
+ db_set_ws(0, CHAT_MODULE, "HighlightWords", ptrW(edtText.GetText()));
+
+ BYTE dwFlags = (chkNick.GetState() ? CMUCHighlight::MATCH_NICKNAME : 0) | (chkText.GetState() ? CMUCHighlight::MATCH_TEXT : 0);
+ if (dwFlags & CMUCHighlight::MATCH_NICKNAME)
+ dwFlags |= (::IsDlgButtonChecked(m_hwnd, IDC_HIGHLIGHTNICKUID) ? CMUCHighlight::MATCH_UIN : 0);
+
+ db_set_b(0, CHAT_MODULE, "HighlightEnabled", dwFlags);
+ db_set_b(0, CHAT_MODULE, "HighlightMe", ::IsDlgButtonChecked(m_hwnd, IDC_HIGHLIGHTME) ? 1 : 0);
+ g_Settings.Highlight->init();
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void Chat_Options(WPARAM wParam)
+{
+ OPTIONSDIALOGPAGE odp = {};
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.position = 910000000;
+ odp.szGroup.a = LPGEN("Message sessions");
+ odp.szTitle.a = LPGEN("Group chats");
+
+ odp.szTab.a = LPGEN("Settings");
+ odp.pDialog = new CChatSettingsDlg();
+ g_plugin.addOptions(wParam, &odp);
+
+ odp.szTab.a = LPGEN("Log formatting");
+ odp.pDialog = new CChatLogOptionDlg();
+ g_plugin.addOptions(wParam, &odp);
+
+ odp.szTab.a = LPGEN("Events and filters");
+ odp.pDialog = new CChatEventOptionDlg();
+ g_plugin.addOptions(wParam, &odp);
+
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS4);
+ odp.szTab.a = LPGEN("Highlighting");
+ odp.pDialog = new CHighlighOptionDlg();
+ g_plugin.addOptions(wParam, &odp);
}
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 9cb1e6e548..acdc82c788 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -588,7 +588,7 @@ public:
virtual void OnInitDialog() override
{
TreeViewInit(GetDlgItem(m_hwnd, IDC_WINDOWOPTIONS), CTranslator::TREE_MSG, 0, FALSE);
-
+
chkAvaPreserve.SetState(M.GetByte("dontscaleavatars", 0));
spnAvaSize.SetRange(150);
@@ -713,7 +713,7 @@ public:
spnLoadCount.SetRange(100);
spnLoadCount.SetPosition(db_get_w(0, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT));
-
+
spnLoadTime.SetRange(24 * 60);
spnLoadTime.SetPosition(db_get_w(0, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME));
@@ -1043,7 +1043,7 @@ public:
spnLimit.SetRange(20, 5);
spnLimit.SetPosition(db_get_w(0, SRMSGMOD_T, "cut_at", 15));
onChange_Cut(&chkLimit);
-
+
cmbEscMode.AddString(TranslateT("Normal - close tab, if last tab is closed also close the window"));
cmbEscMode.AddString(TranslateT("Minimize the window to the task bar"));
cmbEscMode.AddString(TranslateT("Close or hide window, depends on the close button setting above"));
@@ -1057,7 +1057,7 @@ public:
db_set_b(0, SRMSGMOD_T, "escmode", cmbEscMode.GetCurSel());
TreeViewToDB(GetDlgItem(m_hwnd, IDC_TABMSGOPTIONS), CTranslator::TREE_TAB, SRMSGMOD_T, nullptr);
-
+
PluginConfig.reloadSettings();
Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0);
}
@@ -1139,7 +1139,7 @@ public:
spnTabLimit.SetRange(1000, 1);
spnTabLimit.SetPosition(M.GetDword("maxtabs", 1));
onChangeLimits(nullptr);
-
+
chkSingle.SetState(M.GetByte("singlewinmode", 0));
chkDefault.SetState(!(chkGroup.GetState() || chkLimits.GetState() || chkSingle.GetState()));
@@ -1156,7 +1156,7 @@ public:
cmbAeroEffect.InsertString(TranslateW(CSkin::m_aeroEffects[i].tszName), -1);
cmbAeroEffect.SetCurSel(CSkin::m_aeroEffect);
cmbAeroEffect.Enable(PluginConfig.m_bIsVista);
-
+
chkUseAero.Enable(PluginConfig.m_bIsVista);
chkUseAeroPeek.Enable(PluginConfig.m_bIsWin7);
if (PluginConfig.m_bIsVista)
@@ -1175,7 +1175,7 @@ public:
db_set_b(0, SRMSGMOD_T, "nrflash", spnNumFlash.GetPosition());
db_set_b(0, SRMSGMOD_T, "useAero", chkUseAero.GetState());
db_set_b(0, SRMSGMOD_T, "useAeroPeek", chkUseAeroPeek.GetState());
-
+
CSkin::setAeroEffect(cmbAeroEffect.GetCurSel());
if (M.getAeroState() != fOldAeroState) {
SendMessage(PluginConfig.g_hwndHotkeyHandler, WM_DWMCOMPOSITIONCHANGED, 0, 0); // simulate aero state change
@@ -1288,7 +1288,6 @@ static int OptInitialise(WPARAM wParam, LPARAM lParam)
OPTIONSDIALOGPAGE odpnew = {};
odpnew.position = 910000000;
- odpnew.hInstance = g_plugin.getInst();
odpnew.flags = ODPF_BOLDGROUPS;
odpnew.szTitle.a = LPGEN("Message sessions");
@@ -1343,27 +1342,7 @@ static int OptInitialise(WPARAM wParam, LPARAM lParam)
g_plugin.addOptions(wParam, &odp);
// group chats
- odp.szGroup.a = LPGEN("Message sessions");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS1);
- odp.szTitle.a = LPGEN("Group chats");
- odp.szTab.a = LPGEN("Settings");
- odp.pfnDlgProc = DlgProcOptions1;
- g_plugin.addOptions(wParam, &odp);
-
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS2);
- odp.szTab.a = LPGEN("Log formatting");
- odp.pfnDlgProc = DlgProcOptions2;
- g_plugin.addOptions(wParam, &odp);
-
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS3);
- odp.szTab.a = LPGEN("Events and filters");
- odp.pfnDlgProc = DlgProcOptions3;
- g_plugin.addOptions(wParam, &odp);
-
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS4);
- odp.szTab.a = LPGEN("Highlighting");
- odp.pfnDlgProc = CMUCHighlight::dlgProc;
- g_plugin.addOptions(wParam, &odp);
+ Chat_Options(wParam);
return 0;
}
diff --git a/plugins/TabSRMM/src/muchighlight.cpp b/plugins/TabSRMM/src/muchighlight.cpp
index e0db76b3ff..dd8172921b 100644
--- a/plugins/TabSRMM/src/muchighlight.cpp
+++ b/plugins/TabSRMM/src/muchighlight.cpp
@@ -28,8 +28,6 @@
#include "stdafx.h"
-void Chat_ApplyOptions();
-
void CMUCHighlight::cleanup()
{
mir_free(m_NickPatternString);
@@ -177,105 +175,3 @@ skip_textpatterns:
return result || nResult;
}
-
-/**
- * Dialog procedure to handle global highlight settings
- *
- * @param Standard Windows dialog procedure parameters
- */
-INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- DBVARIANT dbv = { 0 };
- if (!db_get_ws(0, CHAT_MODULE, "HighlightWords", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN, dbv.ptszVal);
- ::db_free(&dbv);
- }
-
- if (!db_get_ws(0, CHAT_MODULE, "HighlightNames", &dbv)) {
- ::SetDlgItemText(hwndDlg, IDC_HIGHLIGHTNICKPATTERN, dbv.ptszVal);
- ::db_free(&dbv);
- }
-
- DWORD dwFlags = M.GetByte(CHAT_MODULE, "HighlightEnabled", MATCH_TEXT);
-
- ::CheckDlgButton(hwndDlg, IDC_HIGHLIGHTNICKENABLE, dwFlags & MATCH_NICKNAME ? BST_CHECKED : BST_UNCHECKED);
- ::CheckDlgButton(hwndDlg, IDC_HIGHLIGHTNICKUID, dwFlags & MATCH_UIN ? BST_CHECKED : BST_UNCHECKED);
- ::CheckDlgButton(hwndDlg, IDC_HIGHLIGHTTEXTENABLE, dwFlags & MATCH_TEXT ? BST_CHECKED : BST_UNCHECKED);
- ::CheckDlgButton(hwndDlg, IDC_HIGHLIGHTME, M.GetByte(CHAT_MODULE, "HighlightMe", 1) ? BST_CHECKED : BST_UNCHECKED);
-
- ::SendMessage(hwndDlg, WM_USER + 100, 0, 0);
- }
- return TRUE;
-
- case WM_USER + 100:
- Utils::enableDlgControl(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN,
- ::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTTEXTENABLE) ? TRUE : FALSE);
-
- Utils::enableDlgControl(hwndDlg, IDC_HIGHLIGHTNICKPATTERN,
- ::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKENABLE) ? TRUE : FALSE);
-
- Utils::enableDlgControl(hwndDlg, IDC_HIGHLIGHTNICKUID,
- ::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKENABLE) ? TRUE : FALSE);
-
- Utils::enableDlgControl(hwndDlg, IDC_HIGHLIGHTME,
- ::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTTEXTENABLE) ? TRUE : FALSE);
- return FALSE;
-
- case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_HIGHLIGHTNICKPATTERN
- || LOWORD(wParam) == IDC_HIGHLIGHTTEXTPATTERN)
- && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != ::GetFocus()))
- return 0;
-
- ::SendMessage(hwndDlg, WM_USER + 100, 0, 0);
- if (lParam != 0)
- ::SendMessage(::GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- 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) {
- szBuf = reinterpret_cast<wchar_t *>(mir_alloc((iLen + 2) * sizeof(wchar_t)));
- ::GetDlgItemText(hwndDlg, IDC_HIGHLIGHTNICKPATTERN, szBuf, iLen + 1);
- db_set_ws(0, CHAT_MODULE, "HighlightNames", szBuf);
- }
- else db_set_ws(0, CHAT_MODULE, "HighlightNames", L"");
-
- iLen = ::GetWindowTextLength(::GetDlgItem(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN));
- if (iLen) {
- szBuf = reinterpret_cast<wchar_t *>(mir_realloc(szBuf, sizeof(wchar_t) * (iLen + 2)));
- ::GetDlgItemText(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN, szBuf, iLen + 1);
- db_set_ws(0, CHAT_MODULE, "HighlightWords", szBuf);
- }
- else db_set_ws(0, CHAT_MODULE, "HighlightWords", L"");
-
- mir_free(szBuf);
- BYTE dwFlags = (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKENABLE) ? MATCH_NICKNAME : 0) |
- (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTTEXTENABLE) ? MATCH_TEXT : 0);
-
- if (dwFlags & MATCH_NICKNAME)
- dwFlags |= (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKUID) ? MATCH_UIN : 0);
-
- 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;
- }
- }
- break;
- }
- return FALSE;
-}
diff --git a/plugins/TabSRMM/src/muchighlight.h b/plugins/TabSRMM/src/muchighlight.h
index 51bcd3ec79..7809328ea5 100644
--- a/plugins/TabSRMM/src/muchighlight.h
+++ b/plugins/TabSRMM/src/muchighlight.h
@@ -40,12 +40,6 @@ public:
CMUCHighlight()
{
- m_fInitialized = false;
- m_TextPatternString = m_NickPatternString = nullptr;
- m_NickPatterns = m_TextPatterns = nullptr;
- m_iNickPatterns = m_iTextPatterns = 0;
- m_dwFlags = 0;
- m_Valid = true;
init();
}
@@ -58,21 +52,19 @@ public:
void cleanup();
bool match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dwFlags = MATCH_NICKNAME);
- static INT_PTR CALLBACK dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); // option page dlg proc
-
private:
- void tokenize(wchar_t *tszString, wchar_t**& patterns, UINT& nr);
+ void tokenize(wchar_t *tszString, wchar_t** &patterns, UINT &nr);
- DWORD m_dwFlags;
- bool m_fInitialized;
- wchar_t** m_NickPatterns;
- wchar_t** m_TextPatterns;
- UINT m_iNickPatterns;
- UINT m_iTextPatterns;
- wchar_t *m_NickPatternString;
- wchar_t *m_TextPatternString;
- bool m_Valid;
- bool m_fHighlightMe;
+ DWORD m_dwFlags = 0;
+ bool m_fInitialized = false;
+ wchar_t **m_NickPatterns = nullptr;
+ wchar_t **m_TextPatterns = nullptr;
+ UINT m_iNickPatterns = 0;
+ UINT m_iTextPatterns = 0;
+ wchar_t *m_NickPatternString = nullptr;
+ wchar_t *m_TextPatternString = nullptr;
+ bool m_Valid = true;
+ bool m_fHighlightMe;
};
struct THighLightEdit
diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h
index 6eea03c043..b1948c917f 100644
--- a/plugins/TabSRMM/src/stdafx.h
+++ b/plugins/TabSRMM/src/stdafx.h
@@ -233,6 +233,7 @@ extern pfnDoTrayIcon oldDoTrayIcon;
int LoadSendRecvMessageModule(void);
int SplitmsgShutdown(void);
int Chat_Load(), Chat_Unload();
+void Chat_Options(WPARAM);
void FreeLogFonts();
INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam);
@@ -252,9 +253,6 @@ BOOL TreeViewHandleClick(HWND hwndDlg, HWND hwndTree, WPARAM wParam, LPARAM lPar
INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int TSAPI TBStateConvert2Flat(int state);
diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h
index f1f5900af8..6f67d44b9d 100644
--- a/plugins/TabSRMM/src/version.h
+++ b/plugins/TabSRMM/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 3
#define __MINOR_VERSION 5
#define __RELEASE_NUM 0
-#define __BUILD_NUM 9
+#define __BUILD_NUM 10
#include <stdver.h>