summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src/chat
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-07 15:09:49 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-07 18:44:33 +0300
commit0042f7550ab3d69d742c3ef90383fcdff446f850 (patch)
tree770478eb8fe83c9a41f50db3a399993b4da0f99d /plugins/Scriver/src/chat
parentcbceb59a83a41f05b1b1a7812d10bc4940d4d303 (diff)
splitter data removed from common chat session settings
Diffstat (limited to 'plugins/Scriver/src/chat')
-rw-r--r--plugins/Scriver/src/chat/main.cpp2
-rw-r--r--plugins/Scriver/src/chat/options.cpp94
-rw-r--r--plugins/Scriver/src/chat/window.cpp102
3 files changed, 101 insertions, 97 deletions
diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp
index 41cf8b408b..15356fcef1 100644
--- a/plugins/Scriver/src/chat/main.cpp
+++ b/plugins/Scriver/src/chat/main.cpp
@@ -142,8 +142,6 @@ int Chat_Load()
int Chat_Unload(void)
{
- db_set_w(NULL, CHAT_MODULE, "SplitterX", (WORD)g_Settings.iSplitterX);
-
DestroyMenu(g_hMenu);
return 0;
}
diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp
index a9b59f3005..8893f699dd 100644
--- a/plugins/Scriver/src/chat/options.cpp
+++ b/plugins/Scriver/src/chat/options.cpp
@@ -131,9 +131,9 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, struct branch_t *branch
tvis.item.pszText = TranslateW(branch[i].szDescr);
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
if (branch[i].iMode)
- iState = ((db_get_dw(NULL, CHAT_MODULE, branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode) != 0 ? 2 : 1;
+ iState = ((db_get_dw(0, CHAT_MODULE, branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode) != 0 ? 2 : 1;
else
- iState = db_get_b(NULL, CHAT_MODULE, branch[i].szDBName, branch[i].bDefault) != 0 ? 2 : 1;
+ iState = db_get_b(0, CHAT_MODULE, branch[i].szDBName, branch[i].bDefault) != 0 ? 2 : 1;
tvis.item.state = INDEXTOSTATEIMAGEMASK(iState);
branch[i].hItem = TreeView_InsertItem(hwndTree, &tvis);
}
@@ -154,9 +154,9 @@ static void SaveBranch(HWND hwndTree, struct branch_t *branch, int nValues)
iState |= branch[i].iMode;
if (iState&GC_EVENT_ADDSTATUS)
iState |= GC_EVENT_REMOVESTATUS;
- db_set_dw(NULL, CHAT_MODULE, branch[i].szDBName, (DWORD)iState);
+ db_set_dw(0, CHAT_MODULE, branch[i].szDBName, (DWORD)iState);
}
- else db_set_b(NULL, CHAT_MODULE, branch[i].szDBName, bChecked);
+ else db_set_b(0, CHAT_MODULE, branch[i].szDBName, bChecked);
}
}
@@ -225,7 +225,7 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p
static void InitSetting(wchar_t **ppPointer, char *pszSetting, wchar_t *pszDefault)
{
DBVARIANT dbv;
- if (!db_get_ws(NULL, CHAT_MODULE, pszSetting, &dbv)) {
+ if (!db_get_ws(0, CHAT_MODULE, pszSetting, &dbv)) {
replaceStrW(*ppPointer, dbv.ptszVal);
db_free(&dbv);
}
@@ -243,9 +243,9 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(255, 10));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12), 0));
- hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance and functionality of chat windows"), db_get_b(NULL, CHAT_MODULE, "Branch1Exp", 0) ? TRUE : FALSE);
- hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Icons to display in the tray"), db_get_b(NULL, CHAT_MODULE, "Branch5Exp", 0) ? TRUE : FALSE);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12), 0));
+ hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance and functionality of chat windows"), db_get_b(0, CHAT_MODULE, "Branch1Exp", 0) ? TRUE : FALSE);
+ hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Icons to display in the tray"), db_get_b(0, CHAT_MODULE, "Branch5Exp", 0) ? TRUE : FALSE);
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, branch1, _countof(branch1), 0);
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, branch4, _countof(branch4), 0x1000);
SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0);
@@ -314,15 +314,15 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
if (iLen > 0) {
ptrA pszText((char*)mir_alloc(iLen + 1));
GetDlgItemTextA(hwndDlg, IDC_CHAT_GROUP, pszText, iLen + 1);
- db_set_s(NULL, CHAT_MODULE, "AddToGroup", pszText);
+ db_set_s(0, CHAT_MODULE, "AddToGroup", pszText);
}
- else db_set_s(NULL, CHAT_MODULE, "AddToGroup", "");
+ else db_set_s(0, CHAT_MODULE, "AddToGroup", "");
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
if (iLen > 0)
- db_set_b(NULL, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen);
+ db_set_b(0, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen);
else
- db_unset(NULL, CHAT_MODULE, "NicklistRowDist");
+ db_unset(0, CHAT_MODULE, "NicklistRowDist");
SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch1, _countof(branch1));
SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch4, _countof(branch4));
@@ -335,9 +335,9 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
case WM_DESTROY:
BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(NULL, CHAT_MODULE, "Branch1Exp", b);
+ db_set_b(0, CHAT_MODULE, "Branch1Exp", b);
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(NULL, CHAT_MODULE, "Branch5Exp", b);
+ db_set_b(0, CHAT_MODULE, "Branch5Exp", b);
break;
}
return FALSE;
@@ -353,9 +353,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LogLimit", 100), 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(10000, 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LoggingLimit", 100), 0));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(db_get_w(0, CHAT_MODULE, "LoggingLimit", 100), 0));
{
wchar_t tszTemp[MAX_PATH];
PathToRelativeW(g_Settings.pszLogDir, tszTemp);
@@ -414,8 +414,8 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIMIT), g_Settings.bLoggingEnabled ? TRUE : FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIMITTEXT2), g_Settings.bLoggingEnabled ? TRUE : FALSE);
- hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance"), db_get_b(NULL, CHAT_MODULE, "Branch2Exp", 0) ? TRUE : FALSE);
- hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Default events to show in new chat rooms if the 'event filter' is enabled"), db_get_b(NULL, CHAT_MODULE, "Branch3Exp", 0) ? TRUE : FALSE);
+ hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance"), db_get_b(0, CHAT_MODULE, "Branch2Exp", 0) ? TRUE : FALSE);
+ hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Default events to show in new chat rooms if the 'event filter' is enabled"), db_get_b(0, CHAT_MODULE, "Branch3Exp", 0) ? TRUE : FALSE);
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2, branch2, _countof(branch2), 0x0);
FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading3, branch3, _countof(branch3), 0x03E0);
SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0);
@@ -529,22 +529,22 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
*p2 = ' ';
p2 = wcschr(ptszText, (wchar_t)',');
}
- db_set_ws(NULL, CHAT_MODULE, "HighlightWords", ptszText);
+ db_set_ws(0, CHAT_MODULE, "HighlightWords", ptszText);
mir_free(ptszText);
}
}
- else db_unset(NULL, CHAT_MODULE, "HighlightWords");
+ 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(NULL, CHAT_MODULE, "LogDirectory", pszText1);
+ db_set_ws(0, CHAT_MODULE, "LogDirectory", pszText1);
free(pszText1);
}
else {
mir_wstrncpy(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH);
- db_unset(NULL, CHAT_MODULE, "LogDirectory");
+ db_unset(0, CHAT_MODULE, "LogDirectory");
}
pci->SM_InvalidateLogDirectories();
@@ -552,57 +552,57 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
if (iLen > 0) {
pszText = (char*)mir_realloc(pszText, iLen + 1);
GetDlgItemTextA(hwndDlg, IDC_CHAT_LOGTIMESTAMP, pszText, iLen + 1);
- db_set_s(NULL, CHAT_MODULE, "LogTimestamp", pszText);
+ db_set_s(0, CHAT_MODULE, "LogTimestamp", pszText);
}
- else db_unset(NULL, CHAT_MODULE, "LogTimestamp");
+ else db_unset(0, CHAT_MODULE, "LogTimestamp");
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(NULL, CHAT_MODULE, "HeaderTime", pszText);
+ db_set_s(0, CHAT_MODULE, "HeaderTime", pszText);
}
- else db_unset(NULL, CHAT_MODULE, "HeaderTime");
+ else db_unset(0, CHAT_MODULE, "HeaderTime");
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(NULL, CHAT_MODULE, "HeaderIncoming", pszText);
+ db_set_s(0, CHAT_MODULE, "HeaderIncoming", pszText);
}
- else db_unset(NULL, CHAT_MODULE, "HeaderIncoming");
+ 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(NULL, CHAT_MODULE, "HeaderOutgoing", pszText);
+ db_set_s(0, CHAT_MODULE, "HeaderOutgoing", pszText);
}
- else db_unset(NULL, CHAT_MODULE, "HeaderOutgoing");
+ else db_unset(0, CHAT_MODULE, "HeaderOutgoing");
g_Settings.bHighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHAT_HIGHLIGHT) == BST_CHECKED ? TRUE : FALSE;
- db_set_b(NULL, CHAT_MODULE, "HighlightEnabled", (BYTE)g_Settings.bHighlightEnabled);
+ 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(NULL, CHAT_MODULE, "LoggingEnabled", (BYTE)g_Settings.bLoggingEnabled);
+ db_set_b(0, CHAT_MODULE, "LoggingEnabled", (BYTE)g_Settings.bLoggingEnabled);
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0);
- db_set_w(NULL, CHAT_MODULE, "LogLimit", (WORD)iLen);
+ db_set_w(0, CHAT_MODULE, "LogLimit", (WORD)iLen);
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0);
- db_set_w(NULL, CHAT_MODULE, "LoggingLimit", (WORD)iLen);
+ 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));
mir_free(pszText);
- g_Settings.dwIconFlags = db_get_dw(NULL, CHAT_MODULE, "IconFlags", 0x0000);
- g_Settings.dwTrayIconFlags = db_get_dw(NULL, CHAT_MODULE, "TrayIconFlags", 0x1000);
- g_Settings.dwPopupFlags = db_get_dw(NULL, CHAT_MODULE, "PopupFlags", 0x0000);
- g_Settings.bStripFormat = db_get_b(NULL, CHAT_MODULE, "TrimFormatting", 0) != 0;
- g_Settings.bTrayIconInactiveOnly = db_get_b(NULL, CHAT_MODULE, "TrayIconInactiveOnly", 1) != 0;
- g_Settings.bPopupInactiveOnly = db_get_b(NULL, CHAT_MODULE, "PopUpInactiveOnly", 1) != 0;
- g_Settings.bLogIndentEnabled = (db_get_b(NULL, 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();
@@ -624,9 +624,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
}
BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(NULL, CHAT_MODULE, "Branch2Exp", b);
+ db_set_b(0, CHAT_MODULE, "Branch2Exp", b);
b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading3, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0;
- db_set_b(NULL, CHAT_MODULE, "Branch3Exp", b);
+ db_set_b(0, CHAT_MODULE, "Branch3Exp", b);
break;
}
return FALSE;
@@ -704,16 +704,16 @@ INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA
iLen = 1;
g_Settings.iPopupStyle = iLen;
- db_set_b(NULL, CHAT_MODULE, "PopupStyle", (BYTE)iLen);
+ db_set_b(0, CHAT_MODULE, "PopupStyle", (BYTE)iLen);
iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN1, UDM_GETPOS, 0, 0);
g_Settings.iPopupTimeout = iLen;
- db_set_w(NULL, CHAT_MODULE, "PopupTimeout", (WORD)iLen);
+ db_set_w(0, CHAT_MODULE, "PopupTimeout", (WORD)iLen);
g_Settings.crPUBkgColour = SendDlgItemMessage(hwndDlg, IDC_CHAT_BKG, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, CHAT_MODULE, "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg, IDC_CHAT_BKG, CPM_GETCOLOUR, 0, 0));
+ db_set_dw(0, CHAT_MODULE, "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg, IDC_CHAT_BKG, CPM_GETCOLOUR, 0, 0));
g_Settings.crPUTextColour = SendDlgItemMessage(hwndDlg, IDC_CHAT_TEXT, CPM_GETCOLOUR, 0, 0);
- db_set_dw(NULL, CHAT_MODULE, "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg, IDC_CHAT_TEXT, CPM_GETCOLOUR, 0, 0));
+ db_set_dw(0, CHAT_MODULE, "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg, IDC_CHAT_TEXT, CPM_GETCOLOUR, 0, 0));
SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch6, _countof(branch6));
}
return TRUE;
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 2949d4151b..896457b7f6 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -158,11 +158,11 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
dat->szSearchQuery = NULL;
mir_free(dat->szSearchResult);
dat->szSearchResult = NULL;
- if ((isCtrl != 0) ^ (0 != db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))) {
+ if ((isCtrl != 0) ^ (0 != db_get_b(0, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))) {
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
}
- if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER)) {
+ if (db_get_b(0, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER)) {
if (dat->lastEnterTime + 2 < time(NULL))
dat->lastEnterTime = time(NULL);
else {
@@ -316,7 +316,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (pci->MM_FindModule(si->pszModule) && pci->MM_FindModule(si->pszModule)->bBkgColor) {
int index = pci->GetColorIndex(si->pszModule, cf.crBackColor);
- COLORREF crB = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ COLORREF crB = db_get_dw(0, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
u = IsDlgButtonChecked(GetParent(hwnd), IDC_BKGCOLOR);
if (index >= 0) {
@@ -445,7 +445,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
{
switch (msg) {
case WM_RBUTTONUP:
- if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) != 0) {
+ if (db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) != 0) {
if (GetDlgItem(GetParent(hwnd), IDC_FILTER) == hwnd)
SendMessage(GetParent(hwnd), GC_SHOWFILTERMENU, 0, 0);
if (GetDlgItem(GetParent(hwnd), IDC_COLOR) == hwnd)
@@ -678,11 +678,11 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case ID_MESS:
- pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0);
break;
default:
- pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_NICKLISTMENU, ui, nullptr, uID);
+ pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_NICKLISTMENU, ui, NULL, uID);
break;
}
DestroyGCMenu(&hMenu, 1);
@@ -710,7 +710,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
if (index != LB_ERR) {
USERINFO *ui = pci->SM_GetUserFromIndex(pDlg->m_si->ptszID, pDlg->m_si->pszModule, index);
- pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0);
}
break;
}
@@ -807,10 +807,10 @@ void CChatRoomDlg::MessageDialogResize(int w, int h)
int hSplitterMinTop = TOOLBAR_HEIGHT + m_minLogBoxHeight, hSplitterMinBottom = m_minEditBoxHeight;
int toolbarHeight = bToolbar ? TOOLBAR_HEIGHT : 0;
- if (h - m_si->iSplitterY < hSplitterMinTop)
- m_si->iSplitterY = h - hSplitterMinTop;
- if (m_si->iSplitterY < hSplitterMinBottom)
- m_si->iSplitterY = hSplitterMinBottom;
+ if (h - m_pParent->iSplitterY < hSplitterMinTop)
+ m_pParent->iSplitterY = h - hSplitterMinTop;
+ if (m_pParent->iSplitterY < hSplitterMinBottom)
+ m_pParent->iSplitterY = hSplitterMinBottom;
ShowWindow(m_splitterX.GetHwnd(), bNick ? SW_SHOW : SW_HIDE);
if (m_si->iType != GCW_SERVER)
@@ -830,15 +830,15 @@ void CChatRoomDlg::MessageDialogResize(int w, int h)
m_btnChanMgr.Enable(pci->MM_FindModule(m_si->pszModule)->bChanMgr);
}
- HDWP hdwp = BeginDeferWindowPos(5);
- int toolbarTopY = bToolbar ? h - m_si->iSplitterY - toolbarHeight : h - m_si->iSplitterY;
+ int toolbarTopY = bToolbar ? h - m_pParent->iSplitterY - toolbarHeight : h - m_pParent->iSplitterY;
int logBottom = (m_hwndIeview != NULL) ? toolbarTopY / 2 : toolbarTopY;
- hdwp = DeferWindowPos(hdwp, m_log.GetHwnd(), 0, 1, 0, bNick ? w - m_si->iSplitterX - 1 : w - 2, logBottom, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, m_nickList.GetHwnd(), 0, w - m_si->iSplitterX + 2, 0, m_si->iSplitterX - 3, toolbarTopY, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, m_splitterX.GetHwnd(), 0, w - m_si->iSplitterX, 1, 2, toolbarTopY - 1, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, m_splitterY.GetHwnd(), 0, 0, h - m_si->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, m_message.GetHwnd(), 0, 1, h - m_si->iSplitterY + SPLITTER_HEIGHT, w - 2, m_si->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
+ HDWP hdwp = BeginDeferWindowPos(5);
+ hdwp = DeferWindowPos(hdwp, m_log.GetHwnd(), 0, 1, 0, bNick ? w - m_pParent->iSplitterX - 1 : w - 2, logBottom, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_nickList.GetHwnd(), 0, w - m_pParent->iSplitterX + 2, 0, m_pParent->iSplitterX - 3, toolbarTopY, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_splitterX.GetHwnd(), 0, w - m_pParent->iSplitterX, 1, 2, toolbarTopY - 1, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_splitterY.GetHwnd(), 0, 0, h - m_pParent->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_message.GetHwnd(), 0, 1, h - m_pParent->iSplitterY + SPLITTER_HEIGHT, w - 2, m_pParent->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
EndDeferWindowPos(hdwp);
SetButtonsPos(m_hwnd, m_hContact, bToolbar);
@@ -851,7 +851,7 @@ void CChatRoomDlg::MessageDialogResize(int w, int h)
ieWindow.hwnd = m_hwndIeview;
ieWindow.x = 0;
ieWindow.y = logBottom + 1;
- ieWindow.cx = bNick ? w - m_si->iSplitterX : w;
+ ieWindow.cx = bNick ? w - m_pParent->iSplitterX : w;
ieWindow.cy = logBottom;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
@@ -903,6 +903,7 @@ CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si)
m_nickList.OnDblClick = Callback(this, &CChatRoomDlg::onDblClick_List);
m_message.OnChange = Callback(this, &CChatRoomDlg::onChange_Message);
+
m_splitterX.OnChange = Callback(this, &CChatRoomDlg::OnSplitterX);
m_splitterY.OnChange = Callback(this, &CChatRoomDlg::OnSplitterY);
}
@@ -912,6 +913,7 @@ void CChatRoomDlg::OnInitDialog()
NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
+ m_pParent = (ParentWindowData *)GetWindowLongPtr(m_hwndParent, GWLP_USERDATA);
RichUtil_SubClass(m_message.GetHwnd());
RichUtil_SubClass(m_log.GetHwnd());
@@ -926,10 +928,16 @@ void CChatRoomDlg::OnInitDialog()
Srmm_CreateToolbarIcons(m_hwnd, BBBF_ISCHATBUTTON);
- RECT minEditInit;
- GetWindowRect(m_message.GetHwnd(), &minEditInit);
- m_minEditBoxHeight = minEditInit.bottom - minEditInit.top;
- m_minLogBoxHeight = m_minEditBoxHeight;
+ RECT rc;
+ GetWindowRect(m_message.GetHwnd(), &rc);
+ m_minLogBoxHeight = m_minEditBoxHeight = rc.bottom - rc.top;
+ if (m_pParent->iSplitterY == -1)
+ m_pParent->iSplitterY = m_minEditBoxHeight;
+
+ if (m_pParent->iSplitterX == -1) {
+ GetWindowRect(m_nickList.GetHwnd(), &rc);
+ m_pParent->iSplitterX = rc.right - rc.left;
+ }
m_message.SendMsg(EM_SUBCLASSED, 0, 0);
m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE);
@@ -940,7 +948,7 @@ void CChatRoomDlg::OnInitDialog()
m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
m_log.SendMsg(EM_AUTOURLDETECT, 1, 0);
- if (db_get_b(NULL, CHAT_MODULE, "UseIEView", 0)) {
+ if (db_get_b(0, CHAT_MODULE, "UseIEView", 0)) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_CREATE;
ieWindow.dwMode = IEWM_CHAT;
@@ -965,7 +973,7 @@ void CChatRoomDlg::OnInitDialog()
SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(m_hwndParent, CM_ADDCHILD, (WPARAM)m_hwnd, m_hContact);
+ SendMessage(m_hwndParent, CM_ADDCHILD, (WPARAM)this, 0);
PostMessage(m_hwnd, GC_UPDATENICKLIST, 0, 0);
NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN);
}
@@ -994,21 +1002,18 @@ void CChatRoomDlg::OnSplitterX(CSplitter *pSplitter)
RECT rc;
GetClientRect(m_hwnd, &rc);
- m_si->iSplitterX = rc.right - pSplitter->GetPos() + 1;
- if (m_si->iSplitterX < 35)
- m_si->iSplitterX = 35;
- if (m_si->iSplitterX > rc.right - rc.left - 35)
- m_si->iSplitterX = rc.right - rc.left - 35;
- g_Settings.iSplitterX = m_si->iSplitterX;
+ m_pParent->iSplitterX = rc.right - pSplitter->GetPos() + 1;
+ if (m_pParent->iSplitterX < 35)
+ m_pParent->iSplitterX = 35;
+ if (m_pParent->iSplitterX > rc.right - rc.left - 35)
+ m_pParent->iSplitterX = rc.right - rc.left - 35;
}
void CChatRoomDlg::OnSplitterY(CSplitter *pSplitter)
{
RECT rc;
GetClientRect(m_hwnd, &rc);
-
- m_si->iSplitterY = rc.bottom - pSplitter->GetPos();
- g_Settings.iSplitterY = m_si->iSplitterY;
+ m_pParent->iSplitterY = rc.bottom - pSplitter->GetPos();
}
void CChatRoomDlg::onDblClick_List(CCtrlListBox*)
@@ -1034,7 +1039,7 @@ void CChatRoomDlg::onDblClick_List(CCtrlListBox*)
m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)pszName);
PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
}
- else pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0);
+ else pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0);
}
}
@@ -1111,7 +1116,7 @@ void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton)
m_si->bFilterEnabled = !m_si->bFilterEnabled;
pButton->SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(m_si->bFilterEnabled ? "chat_filter" : "chat_filter2"));
- if (m_si->bFilterEnabled && db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
+ if (m_si->bFilterEnabled && db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWFILTERMENU, 0, 0);
else
SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0);
@@ -1151,7 +1156,7 @@ void CChatRoomDlg::onClick_Color(CCtrlButton *pButton)
cf.dwEffects = 0;
if (IsDlgButtonChecked(m_hwnd, IDC_COLOR)) {
- if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
+ if (db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_COLOR);
else if (m_si->bFGSet) {
cf.dwMask = CFM_COLOR;
@@ -1185,7 +1190,7 @@ void CChatRoomDlg::onClick_BkColor(CCtrlButton *pButton)
cf.dwEffects = 0;
if (IsDlgButtonChecked(m_hwnd, IDC_BKGCOLOR)) {
- if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
+ if (db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_BKGCOLOR);
else if (m_si->bBGSet) {
cf.dwMask = CFM_BACKCOLOR;
@@ -1198,7 +1203,7 @@ void CChatRoomDlg::onClick_BkColor(CCtrlButton *pButton)
}
else {
cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = (COLORREF)db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ cf.crBackColor = (COLORREF)db_get_dw(0, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
if (pInfo->bSingleFormat)
m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
else
@@ -1254,18 +1259,18 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
cf.dwMask = CFM_COLOR | CFM_BOLD | CFM_UNDERLINE | CFM_BACKCOLOR;
cf.dwEffects = 0;
cf.crTextColor = crFore;
- cf.crBackColor = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
- m_message.SendMsg(EM_SETBKGNDCOLOR, 0, db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
+ cf.crBackColor = db_get_dw(0, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ m_message.SendMsg(EM_SETBKGNDCOLOR, 0, db_get_dw(0, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
m_message.SendMsg(WM_SETFONT, (WPARAM)g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
{
// nicklist
int ih = GetTextPixelSize(L"AQG_glo'", g_Settings.UserListFont, FALSE);
int ih2 = GetTextPixelSize(L"AQG_glo'", g_Settings.UserListHeadingsFont, FALSE);
- int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12);
+ int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12);
int font = ih > ih2 ? ih : ih2;
// make sure we have space for icon!
- if (db_get_b(NULL, CHAT_MODULE, "ShowContactStatus", 0))
+ if (db_get_b(0, CHAT_MODULE, "ShowContactStatus", 0))
font = font > 16 ? font : 16;
m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font);
@@ -1345,7 +1350,8 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (IsIconic(m_hwnd)) break;
if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) {
- GetClientRect(m_hwnd, &rc);
+ GetClientRect(m_pParent->hwndTabs, &rc);
+ TabCtrl_AdjustRect(m_pParent->hwndTabs, false, &rc);
MessageDialogResize(rc.right - rc.left, rc.bottom - rc.top);
}
break;
@@ -1457,9 +1463,9 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
int ih = GetTextPixelSize(L"AQGgl'", g_Settings.UserListFont, FALSE);
int ih2 = GetTextPixelSize(L"AQGg'", g_Settings.UserListHeadingsFont, FALSE);
int font = ih > ih2 ? ih : ih2;
- int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12);
+ int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12);
// make sure we have space for icon!
- if (db_get_b(NULL, CHAT_MODULE, "ShowContactStatus", 0))
+ if (db_get_b(0, CHAT_MODULE, "ShowContactStatus", 0))
font = font > 16 ? font : 16;
mis->itemHeight = height > font ? height : font;
}
@@ -1572,7 +1578,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
goto LABEL_SHOWWINDOW;
case SESSION_INITDONE:
- if (db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) != 0)
+ if (db_get_b(0, CHAT_MODULE, "PopupOnJoin", 0) != 0)
return TRUE;
// fall through
case WINDOW_VISIBLE:
@@ -1700,7 +1706,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_GETMINMAXINFO:
{
MINMAXINFO *mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = m_si->iSplitterX + 43;
+ mmi->ptMinTrackSize.x = m_pParent->iSplitterX + 43;
if (mmi->ptMinTrackSize.x < 350)
mmi->ptMinTrackSize.x = 350;