summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-05-31 12:40:08 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-05-31 12:40:08 +0300
commit275cbda0f6ff97e9c7583f76e2375d1fe0ad42bc (patch)
tree7404b25e2c390ca7f48e8908a9efa91219a339d9
parenta4f6e25737b0404ba91fb77840aefa82cfc76fb0 (diff)
tabSRMM:
- fixes #1959 (TabSRMM: add option to disable Esc key); - skin option dialogs rewritten using UI controls; - version bump
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp19
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp19
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp724
-rw-r--r--plugins/TabSRMM/src/msgs.cpp14
-rw-r--r--plugins/TabSRMM/src/stdafx.h7
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp102
-rw-r--r--plugins/TabSRMM/src/userprefs.cpp16
-rw-r--r--plugins/TabSRMM/src/version.h2
8 files changed, 415 insertions, 488 deletions
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index b0afb70e66..432692a125 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -2288,15 +2288,20 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_CLOSE:
if (wParam == 0 && lParam == 0) {
- if (GetCapture() != nullptr)
- return TRUE;
-
- if (PluginConfig.m_EscapeCloses == 1) {
+ switch (PluginConfig.m_EscapeCloses) {
+ case 1: // minimize container
SendMessage(m_pContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
return TRUE;
- }
- if (PluginConfig.m_bHideOnClose && PluginConfig.m_EscapeCloses == 2) {
- ShowWindow(m_pContainer->m_hwnd, SW_HIDE);
+
+ case 2: // close or hide, optionally
+ if (PluginConfig.m_bHideOnClose) {
+ ShowWindow(m_pContainer->m_hwnd, SW_HIDE);
+ return TRUE;
+ }
+ break;
+
+ case 3: // does nothing
+ _dlgReturn(m_hwnd, FALSE);
return TRUE;
}
_dlgReturn(m_hwnd, TRUE);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index fcd69dcf9e..e4a30f9f95 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -2937,15 +2937,20 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
return TRUE;
}
- if (GetCapture() != nullptr)
- return TRUE;
-
- if (PluginConfig.m_EscapeCloses == 1) {
+ switch (PluginConfig.m_EscapeCloses) {
+ case 1: // minimize container
SendMessage(m_pContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
return TRUE;
- }
- else if (PluginConfig.m_bHideOnClose && PluginConfig.m_EscapeCloses == 2) {
- ShowWindow(m_pContainer->m_hwnd, SW_HIDE);
+
+ case 2: // close or hide, optionally
+ if (PluginConfig.m_bHideOnClose) {
+ ShowWindow(m_pContainer->m_hwnd, SW_HIDE);
+ return TRUE;
+ }
+ break;
+
+ case 3: // do nothing
+ _dlgReturn(m_hwnd, FALSE);
return TRUE;
}
_dlgReturn(m_hwnd, TRUE);
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 9963d465cd..544dd338f3 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -31,18 +31,6 @@
#define DM_GETSTATUSMASK (WM_USER + 10)
-struct FontOptionsList
-{
- COLORREF defColour;
- char *szDefFace;
- BYTE defStyle;
- char defSize;
-}
-
-static fontOptionsList[] = {
- { RGB(0, 0, 0), "Tahoma", 0, -10 }
-};
-
HIMAGELIST CreateStateImageList()
{
HIMAGELIST himlStates = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 4, 0);
@@ -75,312 +63,6 @@ void LoadLogfont(int section, int i, LOGFONTA * lf, COLORREF * colour, char *szM
}
}
-HIMAGELIST g_himlOptions;
-
-static HWND hwndTabConfig = nullptr;
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// scan a single skin directory and find the.TSK file.Fill the combobox and set the
-// relative path name as item extra data.
-//
-// If available, read the Name property from the [Global] section and use it in the
-// combo box. If such property is not found, the base filename (without .tsk extension)
-// will be used as the name of the skin.
-//
-// [Global]/Name property is new in TabSRMM version 3.
-
-static int TSAPI ScanSkinDir(const wchar_t* tszFolder, HWND hwndCombobox)
-{
- bool fValid = false;
- wchar_t tszMask[MAX_PATH];
- mir_snwprintf(tszMask, L"%s*.*", tszFolder);
-
- WIN32_FIND_DATA fd = { 0 };
- HANDLE h = FindFirstFile(tszMask, &fd);
- while (h != INVALID_HANDLE_VALUE) {
- if (mir_wstrlen(fd.cFileName) >= 5 && !wcsnicmp(fd.cFileName + mir_wstrlen(fd.cFileName) - 4, L".tsk", 4)) {
- fValid = true;
- break;
- }
- if (FindNextFile(h, &fd) == 0)
- break;
- }
- if (h != INVALID_HANDLE_VALUE)
- FindClose(h);
-
- if (fValid) {
- wchar_t tszFinalName[MAX_PATH], tszRel[MAX_PATH];
- LRESULT lr;
- wchar_t szBuf[255];
-
- mir_snwprintf(tszFinalName, L"%s%s", tszFolder, fd.cFileName);
-
- GetPrivateProfileString(L"Global", L"Name", L"None", szBuf, _countof(szBuf), tszFinalName);
- if (!mir_wstrcmp(szBuf, L"None")) {
- fd.cFileName[mir_wstrlen(fd.cFileName) - 4] = 0;
- wcsncpy_s(szBuf, fd.cFileName, _TRUNCATE);
- }
-
- PathToRelativeW(tszFinalName, tszRel, M.getSkinPath());
- if ((lr = SendMessage(hwndCombobox, CB_INSERTSTRING, -1, (LPARAM)szBuf)) != CB_ERR) {
- wchar_t *idata = (wchar_t*)mir_alloc((mir_wstrlen(tszRel) + 1) * sizeof(wchar_t));
-
- mir_wstrcpy(idata, tszRel);
- SendMessage(hwndCombobox, CB_SETITEMDATA, lr, (LPARAM)idata);
- }
- }
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// scan the skin root folder for subfolder(s).Each folder is supposed to contain a single
-// skin. This function won't dive deeper into the folder structure, so the folder
-// structure for any VALID skin should be:
-// $SKINS_ROOT/skin_folder/skin_name.tsk
-//
-// By default, $SKINS_ROOT is set to %miranda_userdata% or custom folder
-// selected by the folders plugin.
-
-static int TSAPI RescanSkins(HWND hwndCombobox)
-{
- DBVARIANT dbv = { 0 };
-
- wchar_t tszSkinRoot[MAX_PATH], tszFindMask[MAX_PATH];
- wcsncpy_s(tszSkinRoot, M.getSkinPath(), _TRUNCATE);
-
- SetDlgItemText(GetParent(hwndCombobox), IDC_SKINROOTFOLDER, tszSkinRoot);
- mir_snwprintf(tszFindMask, L"%s*.*", tszSkinRoot);
-
- SendMessage(hwndCombobox, CB_RESETCONTENT, 0, 0);
- SendMessage(hwndCombobox, CB_INSERTSTRING, -1, (LPARAM)TranslateT("<no skin>"));
-
- WIN32_FIND_DATA fd = { 0 };
- HANDLE h = FindFirstFile(tszFindMask, &fd);
- while (h != INVALID_HANDLE_VALUE) {
- if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && fd.cFileName[0] != '.') {
- wchar_t tszSubDir[MAX_PATH];
- mir_snwprintf(tszSubDir, L"%s%s\\", tszSkinRoot, fd.cFileName);
- ScanSkinDir(tszSubDir, hwndCombobox);
- }
- if (FindNextFile(h, &fd) == 0)
- break;
- }
- if (h != INVALID_HANDLE_VALUE)
- FindClose(h);
-
- SendMessage(hwndCombobox, CB_SETCURSEL, 0, 0);
- if (0 == db_get_ws(0, SRMSGMOD_T, "ContainerSkin", &dbv)) {
- LRESULT lr = SendMessage(hwndCombobox, CB_GETCOUNT, 0, 0);
- for (int i = 1; i < lr; i++) {
- wchar_t *idata = (wchar_t*)SendMessage(hwndCombobox, CB_GETITEMDATA, i, 0);
- if (idata && idata != (wchar_t*)CB_ERR) {
- if (!mir_wstrcmpi(dbv.pwszVal, idata)) {
- SendMessage(hwndCombobox, CB_SETCURSEL, i, 0);
- break;
- }
- }
- }
- db_free(&dbv);
- }
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// mir_free the item extra data (used to store the skin filenames for each entry).
-
-static void TSAPI FreeComboData(HWND hwndCombobox)
-{
- LRESULT lr = SendMessage(hwndCombobox, CB_GETCOUNT, 0, 0);
-
- for (int i = 1; i < lr; i++) {
- void *idata = (void*)SendMessage(hwndCombobox, CB_GETITEMDATA, i, 0);
-
- if (idata && idata != (void*)CB_ERR)
- mir_free(idata);
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// controls to disable when loading or unloading a skin is not possible (because
-// of at least one message window being open).
-
-static UINT _ctrls[] = { IDC_SKINNAME, IDC_RESCANSKIN, IDC_RESCANSKIN, IDC_RELOADSKIN, 0 };
-
-static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- BYTE loadMode;
-
- switch (msg) {
- case WM_INITDIALOG:
- RescanSkins(GetDlgItem(hwndDlg, IDC_SKINNAME));
- TranslateDialogDefault(hwndDlg);
-
- CheckDlgButton(hwndDlg, IDC_USESKIN, M.GetByte("useskin", 0) ? BST_CHECKED : BST_UNCHECKED);
-
- loadMode = M.GetByte("skin_loadmode", 0);
- CheckDlgButton(hwndDlg, IDC_SKIN_LOADFONTS, loadMode & THEME_READ_FONTS ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SKIN_LOADTEMPLATES, loadMode & THEME_READ_TEMPLATES ? BST_CHECKED : BST_UNCHECKED);
-
- SendMessage(hwndDlg, WM_USER + 100, 0, 0);
- SetTimer(hwndDlg, 1000, 100, nullptr);
- return TRUE;
-
- case WM_CTLCOLORSTATIC:
- if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SKIN_WARN)) {
- SetTextColor((HDC)wParam, RGB(255, 50, 50));
- return 0;
- }
- break;
-
- // self - configure the dialog, don't let the user load or unload
- // a skin while a message window is open. Show the warning that all
- // windows must be closed.
- case WM_USER + 100:
- {
- bool fWindowsOpen = (pFirstContainer != nullptr ? true : false);
- for (int i = 0; _ctrls[i]; i++)
- Utils::enableDlgControl(hwndDlg, _ctrls[i], !fWindowsOpen);
-
- Utils::showDlgControl(hwndDlg, IDC_SKIN_WARN, fWindowsOpen ? SW_SHOW : SW_HIDE);
- Utils::showDlgControl(hwndDlg, IDC_SKIN_CLOSENOW, fWindowsOpen ? SW_SHOW : SW_HIDE);
- }
- return 0;
-
- case WM_TIMER:
- if (wParam == 1000)
- SendMessage(hwndDlg, WM_USER + 100, 0, 0);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_USESKIN:
- db_set_b(0, SRMSGMOD_T, "useskin", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_USESKIN) ? 1 : 0));
- break;
-
- case IDC_SKIN_LOADFONTS:
- loadMode = M.GetByte("skin_loadmode", 0);
- loadMode = IsDlgButtonChecked(hwndDlg, IDC_SKIN_LOADFONTS) ? loadMode | THEME_READ_FONTS : loadMode & ~THEME_READ_FONTS;
- db_set_b(0, SRMSGMOD_T, "skin_loadmode", loadMode);
- break;
-
- case IDC_SKIN_LOADTEMPLATES:
- loadMode = M.GetByte("skin_loadmode", 0);
- loadMode = IsDlgButtonChecked(hwndDlg, IDC_SKIN_LOADTEMPLATES) ? loadMode | THEME_READ_TEMPLATES : loadMode & ~THEME_READ_TEMPLATES;
- db_set_b(0, SRMSGMOD_T, "skin_loadmode", loadMode);
- break;
-
- case IDC_UNLOAD:
- Skin->Unload();
- SendMessage(hwndTabConfig, WM_USER + 100, 0, 0);
- break;
-
- case IDC_RELOADSKIN:
- Skin->setFileName();
- Skin->Load();
- SendMessage(hwndTabConfig, WM_USER + 100, 0, 0);
- break;
-
- case IDC_RESCANSKIN:
- FreeComboData(GetDlgItem(hwndDlg, IDC_SKINNAME));
- RescanSkins(GetDlgItem(hwndDlg, IDC_SKINNAME));
- break;
-
- case IDC_THEMEEXPORT:
- {
- const wchar_t *szFilename = GetThemeFileName(1);
- if (szFilename != nullptr)
- WriteThemeToINI(szFilename, nullptr);
- }
- break;
-
- case IDC_THEMEIMPORT:
- if (CSkin::m_skinEnabled) {
- LRESULT r = CWarning::show(CWarning::WARN_THEME_OVERWRITE, MB_YESNOCANCEL | MB_ICONQUESTION);
- if (r == IDNO || r == IDCANCEL)
- return 0;
- }
- {
- LRESULT r = CWarning::show(CWarning::WARN_OPTION_CLOSE, MB_YESNOCANCEL | MB_ICONQUESTION);
- if (r == IDNO || r == IDCANCEL)
- return 0;
-
- const wchar_t* szFilename = GetThemeFileName(0);
- DWORD dwFlags = THEME_READ_FONTS;
-
- if (szFilename != nullptr) {
- int result = MessageBox(nullptr, TranslateT("Do you want to also read message templates from the theme?\nCaution: This will overwrite the stored template set which may affect the look of your message window significantly.\nSelect Cancel to not load anything at all."),
- TranslateT("Load theme"), MB_YESNOCANCEL);
- if (result == IDCANCEL)
- return 1;
- if (result == IDYES)
- dwFlags |= THEME_READ_TEMPLATES;
- ReadThemeFromINI(szFilename, nullptr, 0, dwFlags);
- CacheLogFonts();
- CacheMsgLogIcons();
- PluginConfig.reloadSettings();
- CSkin::setAeroEffect(-1);
- Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0);
- Srmm_Broadcast(DM_FORCEDREMAKELOG, 0, 0);
- SendMessage(GetParent(hwndDlg), WM_COMMAND, IDCANCEL, 0);
- }
- }
- break;
-
- case IDC_HELP_GENERAL:
- Utils_OpenUrl("https://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Using_skins");
- break;
-
- case IDC_GETSKINS:
- Utils_OpenUrl("https://miranda-ng.org/addons/category/19");
- break;
-
- case IDC_SKIN_CLOSENOW:
- CloseAllContainers();
- break;
-
- case IDC_SKINNAME:
- if (HIWORD(wParam) == CBN_SELCHANGE) {
- LRESULT lr = SendDlgItemMessage(hwndDlg, IDC_SKINNAME, CB_GETCURSEL, 0, 0);
- if (lr != CB_ERR && lr > 0) {
- wchar_t *tszRelPath = (wchar_t*)SendDlgItemMessage(hwndDlg, IDC_SKINNAME, CB_GETITEMDATA, lr, 0);
- if (tszRelPath && tszRelPath != (wchar_t*)CB_ERR)
- db_set_ws(0, SRMSGMOD_T, "ContainerSkin", tszRelPath);
- SendMessage(hwndDlg, WM_COMMAND, IDC_RELOADSKIN, 0);
- }
- else if (lr == 0) { // selected the <no skin> entry
- db_unset(0, SRMSGMOD_T, "ContainerSkin");
- Skin->Unload();
- SendMessage(hwndTabConfig, WM_USER + 100, 0, 0);
- }
- return 0;
- }
- break;
- }
-
- if ((LOWORD(wParam) == IDC_SKINNAME) && (HIWORD(wParam) != CBN_SELCHANGE || (HWND)lParam != GetFocus()))
- return 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- return TRUE;
- }
- break;
- }
- break;
-
- case WM_DESTROY:
- KillTimer(hwndDlg, 1000);
- FreeComboData(GetDlgItem(hwndDlg, IDC_SKINNAME));
- break;
- }
- return FALSE;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
void TreeViewInit(HWND hwndTree, UINT id, DWORD dwFlags, BOOL bFromMem)
@@ -557,14 +239,355 @@ BOOL TreeViewHandleClick(HWND hwndDlg, HWND hwndTree, WPARAM, LPARAM lParam)
RedrawWindow(hwndTree, nullptr, nullptr, RDW_INVALIDATE | RDW_NOFRAME | RDW_ERASENOW | RDW_ALLCHILDREN);
InvalidateRect(hwndTree, nullptr, TRUE);
}
- else {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
+ else SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////////////////
+// options dialog for setting up tab options
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// controls to disable when loading or unloading a skin is not possible (because
+// of at least one message window being open).
+
+static UINT _ctrls[] = { IDC_SKINNAME, IDC_RESCANSKIN, IDC_RESCANSKIN, IDC_RELOADSKIN, 0 };
+
+class CSkinOptsDlg : public CDlgBase
+{
+ // mir_free the item extra data (used to store the skin filenames for each entry).
+ void FreeComboData()
+ {
+ LRESULT lr = cmbSkins.GetCount();
+ for (int i = 1; i < lr; i++) {
+ void *idata = (void *)cmbSkins.GetItemData(i);
+ if (idata && idata != (void *)CB_ERR)
+ mir_free(idata);
+ }
+ }
+
+ // scan the skin root folder for subfolder(s).Each folder is supposed to contain a single
+ // skin. This function won't dive deeper into the folder structure, so the folder
+ // structure for any VALID skin should be:
+ // $SKINS_ROOT/skin_folder/skin_name.tsk
+ //
+ // By default, $SKINS_ROOT is set to %miranda_userdata% or custom folder
+ // selected by the folders plugin.
+
+ void RescanSkins()
+ {
+ wchar_t tszSkinRoot[MAX_PATH], tszFindMask[MAX_PATH];
+ wcsncpy_s(tszSkinRoot, M.getSkinPath(), _TRUNCATE);
+
+ SetDlgItemText(m_hwnd, IDC_SKINROOTFOLDER, tszSkinRoot);
+ mir_snwprintf(tszFindMask, L"%s*.*", tszSkinRoot);
+
+ cmbSkins.ResetContent();
+ cmbSkins.AddString(TranslateT("<no skin>"));
+
+ WIN32_FIND_DATA fd = {};
+ HANDLE h = FindFirstFile(tszFindMask, &fd);
+ while (h != INVALID_HANDLE_VALUE) {
+ if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && fd.cFileName[0] != '.') {
+ wchar_t tszSubDir[MAX_PATH];
+ mir_snwprintf(tszSubDir, L"%s%s\\", tszSkinRoot, fd.cFileName);
+ ScanSkinDir(tszSubDir);
+ }
+ if (FindNextFile(h, &fd) == 0)
+ break;
+ }
+ if (h != INVALID_HANDLE_VALUE)
+ FindClose(h);
+
+ ptrW wszCurrSkin(db_get_wsa(0, SRMSGMOD_T, "ContainerSkin"));
+ LRESULT lr = cmbSkins.GetCount();
+ for (int i = 1; i < lr; i++) {
+ wchar_t *idata = (wchar_t *)cmbSkins.GetItemData(i);
+ if (idata && idata != (wchar_t *)CB_ERR) {
+ if (!mir_wstrcmpi(wszCurrSkin, idata)) {
+ cmbSkins.SetCurSel(i);
+ return;
+ }
+ }
+ }
+
+ // if no active skin present, set the focus to the first one
+ cmbSkins.SetCurSel(0);
+ }
+
+ // scan a single skin directory and find the.TSK file.Fill the combobox and set the
+ // relative path name as item extra data.
+ //
+ // If available, read the Name property from the [Global] section and use it in the
+ // combo box. If such property is not found, the base filename (without .tsk extension)
+ // will be used as the name of the skin.
+
+ void ScanSkinDir(const wchar_t *tszFolder)
+ {
+ bool fValid = false;
+ wchar_t tszMask[MAX_PATH];
+ mir_snwprintf(tszMask, L"%s*.*", tszFolder);
+
+ WIN32_FIND_DATA fd = { 0 };
+ HANDLE h = FindFirstFile(tszMask, &fd);
+ while (h != INVALID_HANDLE_VALUE) {
+ if (mir_wstrlen(fd.cFileName) >= 5 && !wcsnicmp(fd.cFileName + mir_wstrlen(fd.cFileName) - 4, L".tsk", 4)) {
+ fValid = true;
+ break;
+ }
+ if (FindNextFile(h, &fd) == 0)
+ break;
+ }
+ if (h != INVALID_HANDLE_VALUE)
+ FindClose(h);
+
+ if (!fValid)
+ return;
+
+ wchar_t tszFinalName[MAX_PATH], tszRel[MAX_PATH], szBuf[255];
+ mir_snwprintf(tszFinalName, L"%s%s", tszFolder, fd.cFileName);
+ GetPrivateProfileString(L"Global", L"Name", L"None", szBuf, _countof(szBuf), tszFinalName);
+
+ if (!mir_wstrcmp(szBuf, L"None")) {
+ fd.cFileName[mir_wstrlen(fd.cFileName) - 4] = 0;
+ wcsncpy_s(szBuf, fd.cFileName, _TRUNCATE);
+ }
+
+ PathToRelativeW(tszFinalName, tszRel, M.getSkinPath());
+ cmbSkins.AddString(szBuf, (LPARAM)mir_wstrdup(tszRel));
+ }
+
+ // self - configure the dialog, don't let the user load or unload
+ // a skin while a message window is open. Show the warning that all
+ // windows must be closed.
+ void UpdateControls(CTimer* = nullptr)
+ {
+ bool fWindowsOpen = (pFirstContainer != nullptr ? true : false);
+ for (auto &it : _ctrls)
+ Utils::enableDlgControl(m_hwnd, it, !fWindowsOpen);
+
+ Utils::showDlgControl(m_hwnd, IDC_SKIN_WARN, fWindowsOpen ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(m_hwnd, IDC_SKIN_CLOSENOW, fWindowsOpen ? SW_SHOW : SW_HIDE);
+ }
+
+ CTimer m_timer;
+ CCtrlCheck chkUseSkin, chkLoadFonts, chkLoadTempl;
+ CCtrlCombo cmbSkins;
+ CCtrlButton btnClose, btnReload, btnRescan, btnExport, btnImport;
+ CCtrlHyperlink m_link1, m_link2;
+
+public:
+ CSkinOptsDlg() :
+ CDlgBase(g_plugin, IDD_OPT_SKIN),
+ m_timer(this, 1000),
+ m_link1(this, IDC_GETSKINS, "https://miranda-ng.org/addons/category/19"),
+ m_link2(this, IDC_HELP_GENERAL, "https://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM/en/Using_skins"),
+ cmbSkins(this, IDC_SKINNAME),
+ btnClose(this, IDC_SKIN_CLOSENOW),
+ btnReload(this, IDC_RELOADSKIN),
+ btnRescan(this, IDC_RESCANSKIN),
+ btnExport(this, IDC_THEMEEXPORT),
+ btnImport(this, IDC_THEMEIMPORT),
+ chkUseSkin(this, IDC_USESKIN),
+ chkLoadFonts(this, IDC_SKIN_LOADFONTS),
+ chkLoadTempl(this, IDC_SKIN_LOADTEMPLATES)
+ {
+ m_timer.OnEvent = Callback(this, &CSkinOptsDlg::UpdateControls);
+
+ btnClose.OnClick = Callback(this, &CSkinOptsDlg::onClick_Close);
+ btnReload.OnClick = Callback(this, &CSkinOptsDlg::onClick_Reload);
+ btnRescan.OnClick = Callback(this, &CSkinOptsDlg::onClick_Rescan);
+ btnExport.OnClick = Callback(this, &CSkinOptsDlg::onClick_Export);
+ btnImport.OnClick = Callback(this, &CSkinOptsDlg::onClick_Import);
+
+ chkUseSkin.OnChange = Callback(this, &CSkinOptsDlg::onChange_UseSkin);
+ chkLoadFonts.OnChange = Callback(this, &CSkinOptsDlg::onChange_LoadFonts);
+ chkLoadTempl.OnChange = Callback(this, &CSkinOptsDlg::onChange_LoadTemplates);
+
+ cmbSkins.OnSelChanged = Callback(this, &CSkinOptsDlg::onSelChange_Skins);
+ }
+
+ bool OnInitDialog() override
+ {
+ RescanSkins();
+
+ chkUseSkin.SetState(M.GetByte("useskin", 0));
+
+ int loadMode = M.GetByte("skin_loadmode", 0);
+ CheckDlgButton(m_hwnd, IDC_SKIN_LOADFONTS, loadMode & THEME_READ_FONTS ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SKIN_LOADTEMPLATES, loadMode & THEME_READ_TEMPLATES ? BST_CHECKED : BST_UNCHECKED);
+
+ UpdateControls();
+ m_timer.Start(1000);
+ return true;
+ }
+
+ void OnDestroy() override
+ {
+ m_timer.Stop();
+ FreeComboData();
+ }
+
+ INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
+ {
+ if (msg == WM_CTLCOLORSTATIC && (HWND)lParam == GetDlgItem(m_hwnd, IDC_SKIN_WARN)) {
+ SetTextColor((HDC)wParam, RGB(255, 50, 50));
+ return 0;
+ }
+
+ return CDlgBase::DlgProc(msg, wParam, lParam);
+ }
+
+ void onClick_Close(CCtrlButton *)
+ {
+ CloseAllContainers();
+ }
+
+ void onChange_UseSkin(CCtrlCheck *)
+ {
+ db_set_b(0, SRMSGMOD_T, "useskin", chkUseSkin.GetState());
+ }
+
+ void onChange_LoadFonts(CCtrlCheck *)
+ {
+ int loadMode = M.GetByte("skin_loadmode", 0);
+ loadMode = IsDlgButtonChecked(m_hwnd, IDC_SKIN_LOADFONTS) ? loadMode | THEME_READ_FONTS : loadMode & ~THEME_READ_FONTS;
+ db_set_b(0, SRMSGMOD_T, "skin_loadmode", loadMode);
+ }
+
+ void onChange_LoadTemplates(CCtrlCheck *)
+ {
+ int loadMode = M.GetByte("skin_loadmode", 0);
+ loadMode = IsDlgButtonChecked(m_hwnd, IDC_SKIN_LOADTEMPLATES) ? loadMode | THEME_READ_TEMPLATES : loadMode & ~THEME_READ_TEMPLATES;
+ db_set_b(0, SRMSGMOD_T, "skin_loadmode", loadMode);
+ }
+
+ void onClick_Reload(CCtrlButton *)
+ {
+ Skin->setFileName();
+ Skin->Load();
+ UpdateControls();
+ }
+
+ void onClick_Rescan(CCtrlButton *)
+ {
+ FreeComboData();
+ RescanSkins();
+ }
+
+ void onClick_Export(CCtrlButton *)
+ {
+ const wchar_t *szFilename = GetThemeFileName(1);
+ if (szFilename != nullptr)
+ WriteThemeToINI(szFilename, nullptr);
+ }
+
+ void onClick_Import(CCtrlButton *)
+ {
+ LRESULT r = CWarning::show(CSkin::m_skinEnabled ? CWarning::WARN_THEME_OVERWRITE : CWarning::WARN_OPTION_CLOSE, MB_YESNOCANCEL | MB_ICONQUESTION);
+ if (r == IDNO || r == IDCANCEL)
+ return;
+
+ const wchar_t *szFilename = GetThemeFileName(0);
+ DWORD dwFlags = THEME_READ_FONTS;
+
+ if (szFilename != nullptr) {
+ int result = MessageBox(nullptr, TranslateT("Do you want to also read message templates from the theme?\nCaution: This will overwrite the stored template set which may affect the look of your message window significantly.\nSelect Cancel to not load anything at all."),
+ TranslateT("Load theme"), MB_YESNOCANCEL);
+ if (result == IDCANCEL)
+ return;
+ if (result == IDYES)
+ dwFlags |= THEME_READ_TEMPLATES;
+ ReadThemeFromINI(szFilename, nullptr, 0, dwFlags);
+ CacheLogFonts();
+ CacheMsgLogIcons();
+ PluginConfig.reloadSettings();
+ CSkin::setAeroEffect(-1);
+ Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0);
+ Srmm_Broadcast(DM_FORCEDREMAKELOG, 0, 0);
+ SendMessage(GetParent(m_hwnd), WM_COMMAND, IDCANCEL, 0);
+ }
+ }
+
+ void onSelChange_Skins(CCtrlCombo *)
+ {
+ LRESULT lr = cmbSkins.GetCurSel();
+ if (lr != CB_ERR && lr > 0) {
+ wchar_t *tszRelPath = (wchar_t *)cmbSkins.GetItemData(lr);
+ if (tszRelPath && tszRelPath != (wchar_t *)CB_ERR)
+ db_set_ws(0, SRMSGMOD_T, "ContainerSkin", tszRelPath);
+ onClick_Reload(0);
+ }
+ else if (lr == 0) { // selected the <no skin> entry
+ db_unset(0, SRMSGMOD_T, "ContainerSkin");
+ Skin->Unload();
+ UpdateControls();
+ }
+ }
+};
+
+class CTabConfigDlg : public CDlgBase
+{
+ CCtrlSpin adjust, border, outerL, outerR, outerT, outerB, width, xpad, ypad;
+
+public:
+ CTabConfigDlg() :
+ CDlgBase(g_plugin, IDD_TABCONFIG),
+ ypad(this, IDC_SPIN1, 10, 1),
+ xpad(this, IDC_SPIN3, 10, 1),
+ width(this, IDC_TABWIDTHSPIN, 400, 50),
+ adjust(this, IDC_BOTTOMTABADJUSTSPIN, 3, -3),
+ border(this, IDC_TABBORDERSPIN, 10),
+ outerL(this, IDC_TABBORDERSPINOUTER, 50),
+ outerR(this, IDC_TABBORDERSPINOUTERRIGHT, 50),
+ outerT(this, IDC_TABBORDERSPINOUTERTOP, 40),
+ outerB(this, IDC_TABBORDERSPINOUTERBOTTOM, 40)
+ {
+ }
+
+ bool OnInitDialog() override
+ {
+ width.SetPosition(PluginConfig.tabConfig.m_fixedwidth);
+ adjust.SetPosition(PluginConfig.tabConfig.m_bottomAdjust);
+
+ border.SetPosition(M.GetByte(CSkin::m_skinEnabled ? "S_tborder" : "tborder", 2));
+ outerL.SetPosition(M.GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", 2));
+ outerR.SetPosition(M.GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", 2));
+ outerT.SetPosition(M.GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", 2));
+ outerB.SetPosition(M.GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", 2));
+
+ xpad.SetPosition(M.GetByte("x-pad", 4));
+ ypad.SetPosition(M.GetByte("y-pad", 3));
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ db_set_b(0, SRMSGMOD_T, "y-pad", ypad.GetPosition());
+ db_set_b(0, SRMSGMOD_T, "x-pad", xpad.GetPosition());
+ db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder" : "tborder", border.GetPosition());
+ db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", outerL.GetPosition());
+ db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", outerR.GetPosition());
+ db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", outerT.GetPosition());
+ db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", outerB.GetPosition());
+ db_set_dw(0, SRMSGMOD_T, "bottomadjust", adjust.GetPosition());
+
+ int fixedWidth = width.GetPosition();
+ fixedWidth = (fixedWidth < 60 ? 60 : fixedWidth);
+ db_set_dw(0, SRMSGMOD_T, "fixedwidth", fixedWidth);
+ FreeTabConfig();
+ ReloadTabConfig();
+
+ for (TContainerData* p = pFirstContainer; p; p = p->pNext) {
+ HWND hwndTab = GetDlgItem(p->m_hwnd, IDC_MSGTABS);
+ TabCtrl_SetPadding(hwndTab, xpad.GetPosition(), ypad.GetPosition());
+ RedrawWindow(hwndTab, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE);
+ }
+ return true;
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Main options dialog
class COptMainDlg : public CDlgBase
@@ -656,8 +679,8 @@ class COptLogDlg : public CDlgBase
}
public:
- COptLogDlg()
- : CDlgBase(g_plugin, IDD_OPT_MSGLOG),
+ COptLogDlg() :
+ CDlgBase(g_plugin, IDD_OPT_MSGLOG),
btnModify(this, IDC_MODIFY),
btnRtlModify(this, IDC_RTLMODIFY),
spnTrim(this, IDC_TRIMSPIN, 1000, 5),
@@ -1037,6 +1060,7 @@ public:
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"));
+ cmbEscMode.AddString(TranslateT("Do nothing (ignore Esc key)"));
cmbEscMode.SetCurSel(PluginConfig.m_EscapeCloses);
return true;
}
@@ -1445,51 +1469,47 @@ int OptInitialise(WPARAM wParam, LPARAM lParam)
TN_OptionsInitialize(wParam, lParam);
// message sessions' options
- OPTIONSDIALOGPAGE odpnew = {};
- odpnew.position = 910000000;
- odpnew.flags = ODPF_BOLDGROUPS;
- odpnew.szTitle.a = LPGEN("Message sessions");
+ OPTIONSDIALOGPAGE odp = {};
+ odp.position = 910000000;
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.szTitle.a = LPGEN("Message sessions");
- odpnew.szTab.a = LPGEN("General");
- odpnew.pDialog = new COptMainDlg();
- g_plugin.addOptions(wParam, &odpnew);
+ odp.szTab.a = LPGEN("General");
+ odp.pDialog = new COptMainDlg();
+ g_plugin.addOptions(wParam, &odp);
- odpnew.szTab.a = LPGEN("Tabs and layout");
- odpnew.pDialog = new COptTabbedDlg();
- g_plugin.addOptions(wParam, &odpnew);
+ odp.szTab.a = LPGEN("Tabs and layout");
+ odp.pDialog = new COptTabbedDlg();
+ g_plugin.addOptions(wParam, &odp);
- odpnew.szTab.a = LPGEN("Containers");
- odpnew.pDialog = new COptContainersDlg();
- g_plugin.addOptions(wParam, &odpnew);
+ odp.szTab.a = LPGEN("Containers");
+ odp.pDialog = new COptContainersDlg();
+ g_plugin.addOptions(wParam, &odp);
- odpnew.szTab.a = LPGEN("Message log");
- odpnew.pDialog = new COptLogDlg();
- g_plugin.addOptions(wParam, &odpnew);
+ odp.szTab.a = LPGEN("Message log");
+ odp.pDialog = new COptLogDlg();
+ g_plugin.addOptions(wParam, &odp);
- odpnew.szTab.a = LPGEN("Advanced tweaks");
- odpnew.pDialog = new COptAdvancedDlg();
- g_plugin.addOptions(wParam, &odpnew);
+ odp.szTab.a = LPGEN("Advanced tweaks");
+ odp.pDialog = new COptAdvancedDlg();
+ g_plugin.addOptions(wParam, &odp);
- odpnew.szGroup.a = LPGEN("Message sessions");
- odpnew.szTitle.a = LPGEN("Typing notify");
- odpnew.pDialog = new COptTypingDlg();
- g_plugin.addOptions(wParam, &odpnew);
+ odp.szGroup.a = LPGEN("Message sessions");
+ odp.szTitle.a = LPGEN("Typing notify");
+ odp.pDialog = new COptTypingDlg();
+ g_plugin.addOptions(wParam, &odp);
// skin options
- OPTIONSDIALOGPAGE odp = {};
- odp.flags = ODPF_BOLDGROUPS;
odp.position = 910000000;
odp.szGroup.a = LPGEN("Skins");
odp.szTitle.a = LPGEN("Message window");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN);
odp.szTab.a = LPGEN("Load and apply");
- odp.pfnDlgProc = DlgProcSkinOpts;
+ odp.pDialog = new CSkinOptsDlg();
g_plugin.addOptions(wParam, &odp);
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_TABCONFIG);
odp.szTab.a = LPGEN("Window layout tweaks");
- odp.pfnDlgProc = DlgProcTabConfig;
+ odp.pDialog = new CTabConfigDlg();
g_plugin.addOptions(wParam, &odp);
// popup options
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index c69714c5e9..019ee5f7d3 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -289,20 +289,6 @@ void CTabBaseDlg::SetStatusText(const wchar_t *wszText, HICON hIcon)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// service function. Invoke the user preferences dialog for the contact given (by handle) in wParam
-
-static INT_PTR SetUserPrefs(WPARAM wParam, LPARAM)
-{
- HWND hWnd = WindowList_Find(PluginConfig.hUserPrefsWindowList, wParam);
- if (hWnd) {
- SetForegroundWindow(hWnd); // already open, bring it to front
- return 0;
- }
- CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_USERPREFS_FRAME), nullptr, DlgProcUserPrefsFrame, (LPARAM)wParam);
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// service function - open the tray menu from the TTB button
static INT_PTR Service_OpenTrayMenu(WPARAM, LPARAM lParam)
diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h
index 10debe1e4e..240ebe05ab 100644
--- a/plugins/TabSRMM/src/stdafx.h
+++ b/plugins/TabSRMM/src/stdafx.h
@@ -238,8 +238,9 @@ void Chat_Options(WPARAM);
void Popup_Options(WPARAM);
void FreeLogFonts();
-INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam);
-INT_PTR SendMessageCommand_W(WPARAM wParam, LPARAM lParam);
+INT_PTR SendMessageCommand(WPARAM, LPARAM);
+INT_PTR SendMessageCommand_W(WPARAM, LPARAM);
+INT_PTR SetUserPrefs(WPARAM, LPARAM);
#define IMG_NOCHECK 0
#define IMG_CHECK 1
@@ -253,8 +254,6 @@ void TreeViewToDB(HWND hwndTree, UINT id, char *DBPath, DWORD *dwFlags);
BOOL TreeViewHandleClick(HWND hwndDlg, HWND hwndTree, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
int TSAPI TBStateConvert2Flat(int state);
int TSAPI RBStateConvert2Flat(int state);
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index 8c02a96525..62b65b675f 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -1337,108 +1337,6 @@ void TSAPI FreeTabConfig()
memset(&PluginConfig.tabConfig, 0, sizeof(PluginConfig.tabConfig));
}
-static bool tconfig_init = false;
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// options dialog for setting up tab options
-
-INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- tconfig_init = false;
- TranslateDialogDefault(hwndDlg);
- SendMessage(hwndDlg, WM_USER + 100, 0, 0);
- tconfig_init = true;
- return TRUE;
-
- case WM_USER + 100:
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPIN, UDM_SETRANGE, 0, MAKELONG(10, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPIN, UDM_SETPOS, 0, (int)M.GetByte(CSkin::m_skinEnabled ? "S_tborder" : "tborder", 2));
- SetDlgItemInt(hwndDlg, IDC_TABBORDER, (int)M.GetByte(CSkin::m_skinEnabled ? "S_tborder" : "tborder", 2), FALSE);
-
- SendDlgItemMessage(hwndDlg, IDC_BOTTOMTABADJUSTSPIN, UDM_SETRANGE, 0, MAKELONG(3, -3));
- SendDlgItemMessage(hwndDlg, IDC_BOTTOMTABADJUSTSPIN, UDM_SETPOS, 0, PluginConfig.tabConfig.m_bottomAdjust);
- SetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, PluginConfig.tabConfig.m_bottomAdjust, TRUE);
-
- SendDlgItemMessage(hwndDlg, IDC_TABWIDTHSPIN, UDM_SETRANGE, 0, MAKELONG(400, 50));
- SendDlgItemMessage(hwndDlg, IDC_TABWIDTHSPIN, UDM_SETPOS, 0, PluginConfig.tabConfig.m_fixedwidth);
- SetDlgItemInt(hwndDlg, IDC_TABWIDTH, PluginConfig.tabConfig.m_fixedwidth, TRUE);
-
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTER, UDM_SETRANGE, 0, MAKELONG(50, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERRIGHT, UDM_SETRANGE, 0, MAKELONG(50, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERTOP, UDM_SETRANGE, 0, MAKELONG(40, 0));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERBOTTOM, UDM_SETRANGE, 0, MAKELONG(40, 0));
-
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTER, UDM_SETPOS, 0, (int)M.GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", 2));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERRIGHT, UDM_SETPOS, 0, (int)M.GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", 2));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERTOP, UDM_SETPOS, 0, (int)M.GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", 2));
- SendDlgItemMessage(hwndDlg, IDC_TABBORDERSPINOUTERBOTTOM, UDM_SETPOS, 0, (int)M.GetByte(CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", 2));
-
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(10, 1));
- SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETRANGE, 0, MAKELONG(10, 1));
- SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_SETPOS, 0, (LPARAM)M.GetByte("y-pad", 3));
- SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETPOS, 0, (LPARAM)M.GetByte("x-pad", 4));
- SetDlgItemInt(hwndDlg, IDC_TABPADDING, (int)M.GetByte("y-pad", 3), FALSE);
- SetDlgItemInt(hwndDlg, IDC_HTABPADDING, (int)M.GetByte("x-pad", 4), FALSE);
- return 0;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- BOOL translated;
-
- db_set_b(0, SRMSGMOD_T, "y-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_TABPADDING, nullptr, FALSE)));
- db_set_b(0, SRMSGMOD_T, "x-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_HTABPADDING, nullptr, FALSE)));
- db_set_b(0, SRMSGMOD_T, "tborder", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDER, &translated, FALSE));
- db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTER, &translated, FALSE));
- db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERRIGHT, &translated, FALSE));
- db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_top" : "tborder_outer_top", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERTOP, &translated, FALSE));
- db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_bottom" : "tborder_outer_bottom", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERBOTTOM, &translated, FALSE));
- db_set_dw(0, SRMSGMOD_T, "bottomadjust", GetDlgItemInt(hwndDlg, IDC_BOTTOMTABADJUST, &translated, TRUE));
-
- int fixedWidth = GetDlgItemInt(hwndDlg, IDC_TABWIDTH, &translated, FALSE);
- fixedWidth = (fixedWidth < 60 ? 60 : fixedWidth);
- db_set_dw(0, SRMSGMOD_T, "fixedwidth", fixedWidth);
- FreeTabConfig();
- ReloadTabConfig();
-
- for (TContainerData *p = pFirstContainer; p; p = p->pNext) {
- HWND hwndTab = GetDlgItem(p->m_hwnd, IDC_MSGTABS);
- TabCtrl_SetPadding(hwndTab, GetDlgItemInt(hwndDlg, IDC_HTABPADDING, nullptr, FALSE), GetDlgItemInt(hwndDlg, IDC_TABPADDING, nullptr, FALSE));
- RedrawWindow(hwndTab, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE);
- }
- return TRUE;
- }
- }
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_TABWIDTH:
- case IDC_TABPADDING:
- case IDC_HTABPADDING:
- case IDC_TABBORDER:
- case IDC_TABBORDEROUTER:
- case IDC_TABBORDEROUTERBOTTOM:
- case IDC_TABBORDEROUTERRIGHT:
- case IDC_TABBORDEROUTERTOP:
- if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
- return TRUE;
- break;
- }
- if (tconfig_init)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
- case WM_DESTROY:
- tconfig_init = false;
- }
- return FALSE;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// register the new tab control as a window class (TSTabCtrlClass)
diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp
index c210ebecc5..d8c947e8f8 100644
--- a/plugins/TabSRMM/src/userprefs.cpp
+++ b/plugins/TabSRMM/src/userprefs.cpp
@@ -397,7 +397,7 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA
//
// @return LRESULT (ignored for dialog procs, use DWLP_MSGRESULT)
-INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
HWND hwndTab = GetDlgItem(hwndDlg, IDC_OPTIONSTAB);
@@ -498,3 +498,17 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
return FALSE;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// service function. Invokes the user preferences dialog for the contact given (by handle) in wParam
+
+INT_PTR SetUserPrefs(WPARAM wParam, LPARAM)
+{
+ HWND hWnd = WindowList_Find(PluginConfig.hUserPrefsWindowList, wParam);
+ if (hWnd) {
+ SetForegroundWindow(hWnd); // already open, bring it to front
+ return 0;
+ }
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_USERPREFS_FRAME), nullptr, DlgProcUserPrefsFrame, (LPARAM)wParam);
+ return 0;
+}
diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h
index 80b419838f..30740a8842 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 13
+#define __BUILD_NUM 14
#include <stdver.h>