diff options
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/res/chat.rc | 5 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat.h (renamed from plugins/TabSRMM/src/chat/chat.h) | 0 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/services.cpp | 160 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_log.cpp (renamed from plugins/TabSRMM/src/chat/log.cpp) | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_main.cpp (renamed from plugins/TabSRMM/src/chat/main.cpp) | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_manager.cpp (renamed from plugins/TabSRMM/src/chat/manager.cpp) | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_options.cpp (renamed from plugins/TabSRMM/src/chat/options.cpp) | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_resource.h (renamed from plugins/TabSRMM/src/chat/chat_resource.h) | 0 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_tools.cpp (renamed from plugins/TabSRMM/src/chat/tools.cpp) | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp (renamed from plugins/TabSRMM/src/chat/window.cpp) | 136 | ||||
-rw-r--r-- | plugins/TabSRMM/src/muchighlight.cpp (renamed from plugins/TabSRMM/src/chat/muchighlight.cpp) | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/muchighlight.h (renamed from plugins/TabSRMM/src/chat/muchighlight.h) | 0 | ||||
-rw-r--r-- | plugins/TabSRMM/src/stdafx.h | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/tabsrmm.vcxproj | 8 |
14 files changed, 146 insertions, 179 deletions
diff --git a/plugins/TabSRMM/res/chat.rc b/plugins/TabSRMM/res/chat.rc index b19880376f..87e0f3685f 100644 --- a/plugins/TabSRMM/res/chat.rc +++ b/plugins/TabSRMM/res/chat.rc @@ -1,6 +1,6 @@ // Microsoft Visual C++ generated resource script.
//
-#include "..\src\chat\chat_resource.h"
+#include "..\src\chat_resource.h"
#include "..\src\resource.h"
#define APSTUDIO_READONLY_SYMBOLS
@@ -294,7 +294,8 @@ END 1 TEXTINCLUDE
BEGIN
- "..\\src\\chat\\chat_resource.h\0"
+ "..\\src\\chat_resource.h\r\n"
+ "..\\src\\resource.h\0"
END
2 TEXTINCLUDE
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat.h index 9551527c54..9551527c54 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat.h diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp deleted file mode 100644 index 9e7d82272d..0000000000 --- a/plugins/TabSRMM/src/chat/services.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////
-// Miranda NG: the free IM client for Microsoft* Windows*
-//
-// Copyright (ñ) 2012-17 Miranda NG project,
-// Copyright (c) 2000-09 Miranda ICQ/IM project,
-// all portions of this codebase are copyrighted to the people
-// listed in contributors.txt.
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// you should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
-// part of tabSRMM messaging plugin for Miranda.
-//
-// (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
-//
-// This implements the services that form the group chat API
-
-#include "../stdafx.h"
-
-void ShowRoom(SESSION_INFO *si)
-{
- if (si == nullptr)
- return;
-
- if (si->hWnd != nullptr) {
- ActivateExistingTab(si->dat->m_pContainer, si->hWnd);
- return;
- }
-
- wchar_t szName[CONTAINER_NAMELEN + 2]; szName[0] = 0;
- TContainerData *pContainer = nullptr;
- if (si->dat != nullptr)
- pContainer = si->dat->m_pContainer;
- if (pContainer == nullptr) {
- GetContainerNameForContact(si->hContact, szName, CONTAINER_NAMELEN);
- if (!g_Settings.bOpenInDefault && !mir_wstrcmp(szName, L"default"))
- wcsncpy(szName, L"Chat Rooms", CONTAINER_NAMELEN);
- szName[CONTAINER_NAMELEN] = 0;
- pContainer = FindContainerByName(szName);
- }
- if (pContainer == nullptr)
- pContainer = CreateContainer(szName, FALSE, si->hContact);
- if (pContainer == nullptr)
- return; // smth went wrong, nothing to do here
-
- MCONTACT hContact = si->hContact;
- if (M.FindWindow(hContact) != 0)
- return;
-
- if (hContact != 0 && M.GetByte("limittabs", 0) && !wcsncmp(pContainer->szName, L"default", 6)) {
- if ((pContainer = FindMatchingContainer(L"default")) == NULL) {
- wchar_t szName[CONTAINER_NAMELEN + 1];
- mir_snwprintf(szName, L"default");
- if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact)) == NULL)
- return;
- }
- }
-
- wchar_t *contactName = pcli->pfnGetContactDisplayName(hContact, 0);
-
- // cut nickname if larger than x chars...
- wchar_t newcontactname[128];
- if (mir_wstrlen(contactName) > 0) {
- if (M.GetByte("cuttitle", 0))
- CutContactName(contactName, newcontactname, _countof(newcontactname));
- else
- wcsncpy_s(newcontactname, contactName, _TRUNCATE);
- }
- else wcsncpy_s(newcontactname, L"_U_", _TRUNCATE);
-
- HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS);
-
- // hide the active tab
- if (pContainer->hwndActive)
- ShowWindow(pContainer->hwndActive, SW_HIDE);
-
- int iTabIndex_wanted = M.GetDword(hContact, "tabindex", pContainer->iChilds * 100);
- int iCount = TabCtrl_GetItemCount(hwndTab);
-
- pContainer->iTabIndex = iCount;
- if (iCount > 0) {
- TCITEM item = {};
- for (int i = iCount - 1; i >= 0; i--) {
- item.mask = TCIF_PARAM;
- TabCtrl_GetItem(hwndTab, i, &item);
- HWND hwnd = (HWND)item.lParam;
- CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (dat) {
- int relPos = M.GetDword(dat->m_hContact, "tabindex", i * 100);
- if (iTabIndex_wanted <= relPos)
- pContainer->iTabIndex = i;
- }
- }
- }
-
- TCITEM item = {};
- item.pszText = newcontactname;
- item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
- int iTabId = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &item);
-
- SendMessage(hwndTab, EM_REFRESHWITHOUTCLIP, 0, 0);
- TabCtrl_SetCurSel(hwndTab, iTabId);
- pContainer->iChilds++;
-
- CChatRoomDlg *pDlg = new CChatRoomDlg(si);
- pDlg->m_iTabID = iTabId;
- pDlg->m_pContainer = pContainer;
- pDlg->SetParent(hwndTab);
- pDlg->Create();
-
- HWND hwndNew = pDlg->GetHwnd();
- item.lParam = (LPARAM)hwndNew;
- TabCtrl_SetItem(hwndTab, iTabId, &item);
-
- if (pContainer->dwFlags & CNT_SIDEBAR)
- pContainer->SideBar->addSession(pDlg, pContainer->iTabIndex);
-
- SendMessage(pContainer->hwnd, WM_SIZE, 0, 0);
- // if the container is minimized, then pop it up...
- if (IsIconic(pContainer->hwnd)) {
- SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
- SetFocus(pContainer->hwndActive);
- }
-
- if (PluginConfig.m_bHideOnClose && !IsWindowVisible(pContainer->hwnd)) {
- WINDOWPLACEMENT wp = { 0 };
- wp.length = sizeof(wp);
- GetWindowPlacement(pContainer->hwnd, &wp);
-
- BroadCastContainer(pContainer, DM_CHECKSIZE, 0, 0); // make sure all tabs will re-check layout on activation
- if (wp.showCmd == SW_SHOWMAXIMIZED)
- ShowWindow(pContainer->hwnd, SW_SHOWMAXIMIZED);
- else {
- ShowWindow(pContainer->hwnd, SW_SHOWNORMAL);
- }
- SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0);
- SetFocus(hwndNew);
- }
- else {
- SetFocus(hwndNew);
- RedrawWindow(pContainer->hwnd, NULL, NULL, RDW_INVALIDATE);
- UpdateWindow(pContainer->hwnd);
- if (GetForegroundWindow() != pContainer->hwnd)
- SetForegroundWindow(pContainer->hwnd);
- }
-
- if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek && CSkin::m_skinEnabled && !M.GetByte("forceAeroPeek", 0))
- CWarning::show(CWarning::WARN_AEROPEEK_SKIN, MB_ICONWARNING | MB_OK);
-}
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat_log.cpp index 5981eb3557..90d2441eb4 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat_log.cpp @@ -27,7 +27,7 @@ // Implements the richedit-based message history display for the group
// chat window.
-#include "../stdafx.h"
+#include "stdafx.h"
/*
* The code for streaming the text is to a large extent copied from
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat_main.cpp index 8bc209800c..7ff48d9c6e 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -26,7 +26,7 @@ //
// chat module exports and functions to load/unload the plugin.
-#include "../stdafx.h"
+#include "stdafx.h"
HANDLE g_hWindowList;
HMENU g_hMenu = NULL;
diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat_manager.cpp index 735d0a2e0f..3a93a8a444 100644 --- a/plugins/TabSRMM/src/chat/manager.cpp +++ b/plugins/TabSRMM/src/chat_manager.cpp @@ -24,7 +24,7 @@ //
// (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
-#include "../stdafx.h"
+#include "stdafx.h"
static int sttCompareNicknames(const wchar_t *s1, const wchar_t *s2)
{
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat_options.cpp index d44966e935..15d829834f 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -26,7 +26,7 @@ //
// group chat options and generic font handling
-#include "../stdafx.h"
+#include "stdafx.h"
#define FONTF_BOLD 1
#define FONTF_ITALIC 2
diff --git a/plugins/TabSRMM/src/chat/chat_resource.h b/plugins/TabSRMM/src/chat_resource.h index ee8255a0db..ee8255a0db 100644 --- a/plugins/TabSRMM/src/chat/chat_resource.h +++ b/plugins/TabSRMM/src/chat_resource.h diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 47feb637df..329ba9b6b3 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -26,7 +26,7 @@ //
// Helper functions for the group chat module.
-#include "../stdafx.h"
+#include "stdafx.h"
int GetRichTextLength(HWND hwnd)
{
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 066e83b176..da5e408c66 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -26,7 +26,7 @@ // // This implements the group chat dialog window -#include "../stdafx.h" +#include "stdafx.h" // externs... extern LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -3122,3 +3122,137 @@ LABEL_SHOWWINDOW: } return CTabBaseDlg::DlgProc(uMsg, wParam, lParam); } + +///////////////////////////////////////////////////////////////////////////////////////// +// chat session creator + +void ShowRoom(SESSION_INFO *si) +{ + if (si == nullptr) + return; + + if (si->hWnd != nullptr) { + ActivateExistingTab(si->dat->m_pContainer, si->hWnd); + return; + } + + wchar_t szName[CONTAINER_NAMELEN + 2]; szName[0] = 0; + TContainerData *pContainer = nullptr; + if (si->dat != nullptr) + pContainer = si->dat->m_pContainer; + if (pContainer == nullptr) { + GetContainerNameForContact(si->hContact, szName, CONTAINER_NAMELEN); + if (!g_Settings.bOpenInDefault && !mir_wstrcmp(szName, L"default")) + wcsncpy(szName, L"Chat Rooms", CONTAINER_NAMELEN); + szName[CONTAINER_NAMELEN] = 0; + pContainer = FindContainerByName(szName); + } + if (pContainer == nullptr) + pContainer = CreateContainer(szName, FALSE, si->hContact); + if (pContainer == nullptr) + return; // smth went wrong, nothing to do here + + MCONTACT hContact = si->hContact; + if (M.FindWindow(hContact) != 0) + return; + + if (hContact != 0 && M.GetByte("limittabs", 0) && !wcsncmp(pContainer->szName, L"default", 6)) { + if ((pContainer = FindMatchingContainer(L"default")) == NULL) { + wchar_t szName[CONTAINER_NAMELEN + 1]; + mir_snwprintf(szName, L"default"); + if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact)) == NULL) + return; + } + } + + wchar_t *contactName = pcli->pfnGetContactDisplayName(hContact, 0); + + // cut nickname if larger than x chars... + wchar_t newcontactname[128]; + if (mir_wstrlen(contactName) > 0) { + if (M.GetByte("cuttitle", 0)) + CutContactName(contactName, newcontactname, _countof(newcontactname)); + else + wcsncpy_s(newcontactname, contactName, _TRUNCATE); + } + else wcsncpy_s(newcontactname, L"_U_", _TRUNCATE); + + HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS); + + // hide the active tab + if (pContainer->hwndActive) + ShowWindow(pContainer->hwndActive, SW_HIDE); + + int iTabIndex_wanted = M.GetDword(hContact, "tabindex", pContainer->iChilds * 100); + int iCount = TabCtrl_GetItemCount(hwndTab); + + pContainer->iTabIndex = iCount; + if (iCount > 0) { + TCITEM item = {}; + for (int i = iCount - 1; i >= 0; i--) { + item.mask = TCIF_PARAM; + TabCtrl_GetItem(hwndTab, i, &item); + HWND hwnd = (HWND)item.lParam; + CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA); + if (dat) { + int relPos = M.GetDword(dat->m_hContact, "tabindex", i * 100); + if (iTabIndex_wanted <= relPos) + pContainer->iTabIndex = i; + } + } + } + + TCITEM item = {}; + item.pszText = newcontactname; + item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; + int iTabId = TabCtrl_InsertItem(hwndTab, pContainer->iTabIndex, &item); + + SendMessage(hwndTab, EM_REFRESHWITHOUTCLIP, 0, 0); + TabCtrl_SetCurSel(hwndTab, iTabId); + pContainer->iChilds++; + + CChatRoomDlg *pDlg = new CChatRoomDlg(si); + pDlg->m_iTabID = iTabId; + pDlg->m_pContainer = pContainer; + pDlg->SetParent(hwndTab); + pDlg->Create(); + + HWND hwndNew = pDlg->GetHwnd(); + item.lParam = (LPARAM)hwndNew; + TabCtrl_SetItem(hwndTab, iTabId, &item); + + if (pContainer->dwFlags & CNT_SIDEBAR) + pContainer->SideBar->addSession(pDlg, pContainer->iTabIndex); + + SendMessage(pContainer->hwnd, WM_SIZE, 0, 0); + // if the container is minimized, then pop it up... + if (IsIconic(pContainer->hwnd)) { + SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); + SetFocus(pContainer->hwndActive); + } + + if (PluginConfig.m_bHideOnClose && !IsWindowVisible(pContainer->hwnd)) { + WINDOWPLACEMENT wp = { 0 }; + wp.length = sizeof(wp); + GetWindowPlacement(pContainer->hwnd, &wp); + + BroadCastContainer(pContainer, DM_CHECKSIZE, 0, 0); // make sure all tabs will re-check layout on activation + if (wp.showCmd == SW_SHOWMAXIMIZED) + ShowWindow(pContainer->hwnd, SW_SHOWMAXIMIZED); + else { + ShowWindow(pContainer->hwnd, SW_SHOWNORMAL); + } + SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0); + SetFocus(hwndNew); + } + else { + SetFocus(hwndNew); + RedrawWindow(pContainer->hwnd, NULL, NULL, RDW_INVALIDATE); + UpdateWindow(pContainer->hwnd); + if (GetForegroundWindow() != pContainer->hwnd) + SetForegroundWindow(pContainer->hwnd); + } + + if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek && CSkin::m_skinEnabled && !M.GetByte("forceAeroPeek", 0)) + CWarning::show(CWarning::WARN_AEROPEEK_SKIN, MB_ICONWARNING | MB_OK); +} diff --git a/plugins/TabSRMM/src/chat/muchighlight.cpp b/plugins/TabSRMM/src/muchighlight.cpp index 1992ca9777..167fb5a9e5 100644 --- a/plugins/TabSRMM/src/chat/muchighlight.cpp +++ b/plugins/TabSRMM/src/muchighlight.cpp @@ -26,7 +26,7 @@ //
// highlighter class for multi user chats
-#include "../stdafx.h"
+#include "stdafx.h"
void CMUCHighlight::cleanup()
{
diff --git a/plugins/TabSRMM/src/chat/muchighlight.h b/plugins/TabSRMM/src/muchighlight.h index 9ca56c95d0..9ca56c95d0 100644 --- a/plugins/TabSRMM/src/chat/muchighlight.h +++ b/plugins/TabSRMM/src/muchighlight.h diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h index 74b9f2b7ea..14d2eb220f 100644 --- a/plugins/TabSRMM/src/stdafx.h +++ b/plugins/TabSRMM/src/stdafx.h @@ -120,7 +120,7 @@ typedef struct _DWM_THUMBNAIL_PROPERTIES #include "typingnotify.h"
#include "nen.h"
#include "functions.h"
-#include "chat/chat.h"
+#include "chat.h"
#include "contactcache.h"
#include "translator.h"
#include "themes.h"
@@ -133,7 +133,7 @@ typedef struct _DWM_THUMBNAIL_PROPERTIES #include "utils.h"
#include "sendlater.h"
#include "ImageDataObject.h"
-#include "chat/muchighlight.h"
+#include "muchighlight.h"
/*
diff --git a/plugins/TabSRMM/tabsrmm.vcxproj b/plugins/TabSRMM/tabsrmm.vcxproj index de20ecf765..76cba54dd6 100644 --- a/plugins/TabSRMM/tabsrmm.vcxproj +++ b/plugins/TabSRMM/tabsrmm.vcxproj @@ -30,12 +30,4 @@ <ExceptionHandling>Sync</ExceptionHandling>
</ClCompile>
</ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\chat\*.cpp">
- <PrecompiledHeaderFile>..\stdafx.h</PrecompiledHeaderFile>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="src\chat\*.h" />
- </ItemGroup>
</Project>
\ No newline at end of file |