diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdchat/src/chat.h | 4 | ||||
-rw-r--r-- | src/core/stdchat/src/main.cpp | 14 | ||||
-rw-r--r-- | src/core/stdchat/src/options.cpp | 15 | ||||
-rw-r--r-- | src/core/stdchat/src/window.cpp | 8 | ||||
-rw-r--r-- | src/modules/chat/chat.h | 1 | ||||
-rw-r--r-- | src/modules/chat/chat_opts.cpp | 8 | ||||
-rw-r--r-- | src/modules/chat/chat_svc.cpp | 16 | ||||
-rw-r--r-- | src/modules/chat/log.cpp | 4 | ||||
-rw-r--r-- | src/modules/chat/manager.cpp | 6 |
9 files changed, 28 insertions, 48 deletions
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index 81cda11d63..9f7e9cba7a 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -95,7 +95,6 @@ extern GlobalLogSettings g_Settings; extern SESSION_INFO g_TabSession;
extern TABLIST *g_TabList;
extern HMENU g_hMenu;
-extern HBRUSH hListBkgBrush, hListSelectedBkgBrush;
extern HINSTANCE g_hInst;
extern BOOL SmileyAddInstalled, PopupInstalled;
@@ -154,8 +153,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth);
// options.c
-int OptionsInit(void);
-int OptionsUnInit(void);
+int OptionsInitialize(WPARAM wParam, LPARAM lParam);
void AddIcons(void);
HICON LoadIconEx(char* pszIcoLibName, BOOL big);
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index ffacc93dc9..eb345b53ab 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -31,7 +31,6 @@ HINSTANCE g_hInst; int hLangpack;
BOOL SmileyAddInstalled = FALSE, PopupInstalled = FALSE;
-HBRUSH hListBkgBrush = NULL, hListSelectedBkgBrush = NULL;
GlobalLogSettings g_Settings;
@@ -230,14 +229,6 @@ static void OnLoadSettings() g_Settings.TabsAtBottom = db_get_b(NULL, "Chat", "TabBottom", 0);
g_Settings.TabCloseOnDblClick = db_get_b(NULL, "Chat", "TabCloseOnDblClick", 0);
- if (hListBkgBrush != NULL)
- DeleteObject(hListBkgBrush);
- hListBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW)));
-
- if (hListSelectedBkgBrush != NULL)
- DeleteObject(hListSelectedBkgBrush);
- hListSelectedBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)));
-
ZeroMemory(&g_TabSession, sizeof(SESSION_INFO));
g_TabSession.iType = GCW_TABROOM;
g_TabSession.iSplitterX = g_Settings.iSplitterX;
@@ -287,8 +278,8 @@ extern "C" __declspec(dllexport) int Load(void) LoadIcons();
OnLoadSettings();
- OptionsInit();
-
+
+ HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
return 0;
}
@@ -303,7 +294,6 @@ extern "C" __declspec(dllexport) int Unload(void) db_set_dw(NULL, "Chat", "roomheight", g_Settings.iHeight);
DestroyMenu(g_hMenu);
- OptionsUnInit();
return 0;
}
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 2b5b9dacd9..147978e048 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -725,7 +725,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg, UINT uMsg, WPARAM wPar return FALSE;
}
-static int OptionsInitialize(WPARAM wParam, LPARAM lParam)
+int OptionsInitialize(WPARAM wParam, LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 910000000;
@@ -755,16 +755,3 @@ static int OptionsInitialize(WPARAM wParam, LPARAM lParam) }
return 0;
}
-
-int OptionsInit(void)
-{
- HookEvent(ME_OPT_INITIALISE, OptionsInitialize);
- return 0;
-}
-
-int OptionsUnInit(void)
-{
- DeleteObject(hListBkgBrush);
- DeleteObject(hListSelectedBkgBrush);
- return 0;
-}
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index b19a5040f6..b0bdffc27a 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -977,7 +977,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (rc.bottom-rc.top > items * height) {
rc.top = items*height;
- FillRect(dc, &rc, hListBkgBrush);
+ FillRect(dc, &rc, pci->hListBkgBrush);
} } } }
return 1;
@@ -1735,7 +1735,7 @@ END_REMOVETAB: case WM_CTLCOLORLISTBOX:
SetBkColor((HDC) wParam, g_Settings.crUserListBGColor);
- return (INT_PTR) hListBkgBrush;
+ return (INT_PTR)pci->hListBkgBrush;
case WM_MEASUREITEM:
{
@@ -1779,9 +1779,9 @@ END_REMOVETAB: SetBkMode(dis->hDC, TRANSPARENT);
if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
- FillRect(dis->hDC, &dis->rcItem, hListSelectedBkgBrush);
+ FillRect(dis->hDC, &dis->rcItem, pci->hListSelectedBkgBrush);
else //if (dis->itemState & ODS_INACTIVE)
- FillRect(dis->hDC, &dis->rcItem, hListBkgBrush);
+ FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush);
if (g_Settings.ShowContactStatus && g_Settings.ContactStatusFirst && ui->ContactStatus) {
HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h index 8392f7b8f8..c916ca565a 100644 --- a/src/modules/chat/chat.h +++ b/src/modules/chat/chat.h @@ -66,6 +66,7 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour); void LoadGlobalSettings(void);
HICON LoadIconEx(char* pszIcoLibName, BOOL big);
void LoadLogFonts(void);
+void SetIndentSize();
// services.c
void InitChatModule(void);
diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index 832ac721ed..131ba59dcf 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -73,6 +73,14 @@ void LoadLogFonts(void) {
for (int i=0; i < OPTIONS_FONTCOUNT; i++)
LoadMsgDlgFont(i, &ci.aFonts[i].lf, &ci.aFonts[i].color);
+
+ if (ci.hListBkgBrush != NULL)
+ DeleteObject(ci.hListBkgBrush);
+ ci.hListBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW)));
+
+ if (ci.hListSelectedBkgBrush != NULL)
+ DeleteObject(ci.hListSelectedBkgBrush);
+ ci.hListSelectedBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT)));
}
void LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF* colour)
diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index 46586ea2c3..4e8f9b114f 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -50,16 +50,7 @@ static int FontsChanged(WPARAM wParam, LPARAM lParam) {
LoadLogFonts();
- LOGFONT lf;
- HFONT hFont;
- int iText;
-
- LoadMsgDlgFont(0, &lf, NULL);
- hFont = CreateFontIndirect(&lf);
- iText = GetTextPixelSize(MakeTimeStamp(ci.pSettings->pszTimeStamp, time(NULL)), hFont, TRUE);
- DeleteObject(hFont);
- ci.pSettings->LogTextIndent = iText;
- ci.pSettings->LogTextIndent = ci.pSettings->LogTextIndent * 12 / 10;
+ SetIndentSize();
ci.pSettings->LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
ci.MM_FontsChanged();
@@ -71,8 +62,8 @@ static int FontsChanged(WPARAM wParam, LPARAM lParam) static int IconsChanged(WPARAM wParam, LPARAM lParam)
{
FreeMsgLogBitmaps();
-
LoadMsgLogBitmaps();
+
ci.MM_IconsChanged();
ci.SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, FALSE);
return 0;
@@ -84,6 +75,9 @@ static int PreShutdown(WPARAM wParam, LPARAM lParam) ci.SM_RemoveAll();
ci.MM_RemoveAll();
+
+ DeleteObject(ci.hListBkgBrush);
+ DeleteObject(ci.hListSelectedBkgBrush);
return 0;
}
diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp index fc8788561e..c8fd06a5a9 100644 --- a/src/modules/chat/log.cpp +++ b/src/modules/chat/log.cpp @@ -312,10 +312,10 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced, break;
} } }
-TCHAR* MakeTimeStamp(TCHAR* pszStamp, time_t time)
+TCHAR* MakeTimeStamp(TCHAR *pszStamp, time_t time)
{
static TCHAR szTime[30];
- if (!_tcsftime(szTime, SIZEOF(szTime) - 1, pszStamp, localtime(&time)))
+ if (!_tcsftime(szTime, SIZEOF(szTime)-1, pszStamp, localtime(&time)))
_tcsncpy(szTime, TranslateT("<invalid>"), SIZEOF(szTime));
return szTime;
}
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp index b59420f8dd..d2f50ba864 100644 --- a/src/modules/chat/manager.cpp +++ b/src/modules/chat/manager.cpp @@ -1473,14 +1473,16 @@ CHAT_MANAGER ci = SetAllOffline,
AddEvent,
FindRoom,
- NULL, // must be implemented in a plugin
Log_CreateRTF,
- LoadMsgDlgFont
+ LoadMsgDlgFont,
+ MakeTimeStamp
};
INT_PTR SvcGetChatManager(WPARAM, LPARAM lParam)
{
LoadChatModule();
+
+ memset(PBYTE(&ci) + offsetof(CHAT_MANAGER, OnSessionDblClick), 0, sizeof(CHAT_MANAGER) - offsetof(CHAT_MANAGER, OnSessionDblClick));
ci.pSettings = (GlobalLogSettingsBase*)lParam;
OptionsInit();
return (INT_PTR)&ci;
|