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 --- plugins/Scriver/src/chat/chat.h | 1 - plugins/Scriver/src/chat/main.cpp | 27 +-------------------------- plugins/Scriver/src/statusicon.cpp | 2 -- plugins/TabSRMM/src/chat/main.cpp | 23 +---------------------- 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 ++ 10 files changed, 38 insertions(+), 89 deletions(-) diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h index ffe9f804bb..323f8cf9ea 100644 --- a/plugins/Scriver/src/chat/chat.h +++ b/plugins/Scriver/src/chat/chat.h @@ -82,7 +82,6 @@ typedef struct{ COLORCHOOSER; //main.c -void LoadChatIcons(void); void UpgradeCheck(void); //colorchooser.c diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index 6a54c7b865..fab57d653a 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -116,30 +116,6 @@ static void OnCreateModule(MODULEINFO *mi) mi->hOfflineIconBig = LoadSkinnedProtoIconBig(mi->pszModule, ID_STATUS_OFFLINE); } -void LoadChatIcons(void) -{ - pci->hIcons[ICON_ACTION] = GetCachedIcon("chat_log_action"); - pci->hIcons[ICON_ADDSTATUS] = GetCachedIcon("chat_log_addstatus"); - pci->hIcons[ICON_HIGHLIGHT] = GetCachedIcon("chat_log_highlight"); - pci->hIcons[ICON_INFO] = GetCachedIcon("chat_log_info"); - pci->hIcons[ICON_JOIN] = GetCachedIcon("chat_log_join"); - pci->hIcons[ICON_KICK] = GetCachedIcon("chat_log_kick"); - pci->hIcons[ICON_MESSAGE] = GetCachedIcon("chat_log_message_in"); - pci->hIcons[ICON_MESSAGEOUT] = GetCachedIcon("chat_log_message_out"); - pci->hIcons[ICON_NICK] = GetCachedIcon("chat_log_nick"); - pci->hIcons[ICON_NOTICE] = GetCachedIcon("chat_log_notice"); - pci->hIcons[ICON_PART] = GetCachedIcon("chat_log_part"); - pci->hIcons[ICON_QUIT] = GetCachedIcon("chat_log_quit"); - pci->hIcons[ICON_REMSTATUS] = GetCachedIcon("chat_log_removestatus"); - pci->hIcons[ICON_TOPIC] = GetCachedIcon("chat_log_topic"); - pci->hIcons[ICON_STATUS1] = GetCachedIcon("chat_status1"); - pci->hIcons[ICON_STATUS2] = GetCachedIcon("chat_status2"); - pci->hIcons[ICON_STATUS3] = GetCachedIcon("chat_status3"); - pci->hIcons[ICON_STATUS4] = GetCachedIcon("chat_status4"); - pci->hIcons[ICON_STATUS0] = GetCachedIcon("chat_status0"); - pci->hIcons[ICON_STATUS5] = GetCachedIcon("chat_status5"); -} - int Chat_Load() { CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Messaging")_T("/")LPGENT("Group chats") }; @@ -160,8 +136,7 @@ int Chat_Load() pci->OnSetStatusBar = OnSetStatusBar; pci->OnFlashWindow = OnFlashWindow; pci->ShowRoom = ShowRoom; - - LoadChatIcons(); + pci->ReloadSettings(); g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU)); TranslateMenu(g_hMenu); diff --git a/plugins/Scriver/src/statusicon.cpp b/plugins/Scriver/src/statusicon.cpp index fa56859f67..f9c3d02936 100644 --- a/plugins/Scriver/src/statusicon.cpp +++ b/plugins/Scriver/src/statusicon.cpp @@ -71,8 +71,6 @@ static int OnSrmmIconChanged(WPARAM wParam, LPARAM) if (hwnd != NULL) PostMessage(GetParent(hwnd), DM_STATUSICONCHANGE, 0, 0); } - - LoadChatIcons(); return 0; } diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index 690e5665e4..bd043c637b 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -202,28 +202,6 @@ static void OnLoadSettings() void Chat_ModulesLoaded() { - ZeroMemory(pci->hIcons, sizeof(HICON)* (ICON_STATUS5 - ICON_ACTION)); - pci->hIcons[ICON_ACTION] = LoadIconEx(IDI_ACTION, "log_action", 16, 16); - pci->hIcons[ICON_ADDSTATUS] = LoadIconEx(IDI_ADDSTATUS, "log_addstatus", 16, 16); - pci->hIcons[ICON_HIGHLIGHT] = LoadIconEx(IDI_HIGHLIGHT, "log_highlight", 16, 16); - pci->hIcons[ICON_INFO] = LoadIconEx(IDI_INFO, "log_info", 16, 16); - pci->hIcons[ICON_JOIN] = LoadIconEx(IDI_JOIN, "log_join", 16, 16); - pci->hIcons[ICON_KICK] = LoadIconEx(IDI_KICK, "log_kick", 16, 16); - pci->hIcons[ICON_MESSAGE] = LoadIconEx(IDI_MESSAGE, "log_message_in", 16, 16); - pci->hIcons[ICON_MESSAGEOUT] = LoadIconEx(IDI_MESSAGEOUT, "log_message_out", 16, 16); - pci->hIcons[ICON_NICK] = LoadIconEx(IDI_NICK, "log_nick", 16, 16); - pci->hIcons[ICON_NOTICE] = LoadIconEx(IDI_NOTICE, "log_notice", 16, 16); - pci->hIcons[ICON_PART] = LoadIconEx(IDI_PART, "log_part", 16, 16); - pci->hIcons[ICON_QUIT] = LoadIconEx(IDI_QUIT, "log_quit", 16, 16); - pci->hIcons[ICON_REMSTATUS] = LoadIconEx(IDI_REMSTATUS, "log_removestatus", 16, 16); - pci->hIcons[ICON_TOPIC] = LoadIconEx(IDI_TOPIC, "log_topic", 16, 16); - pci->hIcons[ICON_STATUS1] = LoadIconEx(IDI_STATUS1, "status1", 16, 16); - pci->hIcons[ICON_STATUS2] = LoadIconEx(IDI_STATUS2, "status2", 16, 16); - pci->hIcons[ICON_STATUS3] = LoadIconEx(IDI_STATUS3, "status3", 16, 16); - pci->hIcons[ICON_STATUS4] = LoadIconEx(IDI_STATUS4, "status4", 16, 16); - pci->hIcons[ICON_STATUS0] = LoadIconEx(IDI_STATUS0, "status0", 16, 16); - pci->hIcons[ICON_STATUS5] = LoadIconEx(IDI_STATUS5, "status5", 16, 16); - g_Settings.hIconOverlay = LoadIconEx(IDI_OVERLAY, "overlay", 16, 16); } @@ -295,6 +273,7 @@ int Chat_Load() // this operation is unsafe, that's why we restore the old pci state on exit pci->DoSoundsFlashPopupTrayStuff = DoSoundsFlashPopupTrayStuff; + pci->ReloadSettings(); g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU)); 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