diff options
author | George Hazan <ghazan@miranda.im> | 2017-04-01 12:42:26 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-04-01 12:42:26 +0300 |
commit | 6293b72f7df8704c3b2494fb3c22494118cbcd6a (patch) | |
tree | 90be59a87c7162136026ff7d69d14f63a379bdac /src/core | |
parent | 60cc9a19a798edfe59ae0c412e4d1052d44f3b24 (diff) |
StdMsg:
- ShowRoom moved to chat_manager.cpp because there's no more hidden window procedure
- we don't need the empty container to raise up at startup
- not all chat options were reloaded on clicking Apply
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stdmsg/src/chat_manager.cpp | 43 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_options.cpp | 9 | ||||
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 4 | ||||
-rw-r--r-- | src/core/stdmsg/src/tabs.cpp | 58 |
4 files changed, 46 insertions, 68 deletions
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp index 0a35768e03..c1a2a3488c 100644 --- a/src/core/stdmsg/src/chat_manager.cpp +++ b/src/core/stdmsg/src/chat_manager.cpp @@ -184,6 +184,48 @@ static void RegisterFonts() Colour_RegisterW(&colourid); } +static void ShowRoom(SESSION_INFO *si) +{ + if (!si) + return; + + // Do we need to create a window? + if (si->pDlg == nullptr) { + if (g_Settings.bTabsEnable) { + if (pDialog == nullptr) { + pDialog = new CTabbedWindow(); + pDialog->Show(); + } + pDialog->AddPage(si); + PostMessage(pDialog->GetHwnd(), WM_SIZE, 0, 0); + } + else { + CTabbedWindow *pContainer = new CTabbedWindow(); + pContainer->Create(); + + CDlgBase *pDlg = pContainer->m_pEmbed = new CChatRoomDlg(pContainer, si); + pDlg->SetParent(pContainer->GetHwnd()); + pDlg->Create(); + pContainer->Show(); + PostMessage(pContainer->GetHwnd(), WM_SIZE, 0, 0); + } + + if (si->iType != GCW_SERVER) + si->pDlg->UpdateNickList(); + else + si->pDlg->UpdateTitle(); + si->pDlg->RedrawLog(); + si->pDlg->UpdateStatusBar(); + } + + SetWindowLongPtr(si->pDlg->GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(si->pDlg->GetHwnd(), GWL_EXSTYLE) | WS_EX_APPWINDOW); + + if (IsIconic(si->pDlg->GetHwnd())) + si->pDlg->Show(SW_NORMAL); + si->pDlg->Show(SW_SHOW); + SetForegroundWindow(si->pDlg->GetHwnd()); +} + int OnCheckPlugins(WPARAM, LPARAM) { SmileyAddInstalled = ServiceExists(MS_SMILEYADD_REPLACESMILEYS); @@ -220,7 +262,6 @@ void Load_ChatModule() ImageList_SetOverlayImage(hIconsList, 1, 1); HookEvent(ME_SYSTEM_MODULELOAD, OnCheckPlugins); - InitTabs(); } void Unload_ChatModule() diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index e2313ddc94..6f8abaac8d 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -419,13 +419,8 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch5, _countof(branch5)); if (PopupInstalled) SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch6, _countof(branch6)); - g_Settings.dwIconFlags = db_get_dw(0, CHAT_MODULE, "IconFlags", 0x0000); - g_Settings.dwTrayIconFlags = db_get_dw(0, CHAT_MODULE, "TrayIconFlags", 0x1000); - g_Settings.dwPopupFlags = db_get_dw(0, CHAT_MODULE, "PopupFlags", 0x0000); - g_Settings.bStripFormat = db_get_b(0, CHAT_MODULE, "TrimFormatting", 0) != 0; - g_Settings.bTrayIconInactiveOnly = db_get_b(0, CHAT_MODULE, "TrayIconInactiveOnly", 1) != 0; - g_Settings.bPopupInactiveOnly = db_get_b(0, CHAT_MODULE, "PopupInactiveOnly", 1) != 0; - g_Settings.bLogIndentEnabled = db_get_b(0, CHAT_MODULE, "LogIndentEnabled", 1) != 0; + + pci->ReloadSettings(); if (b != db_get_b(0, CHAT_MODULE, "Tabs", 1)) { pci->SM_BroadcastMessage(nullptr, WM_CLOSE, 0, 1, FALSE); diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 7f182b90e5..bb849b85d6 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -132,9 +132,6 @@ void AddIcons(void); HICON LoadIconEx(const char *pszIcoLibName, bool big);
HANDLE GetIconHandle(const char *pszIcolibName);
-// services.cpp
-void ShowRoom(SESSION_INFO *si);
-
// tools.cpp
int GetColorIndex(const char* pszModule, COLORREF cr);
void CheckColorsInModule(const char* pszModule);
@@ -178,7 +175,6 @@ public: extern CTabbedWindow *pDialog;
-void InitTabs(void);
void UninitTabs(void);
void TB_SaveSession(SESSION_INFO *si);
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index 78fa859426..a7830b494f 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -40,6 +40,8 @@ void TB_SaveSession(SESSION_INFO *si) arSavedTabs.insert(new CSavedTab(si->pszModule, si->ptszID)); } +CTabbedWindow *pDialog = nullptr; + ///////////////////////////////////////////////////////////////////////////////////////// CTabbedWindow::CTabbedWindow() : @@ -584,18 +586,6 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// -CTabbedWindow *pDialog = nullptr; - -void InitTabs() -{ - if (g_Settings.bTabsEnable && pDialog == nullptr) { - pDialog = new CTabbedWindow(); - pDialog->Create(); - } - else if (g_Settings.bTabsEnable) - UninitTabs(); -} - void UninitTabs() { if (pDialog != nullptr) { @@ -605,47 +595,3 @@ void UninitTabs() arSavedTabs.destroy(); } - -///////////////////////////////////////////////////////////////////////////////////////// - -void ShowRoom(SESSION_INFO *si) -{ - if (!si) - return; - - // Do we need to create a window? - if (si->pDlg == nullptr) { - if (g_Settings.bTabsEnable) { - if (pDialog == nullptr) { - pDialog = new CTabbedWindow(); - pDialog->Show(); - } - pDialog->AddPage(si); - PostMessage(pDialog->GetHwnd(), WM_SIZE, 0, 0); - } - else { - CTabbedWindow *pContainer = new CTabbedWindow(); - pContainer->Create(); - - CDlgBase *pDlg = pContainer->m_pEmbed = new CChatRoomDlg(pContainer, si); - pDlg->SetParent(pContainer->GetHwnd()); - pDlg->Create(); - pContainer->Show(); - PostMessage(pContainer->GetHwnd(), WM_SIZE, 0, 0); - } - - if (si->iType != GCW_SERVER) - si->pDlg->UpdateNickList(); - else - si->pDlg->UpdateTitle(); - si->pDlg->RedrawLog(); - si->pDlg->UpdateStatusBar(); - } - - SetWindowLongPtr(si->pDlg->GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(si->pDlg->GetHwnd(), GWL_EXSTYLE) | WS_EX_APPWINDOW); - - if (IsIconic(si->pDlg->GetHwnd())) - si->pDlg->Show(SW_NORMAL); - si->pDlg->Show(SW_SHOW); - SetForegroundWindow(si->pDlg->GetHwnd()); -} |