From f4fac2038f723df23d1771e8632ad3d74357f8e5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 19 Jan 2014 21:40:51 +0000 Subject: - chat log background color setting merged with kernel chats; - constants for chat modules git-svn-id: http://svn.miranda-ng.org/main/trunk@7780 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_chat_int.h | 3 + plugins/Scriver/src/chat/main.cpp | 4 +- plugins/Scriver/src/chat/options.cpp | 94 ++++++++++++------------ plugins/Scriver/src/chat/window.cpp | 20 +++--- plugins/TabSRMM/src/chat/main.cpp | 104 ++++++++++++++------------- plugins/TabSRMM/src/chat/muchighlight.cpp | 26 +++---- plugins/TabSRMM/src/chat/options.cpp | 108 ++++++++++++++-------------- plugins/TabSRMM/src/chat/tools.cpp | 20 +++--- plugins/TabSRMM/src/chat/window.cpp | 56 +++++++-------- plugins/TabSRMM/src/eventpopups.cpp | 8 +-- plugins/TabSRMM/src/globals.cpp | 2 +- plugins/TabSRMM/src/infopanel.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/msgs.h | 2 - plugins/TabSRMM/src/themeio.cpp | 53 +++++++------- src/core/stdchat/src/main.cpp | 32 ++++----- src/core/stdchat/src/options.cpp | 116 +++++++++++++++--------------- src/core/stdchat/src/tools.cpp | 2 +- src/core/stdchat/src/window.cpp | 52 +++++++------- src/modules/chat/chat_opts.cpp | 82 ++++++++++----------- src/modules/chat/chat_svc.cpp | 14 ++-- src/modules/chat/clist.cpp | 4 +- src/modules/chat/tools.cpp | 2 +- 23 files changed, 411 insertions(+), 397 deletions(-) diff --git a/include/m_chat_int.h b/include/m_chat_int.h index c61ae4ee0c..f541e47cbe 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -29,6 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define OPTIONS_FONTCOUNT 20 #define STATUSICONCOUNT 6 +#define CHAT_MODULE "Chat" +#define CHATFONT_MODULE "ChatFonts" + #define GC_FAKE_EVENT HANDLE(0xBABABEDA) #define GC_UPDATETITLE (WM_USER+100) diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index cfad024c45..fd40072ea0 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -138,7 +138,7 @@ static BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) static void RegisterFonts() { ColourIDT colourid = { sizeof(colourid) }; - strncpy(colourid.dbSettingsGroup, "Chat", sizeof(colourid.dbSettingsGroup)); + strncpy(colourid.dbSettingsGroup, CHAT_MODULE, sizeof(colourid.dbSettingsGroup)); _tcsncpy(colourid.group, LPGENT("Messaging")_T("/")LPGENT("Group chats"), SIZEOF(colourid.group)); strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting)); @@ -198,7 +198,7 @@ int Chat_Load() int Chat_Unload(void) { - db_set_w(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX); + 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 25db35293c..95a0642937 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 = TranslateTS(branch[i].szDescr); tvis.item.stateMask = TVIS_STATEIMAGEMASK; if (branch[i].iMode) - iState = ((db_get_dw(NULL, "Chat", branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode) != 0 ? 2 : 1; + iState = ((db_get_dw(NULL, CHAT_MODULE, branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode) != 0 ? 2 : 1; else - iState = db_get_b(NULL, "Chat", branch[i].szDBName, branch[i].bDefault) != 0 ? 2 : 1; + iState = db_get_b(NULL, 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", branch[i].szDBName, (DWORD)iState); + db_set_dw(NULL, CHAT_MODULE, branch[i].szDBName, (DWORD)iState); } - else db_set_b(NULL, "Chat", branch[i].szDBName, bChecked); + else db_set_b(NULL, 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(TCHAR **ppPointer, char *pszSetting, TCHAR *pszDefault) { DBVARIANT dbv; - if ( !db_get_ts(NULL, "Chat", pszSetting, &dbv )) { + if ( !db_get_ts(NULL, CHAT_MODULE, pszSetting, &dbv )) { replaceStrT(*ppPointer, dbv.ptszVal); db_free(&dbv); } @@ -243,9 +243,9 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa 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","NicklistRowDist",12),0)); - hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Appearance and functionality of chat windows"), db_get_b(NULL, "Chat", "Branch1Exp", 0)?TRUE:FALSE); - hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), TranslateT("Icons to display in the tray"), db_get_b(NULL, "Chat", "Branch5Exp", 0)?TRUE:FALSE); + 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); FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, branch1, SIZEOF(branch1), 0); FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, branch4, SIZEOF(branch4), 0x1000); SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0); @@ -314,15 +314,15 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa if (iLen > 0) { ptrA pszText((char*)mir_alloc(iLen + 1)); GetDlgItemTextA(hwndDlg, IDC_CHAT_GROUP, pszText, iLen + 1); - db_set_s(NULL, "Chat", "AddToGroup", pszText); + db_set_s(NULL, CHAT_MODULE, "AddToGroup", pszText); } - else db_set_s(NULL, "Chat", "AddToGroup", ""); + else db_set_s(NULL, CHAT_MODULE, "AddToGroup", ""); iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0); if (iLen > 0) - db_set_b(NULL, "Chat", "NicklistRowDist", (BYTE)iLen); + db_set_b(NULL, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen); else - db_unset(NULL, "Chat", "NicklistRowDist"); + db_unset(NULL, CHAT_MODULE, "NicklistRowDist"); SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch1, SIZEOF(branch1)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch4, SIZEOF(branch4)); @@ -335,9 +335,9 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa case WM_DESTROY: BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading1, TVIS_EXPANDED)&TVIS_EXPANDED?1:0; - db_set_b(NULL, "Chat", "Branch1Exp", b); + db_set_b(NULL, CHAT_MODULE, "Branch1Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, TVIS_EXPANDED)&TVIS_EXPANDED?1:0; - db_set_b(NULL, "Chat", "Branch5Exp", b); + db_set_b(NULL, CHAT_MODULE, "Branch5Exp", b); break; } return FALSE; @@ -353,9 +353,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa 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","LogLimit",100),0)); + SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN2,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,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","LoggingLimit",100),0)); + SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,CHAT_MODULE,"LoggingLimit",100),0)); { TCHAR tszTemp[MAX_PATH]; PathToRelativeT(g_Settings.pszLogDir, tszTemp); @@ -414,8 +414,8 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa 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", "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", "Branch3Exp", 0) ? 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); FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2, branch2, SIZEOF(branch2), 0x0); FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading3, branch3, SIZEOF(branch3), 0x03E0); SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0); @@ -529,22 +529,22 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa *p2 = ' '; p2 = _tcschr(ptszText, (TCHAR)','); } - db_set_ts(NULL, "Chat", "HighlightWords", ptszText); + db_set_ts(NULL, CHAT_MODULE, "HighlightWords", ptszText); mir_free(ptszText); } } - else db_unset(NULL, "Chat", "HighlightWords"); + else db_unset(NULL, CHAT_MODULE, "HighlightWords"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY)); if (iLen > 0) { TCHAR *pszText1 = (TCHAR *)malloc(iLen*sizeof(TCHAR)+2); GetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, pszText1, iLen + 1); - db_set_ts(NULL, "Chat", "LogDirectory", pszText1); + db_set_ts(NULL, CHAT_MODULE, "LogDirectory", pszText1); free(pszText1); } else { lstrcpyn(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH); - db_unset(NULL, "Chat", "LogDirectory"); + db_unset(NULL, CHAT_MODULE, "LogDirectory"); } pci->SM_InvalidateLogDirectories(); @@ -552,57 +552,57 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa if (iLen > 0) { pszText = (char*)mir_realloc(pszText, iLen + 1); GetDlgItemTextA(hwndDlg, IDC_CHAT_LOGTIMESTAMP, pszText, iLen + 1); - db_set_s(NULL, "Chat", "LogTimestamp", pszText); + db_set_s(NULL, CHAT_MODULE, "LogTimestamp", pszText); } - else db_unset(NULL, "Chat", "LogTimestamp"); + else db_unset(NULL, 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", "HeaderTime", pszText); + db_set_s(NULL, CHAT_MODULE, "HeaderTime", pszText); } - else db_unset(NULL, "Chat", "HeaderTime"); + else db_unset(NULL, 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", "HeaderIncoming", pszText); + db_set_s(NULL, CHAT_MODULE, "HeaderIncoming", pszText); } - else db_unset(NULL, "Chat", "HeaderIncoming"); + else db_unset(NULL, 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", "HeaderOutgoing", pszText); + db_set_s(NULL, CHAT_MODULE, "HeaderOutgoing", pszText); } - else db_unset(NULL, "Chat", "HeaderOutgoing"); + else db_unset(NULL, CHAT_MODULE, "HeaderOutgoing"); g_Settings.bHighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHAT_HIGHLIGHT) == BST_CHECKED ? TRUE : FALSE; - db_set_b(NULL, "Chat", "HighlightEnabled", (BYTE)g_Settings.bHighlightEnabled); + db_set_b(NULL, CHAT_MODULE, "HighlightEnabled", (BYTE)g_Settings.bHighlightEnabled); g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHAT_LOGGING) == BST_CHECKED ? TRUE : FALSE; - db_set_b(NULL, "Chat", "LoggingEnabled", (BYTE)g_Settings.bLoggingEnabled); + db_set_b(NULL, CHAT_MODULE, "LoggingEnabled", (BYTE)g_Settings.bLoggingEnabled); iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0); - db_set_w(NULL, "Chat", "LogLimit", (WORD)iLen); + db_set_w(NULL, CHAT_MODULE, "LogLimit", (WORD)iLen); iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0); - db_set_w(NULL, "Chat", "LoggingLimit", (WORD)iLen); + db_set_w(NULL, CHAT_MODULE, "LoggingLimit", (WORD)iLen); SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch2, SIZEOF(branch2)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch3, SIZEOF(branch3)); mir_free(pszText); - g_Settings.dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000); - g_Settings.dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000); - g_Settings.dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000); - g_Settings.bStripFormat = db_get_b(NULL, "Chat", "TrimFormatting", 0) != 0; - g_Settings.bTrayIconInactiveOnly = db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1) != 0; - g_Settings.bPopupInactiveOnly = db_get_b(NULL, "Chat", "PopUpInactiveOnly", 1) != 0; - g_Settings.bLogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE; + 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; pci->MM_FontsChanged(); pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); @@ -623,9 +623,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa } BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading2, TVIS_EXPANDED)&TVIS_EXPANDED?1:0; - db_set_b(NULL, "Chat", "Branch2Exp", b); + db_set_b(NULL, CHAT_MODULE, "Branch2Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading3, TVIS_EXPANDED)&TVIS_EXPANDED?1:0; - db_set_b(NULL, "Chat", "Branch3Exp", b); + db_set_b(NULL, CHAT_MODULE, "Branch3Exp", b); break; } return FALSE; @@ -703,16 +703,16 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam iLen = 1; g_Settings.iPopupStyle = iLen; - db_set_b(NULL, "Chat", "PopupStyle", (BYTE)iLen); + db_set_b(NULL, CHAT_MODULE, "PopupStyle", (BYTE)iLen); iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN1, UDM_GETPOS, 0, 0); g_Settings.iPopupTimeout = iLen; - db_set_w(NULL, "Chat", "PopupTimeout", (WORD)iLen); + db_set_w(NULL, CHAT_MODULE, "PopupTimeout", (WORD)iLen); g_Settings.crPUBkgColour = SendDlgItemMessage(hwndDlg, IDC_CHAT_BKG, CPM_GETCOLOUR, 0, 0); - db_set_dw(NULL, "Chat", "PopupColorBG", (DWORD)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)); g_Settings.crPUTextColour = SendDlgItemMessage(hwndDlg, IDC_CHAT_TEXT, CPM_GETCOLOUR, 0, 0); - db_set_dw(NULL, "Chat", "PopupColorText", (DWORD)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)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch6, SIZEOF(branch6)); } return TRUE; diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 6058e281c8..5b742b847a 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -623,7 +623,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L { switch (msg) { case WM_RBUTTONUP: - if (db_get_b(NULL, "Chat", "RightClickFilter", 0) != 0) { + if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) != 0) { if (GetDlgItem(GetParent(hwnd), IDC_CHAT_FILTER) == hwnd) SendMessage(GetParent(hwnd), GC_SHOWFILTERMENU, 0, 0); if (GetDlgItem(GetParent(hwnd), IDC_CHAT_COLOR) == hwnd) @@ -1097,7 +1097,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)* 0x7FFFFFFF, 0); SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback); - if (db_get_b(NULL, "Chat", "UseIEView", 0)) { + if (db_get_b(NULL, CHAT_MODULE, "UseIEView", 0)) { IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; ieWindow.iType = IEW_CREATE; ieWindow.dwMode = IEWM_CHAT; @@ -1158,10 +1158,10 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR // nicklist int ih = GetTextPixelSize(_T("AQG_glo'"), g_Settings.UserListFont, FALSE); int ih2 = GetTextPixelSize(_T("AQG_glo'"), g_Settings.UserListHeadingsFont, FALSE); - int height = db_get_b(NULL, "Chat", "NicklistRowDist", 12); + int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12); int font = ih > ih2 ? ih : ih2; // make sure we have space for icon! - if (db_get_b(NULL, "Chat", "ShowContactStatus", 0)) + if (db_get_b(NULL, CHAT_MODULE, "ShowContactStatus", 0)) font = font > 16 ? font : 16; SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_SETITEMHEIGHT, 0, (LPARAM)height > font ? height : font); @@ -1390,9 +1390,9 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR int ih = GetTextPixelSize(_T("AQGgl'"), g_Settings.UserListFont, FALSE); int ih2 = GetTextPixelSize(_T("AQGg'"), g_Settings.UserListHeadingsFont, FALSE); int font = ih > ih2 ? ih : ih2; - int height = db_get_b(NULL, "Chat", "NicklistRowDist", 12); + int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12); // make sure we have space for icon! - if (db_get_b(NULL, "Chat", "ShowContactStatus", 0)) + if (db_get_b(NULL, CHAT_MODULE, "ShowContactStatus", 0)) font = font > 16 ? font : 16; mis->itemHeight = height > font ? height : font; } @@ -1505,7 +1505,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR goto LABEL_SHOWWINDOW; case SESSION_INITDONE: - if (db_get_b(NULL, "Chat", "PopupOnJoin", 0) != 0) + if (db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) != 0) return TRUE; // fall through case WINDOW_VISIBLE: @@ -1824,7 +1824,7 @@ LABEL_SHOWWINDOW: si->bFilterEnabled = !si->bFilterEnabled; SendDlgItemMessage(hwndDlg, IDC_CHAT_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(si->bFilterEnabled ? "chat_filter" : "chat_filter2")); - if (si->bFilterEnabled && db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) { + if (si->bFilterEnabled && db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0) { SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0); break; } @@ -1839,7 +1839,7 @@ LABEL_SHOWWINDOW: cf.dwEffects = 0; if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BKGCOLOR)) { - if (db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) + if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0) SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_BKGCOLOR); else if (si->bBGSet) { cf.dwMask = CFM_BACKCOLOR; @@ -1872,7 +1872,7 @@ LABEL_SHOWWINDOW: break; if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_COLOR)) { - if (db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) + if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0) SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_COLOR); else if (si->bFGSet) { cf.dwMask = CFM_COLOR; diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index d591af8046..1d3bbed584 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -131,36 +131,36 @@ static void OnCreateModule(MODULEINFO *mi) static void OnLoadSettings() { - g_Settings.iEventLimitThreshold = db_get_w(NULL, "Chat", "LogLimitThreshold", 20); - g_Settings.dwIconFlags = M.GetDword("Chat", "IconFlags", 0x0000); - g_Settings.bOpenInDefault = M.GetBool("Chat", "DefaultContainer", true); - g_Settings.UserListColors[CHAT_STATUS_NORMAL] = M.GetDword(CHAT_FONTMODULE, "Font18Col", RGB(0, 0, 0)); - g_Settings.UserListColors[CHAT_STATUS_AWAY] = M.GetDword(CHAT_FONTMODULE, "Font19Col", RGB(170, 170, 170)); - g_Settings.UserListColors[CHAT_STATUS_OFFLINE] = M.GetDword(CHAT_FONTMODULE, "Font5Col", RGB(160, 90, 90)); - g_Settings.bBBCodeInPopups = M.GetByte("Chat", "BBCodeInPopups", 0) != 0; - g_Settings.bClassicIndicators = M.GetBool("Chat", "ClassicIndicators", false); - g_Settings.bLogClassicIndicators = M.GetBool("Chat", "LogClassicIndicators", false); - g_Settings.bAlternativeSorting = M.GetBool("Chat", "AlternativeSorting", true); - g_Settings.bAnnoyingHighlight = M.GetBool("Chat", "AnnoyingHighlight", false); - g_Settings.bCreateWindowOnHighlight = M.GetBool("Chat", "CreateWindowOnHighlight", true); - - g_Settings.bLogSymbols = M.GetBool("Chat", "LogSymbols", true); - g_Settings.bClickableNicks = M.GetBool("Chat", "ClickableNicks", true); - g_Settings.bColorizeNicks = M.GetBool("Chat", "ColorizeNicks", true); - g_Settings.bColorizeNicksInLog = M.GetBool("Chat", "ColorizeNicksInLog", true); - g_Settings.bScaleIcons = M.GetBool("Chat", "ScaleIcons", true); - g_Settings.bUseDividers = M.GetBool("Chat", "UseDividers", true); - g_Settings.bDividersUsePopupConfig = M.GetBool("Chat", "DividersUsePopupConfig", true); - - g_Settings.bDoubleClick4Privat = M.GetBool("Chat", "DoubleClick4Privat", false); - g_Settings.bShowContactStatus = M.GetBool("Chat", "ShowContactStatus", true); - g_Settings.bContactStatusFirst = M.GetBool("Chat", "ContactStatusFirst", false); + g_Settings.iEventLimitThreshold = db_get_w(NULL, CHAT_MODULE, "LogLimitThreshold", 20); + g_Settings.dwIconFlags = M.GetDword(CHAT_MODULE, "IconFlags", 0x0000); + g_Settings.bOpenInDefault = M.GetBool(CHAT_MODULE, "DefaultContainer", true); + g_Settings.UserListColors[CHAT_STATUS_NORMAL] = M.GetDword(CHATFONT_MODULE, "Font18Col", RGB(0, 0, 0)); + g_Settings.UserListColors[CHAT_STATUS_AWAY] = M.GetDword(CHATFONT_MODULE, "Font19Col", RGB(170, 170, 170)); + g_Settings.UserListColors[CHAT_STATUS_OFFLINE] = M.GetDword(CHATFONT_MODULE, "Font5Col", RGB(160, 90, 90)); + g_Settings.bBBCodeInPopups = M.GetByte(CHAT_MODULE, "BBCodeInPopups", 0) != 0; + g_Settings.bClassicIndicators = M.GetBool(CHAT_MODULE, "ClassicIndicators", false); + g_Settings.bLogClassicIndicators = M.GetBool(CHAT_MODULE, "LogClassicIndicators", false); + g_Settings.bAlternativeSorting = M.GetBool(CHAT_MODULE, "AlternativeSorting", true); + g_Settings.bAnnoyingHighlight = M.GetBool(CHAT_MODULE, "AnnoyingHighlight", false); + g_Settings.bCreateWindowOnHighlight = M.GetBool(CHAT_MODULE, "CreateWindowOnHighlight", true); + + g_Settings.bLogSymbols = M.GetBool(CHAT_MODULE, "LogSymbols", true); + g_Settings.bClickableNicks = M.GetBool(CHAT_MODULE, "ClickableNicks", true); + g_Settings.bColorizeNicks = M.GetBool(CHAT_MODULE, "ColorizeNicks", true); + g_Settings.bColorizeNicksInLog = M.GetBool(CHAT_MODULE, "ColorizeNicksInLog", true); + g_Settings.bScaleIcons = M.GetBool(CHAT_MODULE, "ScaleIcons", true); + g_Settings.bUseDividers = M.GetBool(CHAT_MODULE, "UseDividers", true); + g_Settings.bDividersUsePopupConfig = M.GetBool(CHAT_MODULE, "DividersUsePopupConfig", true); + + g_Settings.bDoubleClick4Privat = M.GetBool(CHAT_MODULE, "DoubleClick4Privat", false); + g_Settings.bShowContactStatus = M.GetBool(CHAT_MODULE, "ShowContactStatus", true); + g_Settings.bContactStatusFirst = M.GetBool(CHAT_MODULE, "ContactStatusFirst", false); replaceStrT(g_Settings.pszLogDir, M.getChatLogPath()); g_Settings.LogIconSize = (g_Settings.bScaleIcons) ? 12 : 16; - g_Settings.iSplitterY = db_get_w(NULL, "Chat", "splitY", 50); + g_Settings.iSplitterY = db_get_w(NULL, CHAT_MODULE, "splitY", 50); if (g_Settings.iSplitterY <= 20) g_Settings.iSplitterY = 50; @@ -183,17 +183,15 @@ static void OnLoadSettings() int ih = GetTextPixelSize(_T("AQGglo"), g_Settings.UserListFonts[CHAT_STATUS_NORMAL], false); int ih2 = GetTextPixelSize(_T("AQGglo"), g_Settings.UserListFonts[CHAT_STATUS_AWAY], false); - g_Settings.iNickListFontHeight = max(M.GetByte("Chat", "NicklistRowDist", 12), (ih > ih2 ? ih : ih2)); + g_Settings.iNickListFontHeight = max(M.GetByte(CHAT_MODULE, "NicklistRowDist", 12), (ih > ih2 ? ih : ih2)); for (int i = 0; i < 7; i++) { char szBuf[40]; mir_snprintf(szBuf, 20, "NickColor%d", i); - g_Settings.nickColors[i] = M.GetDword("Chat", szBuf, g_Settings.UserListColors[0]); + g_Settings.nickColors[i] = M.GetDword(CHAT_MODULE, szBuf, g_Settings.UserListColors[0]); } - g_Settings.nickColors[5] = M.GetDword("Chat", "NickColor5", GetSysColor(COLOR_HIGHLIGHT)); - g_Settings.nickColors[6] = M.GetDword("Chat", "NickColor6", GetSysColor(COLOR_HIGHLIGHTTEXT)); - - g_Settings.crLogBackground = M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR_MUC, SRMSGDEFSET_BKGCOLOUR); + g_Settings.nickColors[5] = M.GetDword(CHAT_MODULE, "NickColor5", GetSysColor(COLOR_HIGHLIGHT)); + g_Settings.nickColors[6] = M.GetDword(CHAT_MODULE, "NickColor6", GetSysColor(COLOR_HIGHLIGHTTEXT)); if (g_Settings.SelectionBGBrush) DeleteObject(g_Settings.SelectionBGBrush); @@ -224,28 +222,36 @@ static int CopyChatSetting(const char *szSetting, LPARAM param) static void CheckUpdate() { // already converted? - if (db_get_b(NULL, "Compatibility", "TabChatFonts", false)) + int compat = db_get_b(NULL, "Compatibility", "TabChatFonts", 0); + if (compat >= 2) return; - LIST szSettings(120); - - DBCONTACTENUMSETTINGS dbces = { 0 }; - dbces.szModule = CHAT_OLDFONTMODULE; - dbces.pfnEnumProc = CopyChatSetting; - dbces.lParam = (LPARAM)&szSettings; - CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces); - - DBVARIANT dbv; - for (int i = szSettings.getCount() - 1; i >= 0; i--) { - char *p = szSettings[i]; - db_get(NULL, CHAT_OLDFONTMODULE, p, &dbv); - db_set(NULL, CHAT_FONTMODULE, p, &dbv); - db_free(&dbv); - mir_free(p); + if (compat == 0) { + LIST szSettings(120); + + DBCONTACTENUMSETTINGS dbces = { 0 }; + dbces.szModule = CHAT_OLDFONTMODULE; + dbces.pfnEnumProc = CopyChatSetting; + dbces.lParam = (LPARAM)&szSettings; + CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces); + + DBVARIANT dbv; + for (int i = szSettings.getCount() - 1; i >= 0; i--) { + char *p = szSettings[i]; + db_get(NULL, CHAT_OLDFONTMODULE, p, &dbv); + db_set(NULL, CHATFONT_MODULE, p, &dbv); + db_free(&dbv); + mir_free(p); + } + + CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)CHAT_OLDFONTMODULE); } - CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)CHAT_OLDFONTMODULE); - db_set_b(NULL, "Compatibility", "TabChatFonts", true); + DWORD oldBackColor = db_get_dw(0, FONTMODULE, "BkgColourMUC", SRMSGDEFSET_BKGCOLOUR); + db_set_dw(NULL, CHAT_MODULE, "ColorLogBG", oldBackColor); + db_unset(0, FONTMODULE, "BkgColourMUC"); + + db_set_b(NULL, "Compatibility", "TabChatFonts", 2); } int Chat_Load() diff --git a/plugins/TabSRMM/src/chat/muchighlight.cpp b/plugins/TabSRMM/src/chat/muchighlight.cpp index f2161f769d..ca3fac39f9 100644 --- a/plugins/TabSRMM/src/chat/muchighlight.cpp +++ b/plugins/TabSRMM/src/chat/muchighlight.cpp @@ -53,17 +53,17 @@ void CMUCHighlight::init() m_fInitialized = true; - if (0 == db_get_ts(0, "Chat", "HighlightWords", &dbv)) { + if (0 == db_get_ts(0, CHAT_MODULE, "HighlightWords", &dbv)) { m_TextPatternString = dbv.ptszVal; _wsetlocale(LC_ALL, L""); wcslwr(m_TextPatternString); } - if (0 == db_get_ts(0, "Chat", "HighlightNames", &dbv)) + if (0 == db_get_ts(0, CHAT_MODULE, "HighlightNames", &dbv)) m_NickPatternString = dbv.ptszVal; - m_dwFlags = M.GetByte("Chat", "HighlightEnabled", MATCH_TEXT); - m_fHighlightMe = (M.GetByte("Chat", "HighlightMe", 1) ? true : false); + m_dwFlags = M.GetByte(CHAT_MODULE, "HighlightEnabled", MATCH_TEXT); + m_fHighlightMe = (M.GetByte(CHAT_MODULE, "HighlightMe", 1) ? true : false); __try { tokenize(m_TextPatternString, m_TextPatterns, m_iTextPatterns); @@ -260,22 +260,22 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L TranslateDialogDefault(hwndDlg); { DBVARIANT dbv = {0}; - if ( !db_get_ts(0, "Chat", "HighlightWords", &dbv)) { + if ( !db_get_ts(0, CHAT_MODULE, "HighlightWords", &dbv)) { ::SetDlgItemText(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN, dbv.ptszVal); ::db_free(&dbv); } - if ( !db_get_ts(0, "Chat", "HighlightNames", &dbv)) { + if ( !db_get_ts(0, CHAT_MODULE, "HighlightNames", &dbv)) { ::SetDlgItemText(hwndDlg, IDC_HIGHLIGHTNICKPATTERN, dbv.ptszVal); ::db_free(&dbv); } - DWORD dwFlags = M.GetByte("Chat", "HighlightEnabled", MATCH_TEXT); + 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", "HighlightMe", 1) ? 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); } @@ -317,16 +317,16 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (iLen) { szBuf = reinterpret_cast(mir_alloc((iLen + 2) * sizeof(wchar_t))); ::GetDlgItemText(hwndDlg, IDC_HIGHLIGHTNICKPATTERN, szBuf, iLen + 1); - db_set_ts(0, "Chat", "HighlightNames",szBuf); + db_set_ts(0, CHAT_MODULE, "HighlightNames",szBuf); } iLen = ::GetWindowTextLength(::GetDlgItem(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN)); if (iLen) { szBuf = reinterpret_cast(mir_realloc(szBuf, sizeof(wchar_t) * (iLen + 2))); ::GetDlgItemText(hwndDlg, IDC_HIGHLIGHTTEXTPATTERN, szBuf, iLen + 1); - db_set_ts(0, "Chat", "HighlightWords", szBuf); + db_set_ts(0, CHAT_MODULE, "HighlightWords", szBuf); } - else db_set_ts(0, "Chat", "HighlightWords", L""); + else db_set_ts(0, CHAT_MODULE, "HighlightWords", L""); mir_free(szBuf); BYTE dwFlags = (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKENABLE) ? MATCH_NICKNAME : 0) | @@ -335,8 +335,8 @@ INT_PTR CALLBACK CMUCHighlight::dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (dwFlags & MATCH_NICKNAME) dwFlags |= (::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTNICKUID) ? MATCH_UIN : 0); - db_set_b(0, "Chat", "HighlightEnabled", dwFlags); - db_set_b(0, "Chat", "HighlightMe", ::IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHTME) ? 1 : 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; diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 2ef1c550c1..3b8f73bc92 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -63,9 +63,8 @@ struct ColorOptionsList * (GetSysColor(default_color & 0x00ffffff)), not a rgb value. */ static ColorOptionsList _clrs[] = { - { 0, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), LPGENT("Group chat log background"), SRMSGSET_BKGCOLOUR_MUC, SRMSGDEFSET_BKGCOLOUR }, - { 1, LPGENT("Message Sessions"), LPGENT("Input area background"), "inputbg", SRMSGDEFSET_BKGCOLOUR }, - { 2, LPGENT("Message Sessions"), LPGENT("Log background"), SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR }, + { 0, LPGENT("Message Sessions"), LPGENT("Input area background"), "inputbg", SRMSGDEFSET_BKGCOLOUR }, + { 1, LPGENT("Message Sessions"), LPGENT("Log background"), SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR }, { 0, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), LPGENT("Outgoing background"), "outbg", SRMSGDEFSET_BKGOUTCOLOUR }, { 1, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), LPGENT("Incoming background"), "inbg", SRMSGDEFSET_BKGINCOLOUR }, { 2, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), LPGENT("Status background"), "statbg", SRMSGDEFSET_BKGCOLOUR }, @@ -223,7 +222,7 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; mir_snprintf(str, SIZEOF(str), "Font%d", i); - if ((i == 17 && !strcmp(szMod, CHAT_FONTMODULE)) || ((i == 20 || i == 21) && !strcmp(szMod, FONTMODULE))) { + if ((i == 17 && !strcmp(szMod, CHATFONT_MODULE)) || ((i == 20 || i == 21) && !strcmp(szMod, FONTMODULE))) { lf->lfCharSet = SYMBOL_CHARSET; lstrcpyn(lf->lfFaceName, _T("Webdings"), SIZEOF(lf->lfFaceName)); } @@ -264,9 +263,9 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, branch_t *branch, int n tvis.item.pszText = TranslateTS(branch[i].szDescr); tvis.item.stateMask = TVIS_STATEIMAGEMASK; if (branch[i].iMode) - iState = ((M.GetDword("Chat", branch[i].szDBName, defaultval) & branch[i].iMode) & branch[i].iMode) != 0 ? 3 : 2; + iState = ((M.GetDword(CHAT_MODULE, branch[i].szDBName, defaultval) & branch[i].iMode) & branch[i].iMode) != 0 ? 3 : 2; else - iState = M.GetByte("Chat", branch[i].szDBName, branch[i].bDefault) != 0 ? 3 : 2; + iState = M.GetByte(CHAT_MODULE, branch[i].szDBName, branch[i].bDefault) != 0 ? 3 : 2; tvis.item.state = INDEXTOSTATEIMAGEMASK(iState); branch[i].hItem = TreeView_InsertItem(hwndTree, &tvis); } @@ -288,9 +287,9 @@ static void SaveBranch(HWND hwndTree, branch_t *branch, int nValues) iState |= branch[i].iMode; if (iState & GC_EVENT_ADDSTATUS) iState |= GC_EVENT_REMOVESTATUS; - db_set_dw(0, "Chat", branch[i].szDBName, (DWORD)iState); + db_set_dw(0, CHAT_MODULE, branch[i].szDBName, (DWORD)iState); } - else db_set_b(0, "Chat", branch[i].szDBName, bChecked); + else db_set_b(0, CHAT_MODULE, branch[i].szDBName, bChecked); } } @@ -412,7 +411,7 @@ HICON LoadIconEx(int iIndex, char * pszIcoLibName, int iX, int iY) static void InitSetting(TCHAR* &ppPointer, const char *pszSetting, const TCHAR *pszDefault) { - ptrT val( db_get_tsa(NULL, "Chat", pszSetting)); + ptrT val( db_get_tsa(NULL, CHAT_MODULE, pszSetting)); replaceStrT(ppPointer, (val != NULL) ? val : pszDefault); } @@ -534,13 +533,13 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (iLen > 0) { pszText = (TCHAR*)mir_realloc(pszText, (iLen + 2) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1); - db_set_ts(NULL, "Chat", "AddToGroup", pszText); + db_set_ts(NULL, CHAT_MODULE, "AddToGroup", pszText); } - else db_set_ts(NULL, "Chat", "AddToGroup", _T("")); + else db_set_ts(NULL, CHAT_MODULE, "AddToGroup", _T("")); mir_free(pszText); - b = M.GetByte("Chat", "Tabs", 1); + b = M.GetByte(CHAT_MODULE, "Tabs", 1); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, SIZEOF(branch1)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, SIZEOF(branch2)); @@ -557,9 +556,9 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case WM_DESTROY: BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, TVIS_EXPANDED) & TVIS_EXPANDED ? 1 : 0; - db_set_b(0, "Chat", "Branch1Exp", b); + 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", "Branch2Exp", b); + db_set_b(0, CHAT_MODULE, "Branch2Exp", b); } return FALSE; } @@ -674,7 +673,7 @@ void RegisterFontServiceFonts() { } _tcsncpy(cid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(cid.group)); - strncpy(cid.dbSettingsGroup, "Chat", SIZEOF(cid.dbSettingsGroup)); + strncpy(cid.dbSettingsGroup, CHAT_MODULE, SIZEOF(cid.dbSettingsGroup)); for (int i = 0; i <= 7; i++) { mir_snprintf(szTemp, SIZEOF(szTemp), "NickColor%d", i); _tcsncpy(cid.name, chatcolorsnames[i], SIZEOF(cid.name)); @@ -693,12 +692,17 @@ void RegisterFontServiceFonts() { } ColourRegisterT(&cid); } - cid.order = 8; - _tcsncpy(cid.name, LPGENT("Userlist background"), SIZEOF(cid.name)); - strncpy(cid.setting, "ColorNicklistBG", SIZEOF(cid.setting)); + cid.order++; + _tcsncpy_s(cid.name, SIZEOF(cid.name), LPGENT("Userlist background"), _TRUNCATE); + strncpy_s(cid.setting, SIZEOF(cid.setting), "ColorNicklistBG", _TRUNCATE); cid.defcolour = SRMSGDEFSET_BKGCOLOUR; ColourRegisterT(&cid); + cid.order++; + _tcsncpy_s(cid.name, SIZEOF(cid.name), LPGENT("Group chat log background"), _TRUNCATE); + strncpy_s(cid.setting, SIZEOF(cid.setting), "ColorLogBG", _TRUNCATE); + ColourRegisterT(&cid); + // static colors (info panel, tool bar background etc...) strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup)); strncpy(cid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup)); @@ -762,9 +766,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM 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(NULL, "Chat", "LogLimit", 100), 0)); + SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, 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", "NicklistRowDist", 12), 0)); + 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); @@ -774,7 +778,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM 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(NULL, "Chat", "LoggingLimit", 100), 0)); + SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LoggingLimit", 100), 0)); Utils::enableDlgControl(hwndDlg, IDC_LIMIT, g_Settings.bLoggingEnabled); if (ServiceExists(MS_UTILS_REPLACEVARS)) { @@ -924,61 +928,61 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (iLen > 0) { TCHAR *pszText1 = (TCHAR*)mir_alloc(iLen*sizeof(TCHAR) + 2); GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText1, iLen + 1); - db_set_ts(NULL, "Chat", "LogDirectory", pszText1); + db_set_ts(NULL, CHAT_MODULE, "LogDirectory", pszText1); mir_free(pszText1); g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED; - db_set_b(0, "Chat", "LoggingEnabled", g_Settings.bLoggingEnabled); + db_set_b(0, CHAT_MODULE, "LoggingEnabled", g_Settings.bLoggingEnabled); } else { - db_unset(NULL, "Chat", "LogDirectory"); - db_set_b(0, "Chat", "LoggingEnabled", 0); + db_unset(NULL, CHAT_MODULE, "LogDirectory"); + db_set_b(0, CHAT_MODULE, "LoggingEnabled", 0); } pci->SM_InvalidateLogDirectories(); iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_GETPOS, 0, 0); - db_set_w(NULL, "Chat", "LoggingLimit", (WORD)iLen); + db_set_w(NULL, CHAT_MODULE, "LoggingLimit", (WORD)iLen); iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0); if (iLen > 0) - db_set_b(0, "Chat", "NicklistRowDist", (BYTE)iLen); + db_set_b(0, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen); else - db_unset(NULL, "Chat", "NicklistRowDist"); + db_unset(NULL, CHAT_MODULE, "NicklistRowDist"); 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(NULL, "Chat", "LogTimestamp", pszText); - } else db_unset(NULL, "Chat", "LogTimestamp"); + db_set_s(NULL, CHAT_MODULE, "LogTimestamp", pszText); + } else db_unset(NULL, CHAT_MODULE, "LogTimestamp"); 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(NULL, "Chat", "HeaderTime", pszText); - } else db_unset(NULL, "Chat", "HeaderTime"); + db_set_s(NULL, CHAT_MODULE, "HeaderTime", pszText); + } else db_unset(NULL, CHAT_MODULE, "HeaderTime"); 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(NULL, "Chat", "HeaderIncoming", pszText); - } else db_unset(NULL, "Chat", "HeaderIncoming"); + db_set_s(NULL, CHAT_MODULE, "HeaderIncoming", pszText); + } else db_unset(NULL, CHAT_MODULE, "HeaderIncoming"); 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(NULL, "Chat", "HeaderOutgoing", pszText); - } else db_unset(NULL, "Chat", "HeaderOutgoing"); + db_set_s(NULL, CHAT_MODULE, "HeaderOutgoing", pszText); + } else db_unset(NULL, CHAT_MODULE, "HeaderOutgoing"); iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0); - db_set_w(NULL, "Chat", "LogLimit", (WORD)iLen); + db_set_w(NULL, CHAT_MODULE, "LogLimit", (WORD)iLen); mir_free(pszText); if (pci->hListBkgBrush) DeleteObject(pci->hListBkgBrush); - pci->hListBkgBrush = CreateSolidBrush(M.GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR)); + pci->hListBkgBrush = CreateSolidBrush(M.GetDword(CHAT_MODULE, "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR)); pci->ReloadSettings(); pci->MM_FontsChanged(); @@ -1043,10 +1047,10 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); { - DWORD dwFilterFlags = M.GetDword("Chat", "FilterFlags", GC_EVENT_ALL); - DWORD dwTrayFlags = M.GetDword("Chat", "TrayIconFlags", GC_EVENT_HIGHLIGHT); - DWORD dwPopupFlags = M.GetDword("Chat", "PopupFlags", GC_EVENT_HIGHLIGHT); - DWORD dwLogFlags = M.GetDword("Chat", "DiskLogFlags", GC_EVENT_ALL); + 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 < SIZEOF(_eventorder); i++) { if (_eventorder[i] != GC_EVENT_HIGHLIGHT) { @@ -1063,8 +1067,8 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM SendDlgItemMessage(hwndDlg, IDC_LOGICONTYPE, CB_SETCURSEL, (g_Settings.bLogSymbols ? 2 : (g_Settings.dwIconFlags ? 1 : 0)), 0); - CheckDlgButton(hwndDlg, IDC_NOPOPUPSFORCLOSEDWINDOWS, M.GetByte("Chat", "SkipWhenNoWindow", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_TRAYONLYFORINACTIVE, M.GetByte("Chat", "TrayIconInactiveOnly", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NOPOPUPSFORCLOSEDWINDOWS, M.GetByte(CHAT_MODULE, "SkipWhenNoWindow", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TRAYONLYFORINACTIVE, M.GetByte(CHAT_MODULE, "TrayIconInactiveOnly", 0) ? BST_CHECKED : BST_UNCHECKED); break; case WM_COMMAND: @@ -1088,18 +1092,18 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM dwPopupFlags |= (IsDlgButtonChecked(hwndDlg, IDC_P1 + i) ? _eventorder[i] : 0); dwTrayFlags |= (IsDlgButtonChecked(hwndDlg, IDC_T1 + i) ? _eventorder[i] : 0); } - db_set_dw(0, "Chat", "FilterFlags", dwFilterFlags); - db_set_dw(0, "Chat", "PopupFlags", dwPopupFlags); - db_set_dw(0, "Chat", "TrayIconFlags", dwTrayFlags); - db_set_dw(0, "Chat", "DiskLogFlags", dwLogFlags); + 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", "IconFlags", lr == 1 ? 1 : 0); - db_set_b(0, "Chat", "LogSymbols", lr == 2 ? 1 : 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", "SkipWhenNoWindow", IsDlgButtonChecked(hwndDlg, IDC_NOPOPUPSFORCLOSEDWINDOWS) ? 1 : 0); - db_set_b(0, "Chat", "TrayIconInactiveOnly", IsDlgButtonChecked(hwndDlg, IDC_TRAYONLYFORINACTIVE) ? 1 : 0); + db_set_b(0, CHAT_MODULE, "SkipWhenNoWindow", IsDlgButtonChecked(hwndDlg, IDC_NOPOPUPSFORCLOSEDWINDOWS) ? 1 : 0); + db_set_b(0, CHAT_MODULE, "TrayIconInactiveOnly", IsDlgButtonChecked(hwndDlg, IDC_TRAYONLYFORINACTIVE) ? 1 : 0); pci->ReloadSettings(); pci->MM_FontsChanged(); diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index 7419a3851a..77a5a4d70d 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -633,29 +633,29 @@ void Chat_SetFilters(SESSION_INFO *si) if (si == NULL) return; - DWORD dwFlags_default = M.GetDword("Chat", "FilterFlags", 0x03E0); - DWORD dwFlags_local = db_get_dw(si->hContact, "Chat", "FilterFlags", 0x03E0); - DWORD dwMask = db_get_dw(si->hContact, "Chat", "FilterMask", 0); + DWORD dwFlags_default = M.GetDword(CHAT_MODULE, "FilterFlags", 0x03E0); + DWORD dwFlags_local = db_get_dw(si->hContact, CHAT_MODULE, "FilterFlags", 0x03E0); + DWORD dwMask = db_get_dw(si->hContact, CHAT_MODULE, "FilterMask", 0); si->iLogFilterFlags = dwFlags_default; for (int i=0; i < 32; i++) if (dwMask & (1 << i)) si->iLogFilterFlags = (dwFlags_local & (1 << i) ? si->iLogFilterFlags | (1 << i) : si->iLogFilterFlags & ~(1 << i)); - dwFlags_default = M.GetDword("Chat", "PopupFlags", 0x03E0); - dwFlags_local = db_get_dw(si->hContact, "Chat", "PopupFlags", 0x03E0); - dwMask = db_get_dw(si->hContact, "Chat", "PopupMask", 0); + dwFlags_default = M.GetDword(CHAT_MODULE, "PopupFlags", 0x03E0); + dwFlags_local = db_get_dw(si->hContact, CHAT_MODULE, "PopupFlags", 0x03E0); + dwMask = db_get_dw(si->hContact, CHAT_MODULE, "PopupMask", 0); si->iLogPopupFlags = dwFlags_default; for (int i=0; i < 32; i++) if (dwMask & (1 << i)) si->iLogPopupFlags = (dwFlags_local & (1 << i) ? si->iLogPopupFlags | (1 << i) : si->iLogPopupFlags & ~(1 << i)); - dwFlags_default = M.GetDword("Chat", "TrayIconFlags", 0x03E0); - dwFlags_local = db_get_dw(si->hContact, "Chat", "TrayIconFlags", 0x03E0); - dwMask = db_get_dw(si->hContact, "Chat", "TrayIconMask", 0); + dwFlags_default = M.GetDword(CHAT_MODULE, "TrayIconFlags", 0x03E0); + dwFlags_local = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconFlags", 0x03E0); + dwMask = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconMask", 0); - si->iDiskLogFlags = M.GetDword("Chat", "DiskLogFlags", 0xFFFF); + si->iDiskLogFlags = M.GetDword(CHAT_MODULE, "DiskLogFlags", 0xFFFF); si->iLogTrayFlags = dwFlags_default; for (int i=0; i < 32; i++) diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 27634ff775..4280716d4b 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -60,7 +60,7 @@ static const CLSID IID_ITextDocument= { 0x8CC497C0,0xA1DF,0x11CE, { 0x80,0x98, 0 static void Chat_SetMessageLog(TWindowData *dat) { - unsigned int iLogMode = M.GetByte("Chat", "useIEView", 0); + unsigned int iLogMode = M.GetByte(CHAT_MODULE, "useIEView", 0); if (iLogMode == WANT_IEVIEW_LOG && dat->hwndIEView == 0) { IEVIEWWINDOW ieWindow; @@ -1100,14 +1100,14 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP case WM_INITDIALOG: { si = (SESSION_INFO*)lParam; - DWORD dwMask = db_get_dw(si->hContact, "Chat", "FilterMask", 0); - DWORD dwFlags = db_get_dw(si->hContact, "Chat", "FilterFlags", 0); + DWORD dwMask = db_get_dw(si->hContact, CHAT_MODULE, "FilterMask", 0); + DWORD dwFlags = db_get_dw(si->hContact, CHAT_MODULE, "FilterFlags", 0); - DWORD dwPopupMask = db_get_dw(si->hContact, "Chat", "PopupMask", 0); - DWORD dwPopupFlags = db_get_dw(si->hContact, "Chat", "PopupFlags", 0); + DWORD dwPopupMask = db_get_dw(si->hContact, CHAT_MODULE, "PopupMask", 0); + DWORD dwPopupFlags = db_get_dw(si->hContact, CHAT_MODULE, "PopupFlags", 0); - DWORD dwTrayMask = db_get_dw(si->hContact, "Chat", "TrayIconMask", 0); - DWORD dwTrayFlags = db_get_dw(si->hContact, "Chat", "TrayIconFlags", 0); + DWORD dwTrayMask = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconMask", 0); + DWORD dwTrayFlags = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconFlags", 0); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)si); @@ -1141,12 +1141,12 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (si) { if (dwMask == 0) { - db_unset(si->hContact, "Chat", "FilterFlags"); - db_unset(si->hContact, "Chat", "FilterMask"); + db_unset(si->hContact, CHAT_MODULE, "FilterFlags"); + db_unset(si->hContact, CHAT_MODULE, "FilterMask"); } else { - db_set_dw(si->hContact, "Chat", "FilterFlags", iFlags); - db_set_dw(si->hContact, "Chat", "FilterMask", dwMask); + db_set_dw(si->hContact, CHAT_MODULE, "FilterFlags", iFlags); + db_set_dw(si->hContact, CHAT_MODULE, "FilterMask", dwMask); } } @@ -1163,12 +1163,12 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (si) { if (dwMask == 0) { - db_unset(si->hContact, "Chat", "PopupFlags"); - db_unset(si->hContact, "Chat", "PopupMask"); + db_unset(si->hContact, CHAT_MODULE, "PopupFlags"); + db_unset(si->hContact, CHAT_MODULE, "PopupMask"); } else { - db_set_dw(si->hContact, "Chat", "PopupFlags", iFlags); - db_set_dw(si->hContact, "Chat", "PopupMask", dwMask); + db_set_dw(si->hContact, CHAT_MODULE, "PopupFlags", iFlags); + db_set_dw(si->hContact, CHAT_MODULE, "PopupMask", dwMask); } } @@ -1184,12 +1184,12 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (si) { if (dwMask == 0) { - db_unset(si->hContact, "Chat", "TrayIconFlags"); - db_unset(si->hContact, "Chat", "TrayIconMask"); + db_unset(si->hContact, CHAT_MODULE, "TrayIconFlags"); + db_unset(si->hContact, CHAT_MODULE, "TrayIconMask"); } else { - db_set_dw(si->hContact, "Chat", "TrayIconFlags", iFlags); - db_set_dw(si->hContact, "Chat", "TrayIconMask", dwMask); + db_set_dw(si->hContact, CHAT_MODULE, "TrayIconFlags", iFlags); + db_set_dw(si->hContact, CHAT_MODULE, "TrayIconMask", dwMask); } Chat_SetFilters(si); SendMessage(si->hWnd, GC_CHANGEFILTERFLAG, 0, (LPARAM)iFlags); @@ -1221,7 +1221,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L HWND hColor = GetDlgItem(hwndParent, IDC_COLOR); HWND hBGColor = GetDlgItem(hwndParent, IDC_BKGCOLOR); - if (M.GetByte("Chat", "RightClickFilter", 0) != 0) { + if (M.GetByte(CHAT_MODULE, "RightClickFilter", 0) != 0) { if (hFilter == hwnd) SendMessage(hwndParent, GC_SHOWFILTERMENU, 0, 0); if (hColor == hwnd) @@ -1865,7 +1865,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (!dat->pContainer->settings->fPrivate) si->iSplitterY = g_Settings.iSplitterY; else { - if (M.GetByte("Chat", "SyncSplitter", 0)) + if (M.GetByte(CHAT_MODULE, "SyncSplitter", 0)) si->iSplitterY = dat->pContainer->settings->splitterPos - DPISCALEY_S(23); else si->iSplitterY = g_Settings.iSplitterY; @@ -2395,7 +2395,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar goto LABEL_SHOWWINDOW; case SESSION_INITDONE: - if (M.GetByte("Chat", "PopupOnJoin", 0) != 0) + if (M.GetByte(CHAT_MODULE, "PopupOnJoin", 0) != 0) return TRUE; // fall through case WINDOW_VISIBLE: @@ -3077,13 +3077,13 @@ LABEL_SHOWWINDOW: SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETOVERLAYICON, (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); - if (si->bFilterEnabled && M.GetByte("Chat", "RightClickFilter", 0) == 0) { + if (si->bFilterEnabled && M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) { SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0); break; } SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0); SendMessage(hwndDlg, GC_UPDATETITLE, 0, 0); - db_set_b(si->hContact, "Chat", "FilterEnabled", (BYTE)si->bFilterEnabled); + db_set_b(si->hContact, CHAT_MODULE, "FilterEnabled", (BYTE)si->bFilterEnabled); break; case IDC_BKGCOLOR: @@ -3094,7 +3094,7 @@ LABEL_SHOWWINDOW: break; if (IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR)) { - if (M.GetByte("Chat", "RightClickFilter", 0) == 0) + if (M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_BKGCOLOR); else if (si->bBGSet) { cf.dwMask = CFM_BACKCOLOR; @@ -3117,7 +3117,7 @@ LABEL_SHOWWINDOW: break; if (IsDlgButtonChecked(hwndDlg, IDC_COLOR)) { - if (M.GetByte("Chat", "RightClickFilter", 0) == 0) + if (M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_COLOR); else if (si->bFGSet) { cf.dwMask = CFM_COLOR; @@ -3546,10 +3546,10 @@ LABEL_SHOWWINDOW: TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING, 0); if (!dat->bIsAutosizingInput) - db_set_w(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX); + db_set_w(NULL, CHAT_MODULE, "SplitterX", (WORD)g_Settings.iSplitterX); if (dat->pContainer->settings->fPrivate && !IsAutoSplitEnabled(dat)) - db_set_w(NULL, "Chat", "splitY", (WORD)g_Settings.iSplitterY); + db_set_w(NULL, CHAT_MODULE, "splitY", (WORD)g_Settings.iSplitterY); DM_FreeTheme(dat); diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 92499a98ee..ed244ccd1a 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -374,13 +374,13 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa } } - db_set_b(0, "Chat", "PopupStyle", (BYTE)g_Settings.iPopupStyle); - db_set_w(NULL, "Chat", "PopupTimeout", g_Settings.iPopupTimeout); + db_set_b(0, CHAT_MODULE, "PopupStyle", (BYTE)g_Settings.iPopupStyle); + db_set_w(NULL, CHAT_MODULE, "PopupTimeout", g_Settings.iPopupTimeout); g_Settings.crPUBkgColour = SendDlgItemMessage(hWnd, IDC_COLBACK_MUC, CPM_GETCOLOUR, 0, 0); - db_set_dw(0, "Chat", "PopupColorBG", (DWORD)g_Settings.crPUBkgColour); + db_set_dw(0, CHAT_MODULE, "PopupColorBG", (DWORD)g_Settings.crPUBkgColour); g_Settings.crPUTextColour = SendDlgItemMessage(hWnd, IDC_COLTEXT_MUC, CPM_GETCOLOUR, 0, 0); - db_set_dw(0, "Chat", "PopupColorText", (DWORD)g_Settings.crPUTextColour); + db_set_dw(0, CHAT_MODULE, "PopupColorText", (DWORD)g_Settings.crPUTextColour); NEN_WriteOptions(&nen_options); CheckForRemoveMask(); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index a2bf75563f..a88a9d6e19 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -210,7 +210,7 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_RTLDefault = M.GetByte("rtldefault", 0); m_TabAppearance = M.GetDword("tabconfig", TCF_FLASHICON | TCF_SINGLEROWTABCONTROL); m_panelHeight = (DWORD)M.GetDword("panelheight", CInfoPanel::DEGRADE_THRESHOLD); - m_MUCpanelHeight = M.GetDword("Chat", "panelheight", CInfoPanel::DEGRADE_THRESHOLD); + m_MUCpanelHeight = M.GetDword(CHAT_MODULE, "panelheight", CInfoPanel::DEGRADE_THRESHOLD); m_IdleDetect = M.GetByte("dimIconsForIdleContacts", 1); m_smcxicon = 16; m_smcyicon = 16; diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 91b565cc67..5b11efa34e 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -127,7 +127,7 @@ void CInfoPanel::saveHeight(bool fFlush) PluginConfig.m_MUCpanelHeight = m_height; m_defaultMUCHeight = m_height; if (fFlush) - db_set_dw(0, "Chat", "panelheight", m_height); + db_set_dw(0, CHAT_MODULE, "panelheight", m_height); } } } diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index ff28e11217..2d5d635a3a 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -976,7 +976,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case ID_SPLITTERCONTEXT_SAVEGLOBALFORALLSESSIONS: { RECT rcWin; - BYTE bSync = M.GetByte("Chat", "SyncSplitter", 0); + BYTE bSync = M.GetByte(CHAT_MODULE, "SyncSplitter", 0); DWORD dwOff_IM = 0, dwOff_CHAT = 0; dwOff_CHAT = -(2 + (PluginConfig.g_DPIscaleY > 1.0 ? 1 : 0)); diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 7baa7be4ce..90d7ecbca1 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -714,7 +714,6 @@ private: #define SRMSGDEFSET_LOADTIME 10 #define SRMSGSET_BKGCOLOUR "BkgColour" -#define SRMSGSET_BKGCOLOUR_MUC "BkgColourMUC" #define SRMSGDEFSET_BKGCOLOUR RGB(250,250,250) //#define SRMSGDEFSET_BKGCOLOUR GetSysColor(COLOR_WINDOW) @@ -754,7 +753,6 @@ private: #define SRMSGMOD_T "Tab_SRMsg" #define FONTMODULE "TabSRMM_Fonts" #define CHAT_OLDFONTMODULE "TabSRMM_chat_Fonts" -#define CHAT_FONTMODULE "ChatFonts" #define IDM_STAYONTOP (WM_USER + 1) #define IDM_NOTITLE (WM_USER + 2) diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp index 4a610c3b27..301a031f21 100644 --- a/plugins/TabSRMM/src/themeio.cpp +++ b/plugins/TabSRMM/src/themeio.cpp @@ -48,7 +48,7 @@ static struct _tagExtSettings { "Message Log", "InputBG", FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR, "Message Log", "HgridColor", FONTMODULE, "hgrid", SRMSGDEFSET_BKGCOLOUR, "Message Log", "DWFlags", SRMSGMOD_T, "mwflags", MWF_LOG_DEFAULT, - "Chat", "UserListBG", "Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR, + CHAT_MODULE, "UserListBG", CHAT_MODULE, "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR, "Message Log", "LeftIndent", SRMSGMOD_T, "IndentAmount", 20, "Message Log", "RightIndent", SRMSGMOD_T, "RightIndent", 20, }; @@ -57,33 +57,36 @@ static struct _tagExtSettings { * new in TabSRMM3 / theme version 5 * don't read these values from themes with version < 5 */ -static struct _tagExtSettings_v5 { +struct +{ char* szIniSection; char* szIniName; char* szDbModule; char* szDbSetting; DWORD dwDef; -} _extSettings_v5[18] = { - "CommonClrs", "IP_High", FONTMODULE, "ipfieldsbgHigh", 0xf0f0f0, - "CommonClrs", "IP_Low", FONTMODULE, "ipfieldsbg", 0x62caff, - "CommonClrs", "TB_High", FONTMODULE, "tbBgHigh", 0, - "CommonClrs", "TB_Low", FONTMODULE, "tbBgLow", 0, - "CommonClrs", "FillColor", FONTMODULE, "fillColor", 0, - "CommonClrs", "RichBorders", FONTMODULE, "cRichBorders", 0, - "CommonClrs", "GenericTxt", FONTMODULE, "genericTxtClr", RGB(20, 20, 20), - "AeroMode", "Style", SRMSGMOD_T, "aerostyle", CSkin::AERO_EFFECT_MILK, - "AeroMode", "AeroGlowColor", FONTMODULE, "aeroGlow", RGB(40, 40, 255), - - "Colored Tabs", "NormalText", SRMSGMOD_T, "tab_txt_normal", RGB(1, 1, 1), - "Colored Tabs", "ActiveText", SRMSGMOD_T, "tab_txt_active", RGB(1, 1, 1), - "Colored Tabs", "HottrackText", SRMSGMOD_T, "tab_txt_hottrack", RGB(1, 1, 1), - "Colored Tabs", "UnreadText", SRMSGMOD_T, "tab_txt_unread", RGB(1, 1, 1), - - "Colored Tabs", "NormalBG", SRMSGMOD_T, "tab_bg_normal", 0xf0f0f0, - "Colored Tabs", "ActiveBG", SRMSGMOD_T, "tab_bg_active", 0xf0f0f0, - "Colored Tabs", "HottrackBG", SRMSGMOD_T, "tab_bg_hottrack", 0xf0f0f0, - "Colored Tabs", "UnreadBG", SRMSGMOD_T, "tab_bg_unread", 0xf0f0f0, - "Chat", "Background", FONTMODULE, SRMSGSET_BKGCOLOUR_MUC, SRMSGDEFSET_BKGCOLOUR +} +static _extSettings_v5[18] = +{ + { "CommonClrs", "IP_High", FONTMODULE, "ipfieldsbgHigh", 0xf0f0f0 }, + { "CommonClrs", "IP_Low", FONTMODULE, "ipfieldsbg", 0x62caff }, + { "CommonClrs", "TB_High", FONTMODULE, "tbBgHigh", 0 }, + { "CommonClrs", "TB_Low", FONTMODULE, "tbBgLow", 0 }, + { "CommonClrs", "FillColor", FONTMODULE, "fillColor", 0 }, + { "CommonClrs", "RichBorders", FONTMODULE, "cRichBorders", 0 }, + { "CommonClrs", "GenericTxt", FONTMODULE, "genericTxtClr", RGB(20, 20, 20) }, + { "AeroMode", "Style", SRMSGMOD_T, "aerostyle", CSkin::AERO_EFFECT_MILK }, + { "AeroMode", "AeroGlowColor", FONTMODULE, "aeroGlow", RGB(40, 40, 255) }, + + { "Colored Tabs", "NormalText", SRMSGMOD_T, "tab_txt_normal", RGB(1, 1, 1) }, + { "Colored Tabs", "ActiveText", SRMSGMOD_T, "tab_txt_active", RGB(1, 1, 1) }, + { "Colored Tabs", "HottrackText", SRMSGMOD_T, "tab_txt_hottrack", RGB(1, 1, 1) }, + { "Colored Tabs", "UnreadText", SRMSGMOD_T, "tab_txt_unread", RGB(1, 1, 1) }, + + { "Colored Tabs", "NormalBG", SRMSGMOD_T, "tab_bg_normal", 0xf0f0f0 }, + { "Colored Tabs", "ActiveBG", SRMSGMOD_T, "tab_bg_active", 0xf0f0f0 }, + { "Colored Tabs", "HottrackBG", SRMSGMOD_T, "tab_bg_hottrack", 0xf0f0f0 }, + { "Colored Tabs", "UnreadBG", SRMSGMOD_T, "tab_bg_unread", 0xf0f0f0 }, + { CHAT_MODULE, "Background", CHAT_MODULE, "ColorLogBG", SRMSGDEFSET_BKGCOLOUR } }; /* @@ -159,7 +162,7 @@ static struct _tagFontBlocks { } fontBlocks[] = { FONTMODULE, 0, MSGDLGFONTCOUNT, "Font%d", "StdFonts", FONTMODULE, 100, IPFONTCOUNT, "IPFont%d", "MiscFonts", - CHAT_FONTMODULE, 0, CHATFONTCOUNT, "ChatFont%d", "ChatFonts", + CHATFONT_MODULE, 0, CHATFONTCOUNT, "ChatFont%d", CHATFONT_MODULE, NULL, 0, 0, NULL }; @@ -345,7 +348,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in defclr = g_Settings.UserListColors[CHAT_STATUS_NORMAL]; g_Settings.nickColors[i] = GetPrivateProfileIntA("Nick Colors", _itoa(i, szTemp, 10), defclr, szIniFilename); mir_snprintf(szTemp, SIZEOF(szTemp), "NickColor%d", i); - db_set_dw(0, "Chat", szTemp, g_Settings.nickColors[i]); + db_set_dw(0, CHAT_MODULE, szTemp, g_Settings.nickColors[i]); } } } else { diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 0e5f6758a2..63688d51cf 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -256,21 +256,21 @@ static BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) static void OnLoadSettings() { - g_Settings.iX = db_get_dw(NULL, "Chat", "roomx", -1); - g_Settings.iY = db_get_dw(NULL, "Chat", "roomy", -1); + g_Settings.iX = db_get_dw(NULL, CHAT_MODULE, "roomx", -1); + g_Settings.iY = db_get_dw(NULL, CHAT_MODULE, "roomy", -1); - g_Settings.bTabsEnable = db_get_b(NULL, "Chat", "Tabs", 1) != 0; - g_Settings.TabRestore = db_get_b(NULL, "Chat", "TabRestore", 0) != 0; - g_Settings.TabsAtBottom = db_get_b(NULL, "Chat", "TabBottom", 0) != 0; - g_Settings.TabCloseOnDblClick = db_get_b(NULL, "Chat", "TabCloseOnDblClick", 0) != 0; + g_Settings.bTabsEnable = db_get_b(NULL, CHAT_MODULE, "Tabs", 1) != 0; + g_Settings.TabRestore = db_get_b(NULL, CHAT_MODULE, "TabRestore", 0) != 0; + g_Settings.TabsAtBottom = db_get_b(NULL, CHAT_MODULE, "TabBottom", 0) != 0; + g_Settings.TabCloseOnDblClick = db_get_b(NULL, CHAT_MODULE, "TabCloseOnDblClick", 0) != 0; ZeroMemory(&g_TabSession, sizeof(SESSION_INFO)); g_TabSession.iType = GCW_TABROOM; g_TabSession.iSplitterX = g_Settings.iSplitterX; g_TabSession.iSplitterY = g_Settings.iSplitterY; - g_TabSession.iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0); - g_TabSession.bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0); - g_TabSession.bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1); + g_TabSession.iLogFilterFlags = (int)db_get_dw(NULL, CHAT_MODULE, "FilterFlags", 0x03E0); + g_TabSession.bFilterEnabled = db_get_b(NULL, CHAT_MODULE, "FilterEnabled", 0); + g_TabSession.bNicklistEnabled = db_get_b(NULL, CHAT_MODULE, "ShowNicklist", 1); g_TabSession.iFG = 4; g_TabSession.bFGSet = TRUE; g_TabSession.iBG = 2; @@ -280,7 +280,7 @@ static void OnLoadSettings() static void RegisterFonts() { ColourIDT colourid = { sizeof(colourid) }; - strncpy(colourid.dbSettingsGroup, "Chat", sizeof(colourid.dbSettingsGroup)); + strncpy(colourid.dbSettingsGroup, CHAT_MODULE, sizeof(colourid.dbSettingsGroup)); _tcsncpy(colourid.group, LPGENT("Chat module"), SIZEOF(colourid.group)); strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting)); @@ -359,12 +359,12 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void) { - db_set_w(NULL, "Chat", "SplitterX", (WORD)g_Settings.iSplitterX); - db_set_w(NULL, "Chat", "SplitterY", (WORD)g_Settings.iSplitterY); - db_set_dw(NULL, "Chat", "roomx", g_Settings.iX); - db_set_dw(NULL, "Chat", "roomy", g_Settings.iY); - db_set_dw(NULL, "Chat", "roomwidth" , g_Settings.iWidth); - db_set_dw(NULL, "Chat", "roomheight", g_Settings.iHeight); + db_set_w(NULL, CHAT_MODULE, "SplitterX", (WORD)g_Settings.iSplitterX); + db_set_w(NULL, CHAT_MODULE, "SplitterY", (WORD)g_Settings.iSplitterY); + db_set_dw(NULL, CHAT_MODULE, "roomx", g_Settings.iX); + db_set_dw(NULL, CHAT_MODULE, "roomy", g_Settings.iY); + db_set_dw(NULL, CHAT_MODULE, "roomwidth" , g_Settings.iWidth); + db_set_dw(NULL, CHAT_MODULE, "roomheight", g_Settings.iHeight); DestroyMenu(g_hMenu); return 0; diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 5fefef89ad..e021db88c0 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -164,9 +164,9 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, const struct branch_t * tvis.item.pszText = TranslateTS(branch[i].szDescr); tvis.item.stateMask = TVIS_STATEIMAGEMASK; if (branch[i].iMode) - iState = ((db_get_dw(NULL, "Chat", branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode) != 0 ? 2 : 1; + iState = ((db_get_dw(NULL, CHAT_MODULE, branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode) != 0 ? 2 : 1; else - iState = db_get_b(NULL, "Chat", branch[i].szDBName, branch[i].bDefault) != 0 ? 2 : 1; + iState = db_get_b(NULL, CHAT_MODULE, branch[i].szDBName, branch[i].bDefault) != 0 ? 2 : 1; tvis.item.state = INDEXTOSTATEIMAGEMASK(iState); hItemB[i] = TreeView_InsertItem(hwndTree, &tvis); } @@ -187,9 +187,9 @@ static void SaveBranch(HWND hwndTree, const struct branch_t *branch, HTREEITEM * iState |= branch[i].iMode; if (iState & GC_EVENT_ADDSTATUS) iState |= GC_EVENT_REMOVESTATUS; - db_set_dw(NULL, "Chat", branch[i].szDBName, (DWORD)iState); + db_set_dw(NULL, CHAT_MODULE, branch[i].szDBName, (DWORD)iState); } - else db_set_b(NULL, "Chat", branch[i].szDBName, bChecked); + else db_set_b(NULL, CHAT_MODULE, branch[i].szDBName, bChecked); } } static void CheckHeading(HWND hwndTree, HTREEITEM hHeading) @@ -315,7 +315,7 @@ HICON LoadIconEx(char* pszIcoLibName, BOOL big) static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault) { DBVARIANT dbv; - if (!db_get_ts(NULL, "Chat", pszSetting, &dbv)) { + if (!db_get_ts(NULL, CHAT_MODULE, pszSetting, &dbv)) { replaceStrT(*ppPointer, dbv.ptszVal); db_free(&dbv); } @@ -335,14 +335,14 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHECKBOXES),GWL_STYLE,GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_CHECKBOXES),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); - hListHeading0 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Options for using a tabbed interface"), db_get_b(NULL, "Chat", "Branch0Exp", 0)?TRUE:FALSE); - hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance and functionality of chat room windows"), db_get_b(NULL, "Chat", "Branch1Exp", 0)?TRUE:FALSE); - hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance of the message log"), db_get_b(NULL, "Chat", "Branch2Exp", 0)?TRUE:FALSE); - hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Default events to show in new chat rooms if the \'event filter\' is enabled"), db_get_b(NULL, "Chat", "Branch3Exp", 0)?TRUE:FALSE); - hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the message log"), db_get_b(NULL, "Chat", "Branch4Exp", 0)?TRUE:FALSE); - hListHeading5 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the tray"), db_get_b(NULL, "Chat", "Branch5Exp", 0)?TRUE:FALSE); + hListHeading0 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Options for using a tabbed interface"), db_get_b(NULL, CHAT_MODULE, "Branch0Exp", 0)?TRUE:FALSE); + hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance and functionality of chat room windows"), db_get_b(NULL, CHAT_MODULE, "Branch1Exp", 0)?TRUE:FALSE); + hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance of the message log"), db_get_b(NULL, CHAT_MODULE, "Branch2Exp", 0)?TRUE:FALSE); + hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Default events to show in new chat rooms if the \'event filter\' is enabled"), db_get_b(NULL, CHAT_MODULE, "Branch3Exp", 0)?TRUE:FALSE); + hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the message log"), db_get_b(NULL, CHAT_MODULE, "Branch4Exp", 0)?TRUE:FALSE); + hListHeading5 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the tray"), db_get_b(NULL, CHAT_MODULE, "Branch5Exp", 0)?TRUE:FALSE); if (PopupInstalled) - hListHeading6 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Popups to display"), db_get_b(NULL, "Chat", "Branch6Exp", 0)?TRUE:FALSE); + hListHeading6 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Popups to display"), db_get_b(NULL, CHAT_MODULE, "Branch6Exp", 0)?TRUE:FALSE); FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, branch0, hItemB0, SIZEOF(branch0), 0); FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, hItemB1, SIZEOF(branch1), 0); FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, hItemB2, SIZEOF(branch2), 0); @@ -411,7 +411,7 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - BYTE b = db_get_b(NULL, "Chat", "Tabs", 1); + BYTE b = db_get_b(NULL, CHAT_MODULE, "Tabs", 1); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch0, hItemB0, SIZEOF(branch0)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, hItemB1, SIZEOF(branch1)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, hItemB2, SIZEOF(branch2)); @@ -420,17 +420,17 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch5, hItemB5, SIZEOF(branch5)); if (PopupInstalled) SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch6, hItemB6, SIZEOF(branch6)); - g_Settings.dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000); - g_Settings.dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000); - g_Settings.dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000); - g_Settings.bStripFormat = db_get_b(NULL, "Chat", "TrimFormatting", 0) != 0; - g_Settings.bTrayIconInactiveOnly = db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1) != 0; - g_Settings.bPopupInactiveOnly = db_get_b(NULL, "Chat", "PopupInactiveOnly", 1) != 0; - g_Settings.bLogIndentEnabled = db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0; - - if (b != db_get_b(NULL, "Chat", "Tabs", 1)) { + 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; + + if (b != db_get_b(NULL, CHAT_MODULE, "Tabs", 1)) { pci->SM_BroadcastMessage(NULL, GC_CLOSEWINDOW, 0, 1, FALSE); - g_Settings.bTabsEnable = db_get_b(NULL, "Chat", "Tabs", 1) != 0; + g_Settings.bTabsEnable = db_get_b(NULL, CHAT_MODULE, "Tabs", 1) != 0; } else pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); @@ -441,20 +441,20 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA case WM_DESTROY: BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, "Chat", "Branch1Exp", b); + db_set_b(NULL, CHAT_MODULE, "Branch1Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, "Chat", "Branch2Exp", b); + db_set_b(NULL, CHAT_MODULE, "Branch2Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading3, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, "Chat", "Branch3Exp", b); + db_set_b(NULL, CHAT_MODULE, "Branch3Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading4, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, "Chat", "Branch4Exp", b); + db_set_b(NULL, CHAT_MODULE, "Branch4Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading5, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, "Chat", "Branch5Exp", b); + db_set_b(NULL, CHAT_MODULE, "Branch5Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, "Chat", "Branch0Exp", b); + db_set_b(NULL, CHAT_MODULE, "Branch0Exp", b); if (PopupInstalled) { b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading6, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, "Chat", "Branch6Exp", b); + db_set_b(NULL, CHAT_MODULE, "Branch6Exp", b); } break; } @@ -470,11 +470,11 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0)); - SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "Chat", "LogLimit", 100), 0)); + SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LogLimit", 100), 0)); SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETRANGE, 0, MAKELONG(10000, 0)); - SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "Chat", "LoggingLimit", 100), 0)); + SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LoggingLimit", 100), 0)); SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_SETRANGE, 0, MAKELONG(255, 10)); - SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, "Chat", "NicklistRowDist", 12), 0)); + SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12), 0)); { TCHAR* pszGroup = NULL; InitSetting(&pszGroup, "AddToGroup", _T("Chat rooms")); @@ -566,78 +566,78 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA *p2 = ' '; p2 = _tcschr(ptszText, ','); } - db_set_ts(NULL, "Chat", "HighlightWords", ptszText); + db_set_ts(NULL, CHAT_MODULE, "HighlightWords", ptszText); mir_free(ptszText); } } - else db_unset(NULL, "Chat", "HighlightWords"); + else db_unset(NULL, CHAT_MODULE, "HighlightWords"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY)); if (iLen > 0) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText, iLen + 1); - db_set_ts(NULL, "Chat", "LogDirectory", pszText); + db_set_ts(NULL, CHAT_MODULE, "LogDirectory", pszText); } - else db_unset(NULL, "Chat", "LogDirectory"); + else db_unset(NULL, CHAT_MODULE, "LogDirectory"); pci->SM_InvalidateLogDirectories(); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP)); if (iLen > 0) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1); - db_set_ts(NULL, "Chat", "LogTimestamp", pszText); + db_set_ts(NULL, CHAT_MODULE, "LogTimestamp", pszText); } - else db_unset(NULL, "Chat", "LogTimestamp"); + else db_unset(NULL, CHAT_MODULE, "LogTimestamp"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP)); if (iLen > 0) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1); - db_set_ts(NULL, "Chat", "HeaderTime", pszText); + db_set_ts(NULL, CHAT_MODULE, "HeaderTime", pszText); } - else db_unset(NULL, "Chat", "HeaderTime"); + else db_unset(NULL, CHAT_MODULE, "HeaderTime"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP)); if (iLen > 0) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_INSTAMP, pszText, iLen + 1); - db_set_ts(NULL, "Chat", "HeaderIncoming", pszText); + db_set_ts(NULL, CHAT_MODULE, "HeaderIncoming", pszText); } - else db_unset(NULL, "Chat", "HeaderIncoming"); + else db_unset(NULL, CHAT_MODULE, "HeaderIncoming"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP)); if (iLen > 0) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1); - db_set_ts(NULL, "Chat", "HeaderOutgoing", pszText); + db_set_ts(NULL, CHAT_MODULE, "HeaderOutgoing", pszText); } - else db_unset(NULL, "Chat", "HeaderOutgoing"); + else db_unset(NULL, CHAT_MODULE, "HeaderOutgoing"); g_Settings.bHighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHT) == BST_CHECKED; - db_set_b(NULL, "Chat", "HighlightEnabled", g_Settings.bHighlightEnabled); + db_set_b(NULL, CHAT_MODULE, "HighlightEnabled", g_Settings.bHighlightEnabled); g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED; - db_set_b(NULL, "Chat", "LoggingEnabled", g_Settings.bLoggingEnabled); + db_set_b(NULL, CHAT_MODULE, "LoggingEnabled", g_Settings.bLoggingEnabled); iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_GETPOS, 0, 0); - db_set_w(NULL, "Chat", "LogLimit", (WORD)iLen); + db_set_w(NULL, CHAT_MODULE, "LogLimit", (WORD)iLen); iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_GETPOS, 0, 0); - db_set_w(NULL, "Chat", "LoggingLimit", (WORD)iLen); + db_set_w(NULL, CHAT_MODULE, "LoggingLimit", (WORD)iLen); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP)); if (iLen > 0) { pszText = (TCHAR *)mir_realloc(pszText, (iLen + 1) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1); - db_set_ts(NULL, "Chat", "AddToGroup", pszText); + db_set_ts(NULL, CHAT_MODULE, "AddToGroup", pszText); } - else db_set_s(NULL, "Chat", "AddToGroup", ""); + else db_set_s(NULL, CHAT_MODULE, "AddToGroup", ""); mir_free(pszText); iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_GETPOS, 0, 0); if (iLen > 0) - db_set_b(NULL, "Chat", "NicklistRowDist", (BYTE)iLen); + db_set_b(NULL, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen); else - db_unset(NULL, "Chat", "NicklistRowDist"); + db_unset(NULL, CHAT_MODULE, "NicklistRowDist"); pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); return TRUE; @@ -703,16 +703,16 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg, UINT uMsg, WPARAM wPar iLen = 1; g_Settings.iPopupStyle = iLen; - db_set_b(NULL, "Chat", "PopupStyle", (BYTE)iLen); + db_set_b(NULL, CHAT_MODULE, "PopupStyle", (BYTE)iLen); iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_GETPOS, 0, 0); g_Settings.iPopupTimeout = iLen; - db_set_w(NULL, "Chat", "PopupTimeout", (WORD)iLen); + db_set_w(NULL, CHAT_MODULE, "PopupTimeout", (WORD)iLen); g_Settings.crPUBkgColour = SendDlgItemMessage(hwndDlg, IDC_BKG, CPM_GETCOLOUR, 0, 0); - db_set_dw(NULL, "Chat", "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg, IDC_BKG, CPM_GETCOLOUR, 0, 0)); + db_set_dw(NULL, CHAT_MODULE, "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg, IDC_BKG, CPM_GETCOLOUR, 0, 0)); g_Settings.crPUTextColour = SendDlgItemMessage(hwndDlg, IDC_TEXT, CPM_GETCOLOUR, 0, 0); - db_set_dw(NULL, "Chat", "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TEXT, CPM_GETCOLOUR, 0, 0)); + db_set_dw(NULL, CHAT_MODULE, "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TEXT, CPM_GETCOLOUR, 0, 0)); return TRUE; } break; @@ -742,7 +742,7 @@ int OptionsInitialize(WPARAM wParam, LPARAM lParam) if (PopupInstalled) { odp.position = 910000002; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPOPUP); - odp.pszTitle = LPGEN("Chat"); + odp.pszTitle = LPGEN(CHAT_MODULE); odp.pszGroup = LPGEN("Popups"); odp.pszTab = NULL; odp.pfnDlgProc = DlgProcOptionsPopup; diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index 3b29352143..ab82184a58 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -54,7 +54,7 @@ void CheckColorsInModule(const char* pszModule) { MODULEINFO *pMod = pci->MM_FindModule(pszModule); int i = 0; - COLORREF crBG = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); + COLORREF crBG = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW)); COLORREF crFG; pci->LoadMsgDlgFont(17, NULL, &crFG); diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index b720302bbc..f4dae08481 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -123,10 +123,10 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) { SESSION_INFO *si = (SESSION_INFO*)lParam; - BOOL bControl = (BOOL)db_get_b(NULL, "Chat", "ShowTopButtons", 1); - BOOL bFormat = (BOOL)db_get_b(NULL, "Chat", "ShowFormatButtons", 1); + BOOL bControl = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowTopButtons", 1); + BOOL bFormat = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowFormatButtons", 1); BOOL bToolbar = bFormat || bControl; - BOOL bSend = (BOOL)db_get_b(NULL, "Chat", "ShowSend", 0); + BOOL bSend = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowSend", 0); BOOL bNick = si->iType != GCW_SERVER && si->bNicklistEnabled; BOOL bTabs = g_Settings.bTabsEnable; BOOL bTabBottom = g_Settings.TabsAtBottom; @@ -291,11 +291,11 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return TRUE; if (wParam == '\n' || wParam == '\r') { - if ((isCtrl != 0) ^ (0 != db_get_b(NULL, "Chat", "SendOnEnter", 1))) { + if ((isCtrl != 0) ^ (0 != db_get_b(NULL, CHAT_MODULE, "SendOnEnter", 1))) { PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); return 0; } - if (db_get_b(NULL, "Chat", "SendOnDblEnter", 0)) { + if (db_get_b(NULL, CHAT_MODULE, "SendOnDblEnter", 0)) { if (dat->lastEnterTime + 2 < time(NULL)) dat->lastEnterTime = time(NULL); else { @@ -324,10 +324,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, BOOL isAlt = GetKeyState(VK_MENU) & 0x8000; if (wParam == VK_RETURN) { dat->szTabSave[0] = '\0'; - if ((isCtrl != 0) ^ (0 != db_get_b(NULL, "Chat", "SendOnEnter", 1))) + if ((isCtrl != 0) ^ (0 != db_get_b(NULL, CHAT_MODULE, "SendOnEnter", 1))) return 0; - if (db_get_b(NULL, "Chat", "SendOnDblEnter", 0)) + if (db_get_b(NULL, CHAT_MODULE, "SendOnDblEnter", 0)) if (dat->lastEnterTime + 2 >= time(NULL)) return 0; @@ -667,7 +667,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (pmi && pmi->bBkgColor) { int index = GetColorIndex(Parentsi->pszModule, cf.crBackColor); - COLORREF crB = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); + COLORREF crB = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW)); UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_BKGCOLOR); if (index >= 0) { @@ -794,7 +794,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L { switch (msg) { case WM_RBUTTONUP: - if (db_get_b(NULL, "Chat", "RightClickFilter", 0) != 0) { + if (db_get_b(NULL, 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) @@ -1239,15 +1239,15 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) cf.dwMask = CFM_COLOR|CFM_BOLD|CFM_UNDERLINE|CFM_BACKCOLOR; cf.dwEffects = 0; cf.crTextColor = crFore; - cf.crBackColor = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); - SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETBKGNDCOLOR , 0, db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW))); + cf.crBackColor = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW)); + SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETBKGNDCOLOR , 0, db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW))); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM) g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0)); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL , (LPARAM)&cf); // nicklist int ih = GetTextPixelSize( _T("AQGglo"), g_Settings.UserListFont,FALSE); int ih2 = GetTextPixelSize(_T("AQGglo"), g_Settings.UserListHeadingsFont, FALSE); - int height = db_get_b(NULL, "Chat", "NicklistRowDist", 12); + int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12); int font = ih > ih2 ? ih : ih2; // make sure we have space for icon! @@ -1315,7 +1315,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) { SESSION_INFO* pActive = pci->GetActiveSession(); RECT screen; - int savePerContact = db_get_b(NULL, "Chat", "SavePosition", 0); + int savePerContact = db_get_b(NULL, CHAT_MODULE, "SavePosition", 0); WINDOWPLACEMENT wp; wp.length = sizeof(wp); @@ -1332,13 +1332,13 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) break; } if (savePerContact) { - if (RestoreWindowPosition(hwndDlg, g_Settings.bTabsEnable?NULL:si->hContact, "Chat", "room", SW_HIDE)) + if (RestoreWindowPosition(hwndDlg, g_Settings.bTabsEnable?NULL:si->hContact, CHAT_MODULE, "room", SW_HIDE)) break; SetWindowPos(hwndDlg, 0, (screen.right-screen.left)/2- (550)/2,(screen.bottom-screen.top)/2- (400)/2, (550), (400), SWP_NOZORDER |SWP_HIDEWINDOW|SWP_NOACTIVATE); } else SetWindowPos(hwndDlg, 0, (screen.right-screen.left)/2- (550)/2,(screen.bottom-screen.top)/2- (400)/2, (550), (400), SWP_NOZORDER |SWP_HIDEWINDOW|SWP_NOACTIVATE); - if (!g_Settings.bTabsEnable && pActive && pActive->hWnd && db_get_b(NULL, "Chat", "CascadeWindows", 1)) { + if (!g_Settings.bTabsEnable && pActive && pActive->hWnd && db_get_b(NULL, CHAT_MODULE, "CascadeWindows", 1)) { RECT rcThis, rcNew; int dwFlag = SWP_NOZORDER | SWP_NOACTIVATE; if (!IsWindowVisible((HWND)wParam)) @@ -1749,7 +1749,7 @@ END_REMOVETAB: int ih = GetTextPixelSize( _T("AQGgl'"), g_Settings.UserListFont,FALSE); int ih2 = GetTextPixelSize( _T("AQGg'"), g_Settings.UserListHeadingsFont,FALSE); int font = ih > ih2?ih:ih2; - int height = db_get_b(NULL, "Chat", "NicklistRowDist", 12); + int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12); // make sure we have space for icon! if (g_Settings.bShowContactStatus) @@ -1843,11 +1843,11 @@ END_REMOVETAB: case SESSION_TERMINATE: SendMessage(hwndDlg, GC_SAVEWNDPOS, 0, 0); - if (db_get_b(NULL, "Chat", "SavePosition", 0)) { - db_set_dw(si->hContact, "Chat", "roomx", si->iX); - db_set_dw(si->hContact, "Chat", "roomy", si->iY); - db_set_dw(si->hContact, "Chat", "roomwidth", si->iWidth); - db_set_dw(si->hContact, "Chat", "roomheight", si->iHeight); + if (db_get_b(NULL, CHAT_MODULE, "SavePosition", 0)) { + db_set_dw(si->hContact, CHAT_MODULE, "roomx", si->iX); + db_set_dw(si->hContact, CHAT_MODULE, "roomy", si->iY); + db_set_dw(si->hContact, CHAT_MODULE, "roomwidth", si->iWidth); + db_set_dw(si->hContact, CHAT_MODULE, "roomheight", si->iHeight); } if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0)) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT); @@ -1865,7 +1865,7 @@ END_REMOVETAB: goto LABEL_SHOWWINDOW; case SESSION_INITDONE: - if (db_get_b(NULL, "Chat", "PopupOnJoin", 0) != 0) + if (db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) != 0) return TRUE; // fall through case WINDOW_VISIBLE: @@ -2424,7 +2424,7 @@ LABEL_SHOWWINDOW: si->bFilterEnabled = !si->bFilterEnabled; SendDlgItemMessage(hwndDlg,IDC_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)LoadIconEx( si->bFilterEnabled ? "filter" : "filter2", FALSE )); - if (si->bFilterEnabled && db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) { + if (si->bFilterEnabled && db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0) { SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0); break; } @@ -2438,7 +2438,7 @@ LABEL_SHOWWINDOW: cf.dwEffects = 0; if (IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR)) { - if (db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) + if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0) SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_BKGCOLOR); else if (si->bBGSet) { cf.dwMask = CFM_BACKCOLOR; @@ -2448,7 +2448,7 @@ LABEL_SHOWWINDOW: } else { cf.dwMask = CFM_BACKCOLOR; - cf.crBackColor = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); + cf.crBackColor = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW)); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } } @@ -2461,7 +2461,7 @@ LABEL_SHOWWINDOW: cf.dwEffects = 0; if (IsDlgButtonChecked(hwndDlg, IDC_COLOR)) { - if (db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) + if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0) SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_COLOR); else if (si->bFGSet) { cf.dwMask = CFM_COLOR; diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index b7d79b4849..2270dc5e65 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -67,8 +67,8 @@ static const fontOptionsList[] = { static void LoadColors() { - g_Settings->crUserListBGColor = db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW)); - g_Settings->crUserListSelectedBGColor = db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)); + g_Settings->crUserListBGColor = db_get_dw(NULL, CHAT_MODULE, "ColorNicklistBG", GetSysColor(COLOR_WINDOW)); + g_Settings->crUserListSelectedBGColor = db_get_dw(NULL, CHAT_MODULE, "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)); } void LoadLogFonts(void) @@ -93,29 +93,29 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) if (colour) { mir_snprintf(str, SIZEOF(str), "Font%dCol", i); - *colour = db_get_dw(NULL, "ChatFonts", str, fontOptionsList[i].defColour); + *colour = db_get_dw(NULL, CHATFONT_MODULE, str, fontOptionsList[i].defColour); } if (lf) { mir_snprintf(str, SIZEOF(str), "Font%dSize", i); - lf->lfHeight = (char)db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defSize); + lf->lfHeight = (char)db_get_b(NULL, CHATFONT_MODULE, str, fontOptionsList[i].defSize); lf->lfWidth = 0; lf->lfEscapement = 0; lf->lfOrientation = 0; mir_snprintf(str, SIZEOF(str), "Font%dSty", i); - style = db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defStyle); + style = db_get_b(NULL, CHATFONT_MODULE, str, fontOptionsList[i].defStyle); lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL; lf->lfItalic = style & FONTF_ITALIC ? 1 : 0; lf->lfUnderline = 0; lf->lfStrikeOut = 0; mir_snprintf(str, SIZEOF(str), "Font%dSet", i); - lf->lfCharSet = db_get_b(NULL, "ChatFonts", str, fontOptionsList[i].defCharset); + lf->lfCharSet = db_get_b(NULL, CHATFONT_MODULE, str, fontOptionsList[i].defCharset); lf->lfOutPrecision = OUT_DEFAULT_PRECIS; lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; mir_snprintf(str, SIZEOF(str), "Font%d", i); - ptrT tszFace(db_get_tsa(NULL, "ChatFonts", str)); + ptrT tszFace(db_get_tsa(NULL, CHATFONT_MODULE, str)); if (tszFace == NULL) lstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace); else @@ -130,7 +130,7 @@ void RegisterFonts(void) FontIDT fontid = { sizeof(fontid) }; fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_NEEDRESTART; for (int i = 0; i < SIZEOF(fontOptionsList); i++, index++) { - strncpy(fontid.dbSettingsGroup, "ChatFonts", sizeof(fontid.dbSettingsGroup)); + strncpy(fontid.dbSettingsGroup, CHATFONT_MODULE, sizeof(fontid.dbSettingsGroup)); _tcsncpy(fontid.group, g_szFontGroup, SIZEOF(fontid.group)); _tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name)); @@ -183,7 +183,7 @@ HICON LoadIconEx(char* pszIcoLibName, BOOL big) static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault) { DBVARIANT dbv; - if (!db_get_ts(NULL, "Chat", pszSetting, &dbv)) { + if (!db_get_ts(NULL, CHAT_MODULE, pszSetting, &dbv)) { replaceStrT(*ppPointer, dbv.ptszVal); db_free(&dbv); } @@ -195,33 +195,33 @@ static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault) void LoadGlobalSettings(void) { g_Settings->LogIconSize = 10; - g_Settings->bLogLimitNames = db_get_b(NULL, "Chat", "LogLimitNames", 1) != 0; - g_Settings->bShowTime = db_get_b(NULL, "Chat", "ShowTimeStamp", 1) != 0; - g_Settings->bSoundsFocus = db_get_b(NULL, "Chat", "SoundsFocus", 0) != 0; - g_Settings->bShowTimeIfChanged = (BOOL)db_get_b(NULL, "Chat", "ShowTimeStampIfChanged", 0) != 0; - g_Settings->bTimeStampEventColour = (BOOL)db_get_b(NULL, "Chat", "TimeStampEventColour", 0) != 0; - g_Settings->iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100); - g_Settings->dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000); - g_Settings->dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000); - g_Settings->dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000); - g_Settings->LoggingLimit = db_get_w(NULL, "Chat", "LoggingLimit", 100); - g_Settings->bLoggingEnabled = (BOOL)db_get_b(NULL, "Chat", "LoggingEnabled", 0) != 0; - g_Settings->bFlashWindow = (BOOL)db_get_b(NULL, "Chat", "FlashWindow", 0) != 0; - g_Settings->bFlashWindowHighlight = (BOOL)db_get_b(NULL, "Chat", "FlashWindowHighlight", false) != 0; - g_Settings->bHighlightEnabled = (BOOL)db_get_b(NULL, "Chat", "HighlightEnabled", 1) != 0; - g_Settings->crLogBackground = db_get_dw(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW)); - g_Settings->crUserListColor = db_get_dw(NULL, "ChatFonts", "Font18Col", RGB(0, 0, 0)); - g_Settings->crUserListHeadingsColor = db_get_dw(NULL, "ChatFonts", "Font19Col", RGB(170, 170, 170)); - g_Settings->bStripFormat = (BOOL)db_get_b(NULL, "Chat", "StripFormatting", 0) != 0; - g_Settings->bTrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1) != 0; - g_Settings->bPopupInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopupInactiveOnly", 1) != 0; - g_Settings->bAddColonToAutoComplete = (BOOL)db_get_b(NULL, "Chat", "AddColonToAutoComplete", 1) != 0; - g_Settings->iPopupStyle = db_get_b(NULL, "Chat", "PopupStyle", 1); - g_Settings->iPopupTimeout = db_get_w(NULL, "Chat", "PopupTimeout", 3); - g_Settings->crPUBkgColour = db_get_dw(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW)); - g_Settings->crPUTextColour = db_get_dw(NULL, "Chat", "PopupColorText", 0); - g_Settings->bShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0) != 0; - g_Settings->bContactStatusFirst = db_get_b(NULL, "Chat", "ContactStatusFirst", 0) != 0; + g_Settings->bLogLimitNames = db_get_b(NULL, CHAT_MODULE, "LogLimitNames", 1) != 0; + g_Settings->bShowTime = db_get_b(NULL, CHAT_MODULE, "ShowTimeStamp", 1) != 0; + g_Settings->bSoundsFocus = db_get_b(NULL, CHAT_MODULE, "SoundsFocus", 0) != 0; + g_Settings->bShowTimeIfChanged = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowTimeStampIfChanged", 0) != 0; + g_Settings->bTimeStampEventColour = (BOOL)db_get_b(NULL, CHAT_MODULE, "TimeStampEventColour", 0) != 0; + g_Settings->iEventLimit = db_get_w(NULL, CHAT_MODULE, "LogLimit", 100); + 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->LoggingLimit = db_get_w(NULL, CHAT_MODULE, "LoggingLimit", 100); + g_Settings->bLoggingEnabled = (BOOL)db_get_b(NULL, CHAT_MODULE, "LoggingEnabled", 0) != 0; + g_Settings->bFlashWindow = (BOOL)db_get_b(NULL, CHAT_MODULE, "FlashWindow", 0) != 0; + g_Settings->bFlashWindowHighlight = (BOOL)db_get_b(NULL, CHAT_MODULE, "FlashWindowHighlight", false) != 0; + g_Settings->bHighlightEnabled = (BOOL)db_get_b(NULL, CHAT_MODULE, "HighlightEnabled", 1) != 0; + g_Settings->crLogBackground = db_get_dw(NULL, CHAT_MODULE, "ColorLogBG", GetSysColor(COLOR_WINDOW)); + g_Settings->crUserListColor = db_get_dw(NULL, CHATFONT_MODULE, "Font18Col", RGB(0, 0, 0)); + g_Settings->crUserListHeadingsColor = db_get_dw(NULL, CHATFONT_MODULE, "Font19Col", RGB(170, 170, 170)); + g_Settings->bStripFormat = (BOOL)db_get_b(NULL, CHAT_MODULE, "StripFormatting", 0) != 0; + g_Settings->bTrayIconInactiveOnly = (BOOL)db_get_b(NULL, CHAT_MODULE, "TrayIconInactiveOnly", 1) != 0; + g_Settings->bPopupInactiveOnly = (BOOL)db_get_b(NULL, CHAT_MODULE, "PopupInactiveOnly", 1) != 0; + g_Settings->bAddColonToAutoComplete = (BOOL)db_get_b(NULL, CHAT_MODULE, "AddColonToAutoComplete", 1) != 0; + g_Settings->iPopupStyle = db_get_b(NULL, CHAT_MODULE, "PopupStyle", 1); + g_Settings->iPopupTimeout = db_get_w(NULL, CHAT_MODULE, "PopupTimeout", 3); + g_Settings->crPUBkgColour = db_get_dw(NULL, CHAT_MODULE, "PopupColorBG", GetSysColor(COLOR_WINDOW)); + g_Settings->crPUTextColour = db_get_dw(NULL, CHAT_MODULE, "PopupColorText", 0); + g_Settings->bShowContactStatus = db_get_b(NULL, CHAT_MODULE, "ShowContactStatus", 0) != 0; + g_Settings->bContactStatusFirst = db_get_b(NULL, CHAT_MODULE, "ContactStatusFirst", 0) != 0; LoadColors(); @@ -235,7 +235,7 @@ void LoadGlobalSettings(void) InitSetting(&g_Settings->pszHighlightWords, "HighlightWords", _T("%m")); InitSetting(&g_Settings->pszLogDir, "LogDirectory", _T("%miranda_logpath%\\%proto%\\%userid%.log")); - g_Settings->bLogIndentEnabled = db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0; + g_Settings->bLogIndentEnabled = db_get_b(NULL, CHAT_MODULE, "LogIndentEnabled", 1) != 0; LOGFONT lf; if (g_Settings->MessageBoxFont) @@ -314,13 +314,13 @@ int OptionsInit(void) g_Settings->UserListFont = NULL; g_Settings->UserListHeadingsFont = NULL; g_Settings->MessageBoxFont = NULL; - g_Settings->iWidth = db_get_dw(NULL, "Chat", "roomwidth", -1); - g_Settings->iHeight = db_get_dw(NULL, "Chat", "roomheight", -1); + g_Settings->iWidth = db_get_dw(NULL, CHAT_MODULE, "roomwidth", -1); + g_Settings->iHeight = db_get_dw(NULL, CHAT_MODULE, "roomheight", -1); - g_Settings->iSplitterX = db_get_w(NULL, "Chat", "SplitterX", 105); + g_Settings->iSplitterX = db_get_w(NULL, CHAT_MODULE, "SplitterX", 105); if (g_Settings->iSplitterX <= 50) g_Settings->iSplitterX = 105; - g_Settings->iSplitterY = db_get_w(NULL, "Chat", "SplitterY", 90); + g_Settings->iSplitterY = db_get_w(NULL, CHAT_MODULE, "SplitterY", 90); if (g_Settings->iSplitterY <= 65) g_Settings->iSplitterY = 90; diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index bae1a2016e..5b3b2df05a 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -79,7 +79,7 @@ static int FontsChanged(WPARAM wParam, LPARAM lParam) LoadMsgLogBitmaps(); SetIndentSize(); - g_Settings->bLogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE; + g_Settings->bLogIndentEnabled = (db_get_b(NULL, CHAT_MODULE, "LogIndentEnabled", 1) != 0) ? TRUE : FALSE; ci.MM_FontsChanged(); ci.MM_FixColors(); @@ -214,9 +214,9 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->ptszStatusbarText = mir_tstrdup(gcw->ptszStatusbarText); si->iSplitterX = g_Settings->iSplitterX; si->iSplitterY = g_Settings->iSplitterY; - si->iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0); - si->bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0); - si->bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1); + si->iLogFilterFlags = (int)db_get_dw(NULL, CHAT_MODULE, "FilterFlags", 0x03E0); + si->bFilterEnabled = db_get_b(NULL, CHAT_MODULE, "FilterEnabled", 0); + si->bNicklistEnabled = db_get_b(NULL, CHAT_MODULE, "ShowNicklist", 1); if (mi->bColor) { si->iFG = 4; @@ -286,7 +286,7 @@ static int DoControl(GCEVENT *gce, WPARAM wp) case SESSION_INITDONE: if (si = ci.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) { SetInitDone(si); - if (wp != SESSION_INITDONE || db_get_b(NULL, "Chat", "PopupOnJoin", 0) == 0) + if (wp != SESSION_INITDONE || db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) == 0) ci.ShowRoom(si, wp, TRUE); return 0; } @@ -440,7 +440,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) db_set_ts(si->hContact, si->pszModule, "Topic", si->ptszTopic); if (ci.OnSetTopic) ci.OnSetTopic(si); - if (db_get_b(NULL, "Chat", "TopicOnClist", 0)) + if (db_get_b(NULL, CHAT_MODULE, "TopicOnClist", 0)) db_set_ts(si->hContact, "CList", "StatusMsg", si->ptszTopic); } } @@ -551,7 +551,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); - char* mods[3] = { "Chat", "ChatFonts" }; + char* mods[3] = { CHAT_MODULE, CHATFONT_MODULE }; CallService("DBEditorpp/RegisterModule", (WPARAM)mods, 2); CLISTMENUITEM mi = { sizeof(mi) }; diff --git a/src/modules/chat/clist.cpp b/src/modules/chat/clist.cpp index 658076cd09..ce9680cb32 100644 --- a/src/modules/chat/clist.cpp +++ b/src/modules/chat/clist.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HANDLE AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType) { TCHAR pszGroup[50]; *pszGroup = '\0'; - ptrT groupName(db_get_tsa(NULL, "Chat", "AddToGroup")); + ptrT groupName(db_get_tsa(NULL, CHAT_MODULE, "AddToGroup")); if (groupName) _tcsncpy_s(pszGroup, SIZEOF(pszGroup), groupName, _TRUNCATE); else @@ -121,7 +121,7 @@ int RoomDoubleclicked(WPARAM wParam, LPARAM lParam) if (si) { // is the "toggle visibility option set, so we need to close the window? if (si->hWnd != NULL && - db_get_b(NULL, "Chat", "ToggleVisibility", 0) == 1 && + db_get_b(NULL, CHAT_MODULE, "ToggleVisibility", 0) == 1 && !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0) && IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd)) { diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index 36e25f3e29..42022b7c38 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -389,7 +389,7 @@ void CheckColorsInModule(const char *pszModule) MODULEINFO *pMod = ci.MM_FindModule(pszModule); int i = 0; COLORREF crFG; - COLORREF crBG = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW)); + COLORREF crBG = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW)); LoadMsgDlgFont(17, NULL, &crFG); -- cgit v1.2.3