From 81cc0996f38dca205fe283e24d64df6e9cea7c10 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 17 Jan 2014 15:14:41 +0000 Subject: - icons management also moved to core; - forced ReloadSettings() after initialization git-svn-id: http://svn.miranda-ng.org/main/trunk@7690 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdchat/src/chat.h | 1 - src/core/stdchat/src/main.cpp | 36 ++++-------------------------------- src/modules/chat/chat.h | 1 + src/modules/chat/chat_opts.cpp | 8 +++----- src/modules/chat/chat_svc.cpp | 26 ++++++++++++++++++++++++++ src/modules/chat/manager.cpp | 2 ++ 6 files changed, 36 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index c8433da7ef..f7f8a5ef09 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -143,7 +143,6 @@ struct COLORCHOOSER //main.c void LoadIcons(void); -void LoadLogIcons(void); //colorchooser.c INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 95fd00ef68..9d70355fd8 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -261,7 +261,9 @@ extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfo); mir_getCLI(); - + + AddIcons(); + CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Chat module") }; mir_getCI(&data); pci->OnAddUser = OnAddUser; @@ -286,13 +288,11 @@ extern "C" __declspec(dllexport) int Load(void) pci->OnSetStatusBar = OnSetStatusBar; pci->OnFlashWindow = OnFlashWindow; pci->ShowRoom = ShowRoom; + pci->ReloadSettings(); g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU)); - AddIcons(); LoadIcons(); - OnLoadSettings(); - HookEvent(ME_OPT_INITIALISE, OptionsInitialize); HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); return 0; @@ -311,36 +311,8 @@ extern "C" __declspec(dllexport) int Unload(void) return 0; } -void LoadLogIcons(void) -{ - pci->hIcons[ICON_ACTION] = LoadIconEx("log_action", FALSE); - pci->hIcons[ICON_ADDSTATUS] = LoadIconEx("log_addstatus", FALSE); - pci->hIcons[ICON_HIGHLIGHT] = LoadIconEx("log_highlight", FALSE); - pci->hIcons[ICON_INFO] = LoadIconEx("log_info", FALSE); - pci->hIcons[ICON_JOIN] = LoadIconEx("log_join", FALSE); - pci->hIcons[ICON_KICK] = LoadIconEx("log_kick", FALSE); - pci->hIcons[ICON_MESSAGE] = LoadIconEx("log_message_in", FALSE); - pci->hIcons[ICON_MESSAGEOUT] = LoadIconEx("log_message_out", FALSE); - pci->hIcons[ICON_NICK] = LoadIconEx("log_nick", FALSE); - pci->hIcons[ICON_NOTICE] = LoadIconEx("log_notice", FALSE); - pci->hIcons[ICON_PART] = LoadIconEx("log_part", FALSE); - pci->hIcons[ICON_QUIT] = LoadIconEx("log_quit", FALSE); - pci->hIcons[ICON_REMSTATUS] = LoadIconEx("log_removestatus", FALSE); - pci->hIcons[ICON_TOPIC] = LoadIconEx("log_topic", FALSE); - pci->hIcons[ICON_STATUS1] = LoadIconEx("status1", FALSE); - pci->hIcons[ICON_STATUS2] = LoadIconEx("status2", FALSE); - pci->hIcons[ICON_STATUS3] = LoadIconEx("status3", FALSE); - pci->hIcons[ICON_STATUS4] = LoadIconEx("status4", FALSE); - pci->hIcons[ICON_STATUS0] = LoadIconEx("status0", FALSE); - pci->hIcons[ICON_STATUS5] = LoadIconEx("status5", FALSE); -} - void LoadIcons(void) { - memset(pci->hIcons, 0, sizeof(pci->hIcons)); - - LoadLogIcons(); - hIconsList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 100); ImageList_AddIcon(hIconsList, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE)); ImageList_AddIcon(hIconsList, LoadIconEx("overlay", FALSE)); diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h index 74855f1785..f4027e4e6b 100644 --- a/src/modules/chat/chat.h +++ b/src/modules/chat/chat.h @@ -73,6 +73,7 @@ void SetIndentSize(void); void RegisterFonts(void); // services.c +void LoadChatIcons(void); int LoadChatModule(void); void UnloadChatModule(void); diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index 6917d0be6f..45f179e99b 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -288,6 +288,9 @@ void LoadGlobalSettings(void) LoadMsgDlgFont(19, &lf, NULL); g_Settings->UserListHeadingsFont = CreateFontIndirect(&lf); + if (g_Settings->LoggingEnabled) + CreateDirectoryTreeT(g_Settings->pszLogDir); + SetIndentSize(); } @@ -361,8 +364,6 @@ int OptionsInit(void) if (g_Settings->iSplitterY <= 65) g_Settings->iSplitterY = 90; - LoadGlobalSettings(); - SkinAddNewSoundEx("ChatMessage", LPGEN("Group chats"), LPGEN("Incoming message")); SkinAddNewSoundEx("ChatHighlight", LPGEN("Group chats"), LPGEN("Message is highlighted")); SkinAddNewSoundEx("ChatAction", LPGEN("Group chats"), LPGEN("User has performed an action")); @@ -374,9 +375,6 @@ int OptionsInit(void) SkinAddNewSoundEx("ChatNotice", LPGEN("Group chats"), LPGEN("User has sent a notice")); SkinAddNewSoundEx("ChatQuit", LPGEN("Group chats"), LPGEN("User has disconnected")); SkinAddNewSoundEx("ChatTopic", LPGEN("Group chats"), LPGEN("The topic has been changed")); - - if (g_Settings->LoggingEnabled) - CreateDirectoryTreeT(g_Settings->pszLogDir); return 0; } diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index 5bbd5caeba..a04bfa861a 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -44,6 +44,30 @@ static HANDLE ///////////////////////////////////////////////////////////////////////////////////////// // Post-load event hooks +void LoadChatIcons(void) +{ + ci.hIcons[ICON_ACTION] = LoadIconEx("log_action", FALSE); + ci.hIcons[ICON_ADDSTATUS] = LoadIconEx("log_addstatus", FALSE); + ci.hIcons[ICON_HIGHLIGHT] = LoadIconEx("log_highlight", FALSE); + ci.hIcons[ICON_INFO] = LoadIconEx("log_info", FALSE); + ci.hIcons[ICON_JOIN] = LoadIconEx("log_join", FALSE); + ci.hIcons[ICON_KICK] = LoadIconEx("log_kick", FALSE); + ci.hIcons[ICON_MESSAGE] = LoadIconEx("log_message_in", FALSE); + ci.hIcons[ICON_MESSAGEOUT] = LoadIconEx("log_message_out", FALSE); + ci.hIcons[ICON_NICK] = LoadIconEx("log_nick", FALSE); + ci.hIcons[ICON_NOTICE] = LoadIconEx("log_notice", FALSE); + ci.hIcons[ICON_PART] = LoadIconEx("log_part", FALSE); + ci.hIcons[ICON_QUIT] = LoadIconEx("log_quit", FALSE); + ci.hIcons[ICON_REMSTATUS] = LoadIconEx("log_removestatus", FALSE); + ci.hIcons[ICON_TOPIC] = LoadIconEx("log_topic", FALSE); + ci.hIcons[ICON_STATUS0] = LoadIconEx("status0", FALSE); + ci.hIcons[ICON_STATUS1] = LoadIconEx("status1", FALSE); + ci.hIcons[ICON_STATUS2] = LoadIconEx("status2", FALSE); + ci.hIcons[ICON_STATUS3] = LoadIconEx("status3", FALSE); + ci.hIcons[ICON_STATUS4] = LoadIconEx("status4", FALSE); + ci.hIcons[ICON_STATUS5] = LoadIconEx("status5", FALSE); +} + static int FontsChanged(WPARAM wParam, LPARAM lParam) { LoadLogFonts(); @@ -59,6 +83,8 @@ static int FontsChanged(WPARAM wParam, LPARAM lParam) static int IconsChanged(WPARAM wParam, LPARAM lParam) { + LoadChatIcons(); + FreeMsgLogBitmaps(); LoadMsgLogBitmaps(); diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp index ac110f3429..60ceb2181d 100644 --- a/src/modules/chat/manager.cpp +++ b/src/modules/chat/manager.cpp @@ -1487,6 +1487,8 @@ INT_PTR SvcGetChatManager(WPARAM, LPARAM lParam) g_szFontGroup = pInit->szFontGroup; g_cbSession = pInit->cbSession; g_cbModuleInfo = pInit->cbModuleInfo; + + LoadChatIcons(); RegisterFonts(); OptionsInit(); return (INT_PTR)&ci; -- cgit v1.2.3