Feature: Supports multiple remote displays (video wall)
This commit is contained in:
Binary file not shown.
@@ -936,6 +936,16 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
|||||||
AUTO_TICK(500);
|
AUTO_TICK(500);
|
||||||
CDialogEx::OnInitDialog();
|
CDialogEx::OnInitDialog();
|
||||||
|
|
||||||
|
// Grid 容器
|
||||||
|
int size = THIS_CFG.GetInt("settings", "VideoWallSize");
|
||||||
|
size = max(size, 1);
|
||||||
|
if (size > 1) {
|
||||||
|
m_gridDlg = new CGridDialog();
|
||||||
|
m_gridDlg->Create(IDD_GRID_DIALOG, GetDesktopWindow());
|
||||||
|
m_gridDlg->ShowWindow(SW_HIDE);
|
||||||
|
m_gridDlg->SetGrid(size, size);
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsPwdHashValid()) {
|
if (!IsPwdHashValid()) {
|
||||||
THIS_CFG.SetStr("settings", "superAdmin", "");
|
THIS_CFG.SetStr("settings", "superAdmin", "");
|
||||||
THIS_CFG.SetStr("settings", "Password", "");
|
THIS_CFG.SetStr("settings", "Password", "");
|
||||||
@@ -1366,6 +1376,7 @@ void CMy2015RemoteDlg::Release(){
|
|||||||
Sleep(20);
|
Sleep(20);
|
||||||
|
|
||||||
THIS_APP->Destroy();
|
THIS_APP->Destroy();
|
||||||
|
SAFE_DELETE(m_gridDlg);
|
||||||
g_2015RemoteDlg = NULL;
|
g_2015RemoteDlg = NULL;
|
||||||
SetEvent(m_hExit);
|
SetEvent(m_hExit);
|
||||||
CloseHandle(m_hExit);
|
CloseHandle(m_hExit);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ typedef struct DllInfo {
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include "CGridDialog.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MAP_NOTE,
|
MAP_NOTE,
|
||||||
@@ -159,8 +160,19 @@ public:
|
|||||||
{
|
{
|
||||||
CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)lParam;
|
CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)lParam;
|
||||||
T* Dlg = new T(this, ContextObject->GetServer(), ContextObject);
|
T* Dlg = new T(this, ContextObject->GetServer(), ContextObject);
|
||||||
Dlg->Create(id, GetDesktopWindow());
|
BOOL isGrid = id == IDD_DIALOG_SCREEN_SPY;
|
||||||
|
BOOL ok = (isGrid&&m_gridDlg) ? m_gridDlg->HasSlot() : FALSE;
|
||||||
|
Dlg->Create(id, ok ? m_gridDlg : GetDesktopWindow());
|
||||||
Dlg->ShowWindow(Show);
|
Dlg->ShowWindow(Show);
|
||||||
|
if (ok) {
|
||||||
|
m_gridDlg->AddChild((CDialog*)Dlg);
|
||||||
|
LONG style = ::GetWindowLong(Dlg->GetSafeHwnd(), GWL_STYLE);
|
||||||
|
style &= ~(WS_CAPTION | WS_SIZEBOX); // ȥ<><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD>С
|
||||||
|
::SetWindowLong(Dlg->GetSafeHwnd(), GWL_STYLE, style);
|
||||||
|
::SetWindowPos(Dlg->GetSafeHwnd(), nullptr, 0, 0, 0, 0,
|
||||||
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||||
|
m_gridDlg->ShowWindow(isGrid ? SW_SHOWMAXIMIZED : SW_HIDE);
|
||||||
|
}
|
||||||
|
|
||||||
ContextObject->hWnd = Dlg->GetSafeHwnd();
|
ContextObject->hWnd = Dlg->GetSafeHwnd();
|
||||||
ContextObject->hDlg = Dlg;
|
ContextObject->hDlg = Dlg;
|
||||||
@@ -197,7 +209,7 @@ public:
|
|||||||
|
|
||||||
CStatusBar m_StatusBar; //״̬<D7B4><CCAC>
|
CStatusBar m_StatusBar; //״̬<D7B4><CCAC>
|
||||||
CTrueColorToolBar m_ToolBar;
|
CTrueColorToolBar m_ToolBar;
|
||||||
|
CGridDialog * m_gridDlg = NULL;
|
||||||
std::vector<DllInfo*> m_DllList;
|
std::vector<DllInfo*> m_DllList;
|
||||||
NOTIFYICONDATA m_Nid;
|
NOTIFYICONDATA m_Nid;
|
||||||
HANDLE m_hExit;
|
HANDLE m_hExit;
|
||||||
|
|||||||
@@ -264,6 +264,7 @@
|
|||||||
<ClInclude Include="Buffer.h" />
|
<ClInclude Include="Buffer.h" />
|
||||||
<ClInclude Include="BuildDlg.h" />
|
<ClInclude Include="BuildDlg.h" />
|
||||||
<ClInclude Include="CDrawingBoard.h" />
|
<ClInclude Include="CDrawingBoard.h" />
|
||||||
|
<ClInclude Include="CGridDialog.h" />
|
||||||
<ClInclude Include="Chat.h" />
|
<ClInclude Include="Chat.h" />
|
||||||
<ClInclude Include="CPasswordDlg.h" />
|
<ClInclude Include="CPasswordDlg.h" />
|
||||||
<ClInclude Include="CTextDlg.h" />
|
<ClInclude Include="CTextDlg.h" />
|
||||||
@@ -334,6 +335,7 @@
|
|||||||
<ClCompile Include="Buffer.cpp" />
|
<ClCompile Include="Buffer.cpp" />
|
||||||
<ClCompile Include="BuildDlg.cpp" />
|
<ClCompile Include="BuildDlg.cpp" />
|
||||||
<ClCompile Include="CDrawingBoard.cpp" />
|
<ClCompile Include="CDrawingBoard.cpp" />
|
||||||
|
<ClCompile Include="CGridDialog.cpp" />
|
||||||
<ClCompile Include="Chat.cpp" />
|
<ClCompile Include="Chat.cpp" />
|
||||||
<ClCompile Include="CPasswordDlg.cpp" />
|
<ClCompile Include="CPasswordDlg.cpp" />
|
||||||
<ClCompile Include="CTextDlg.cpp" />
|
<ClCompile Include="CTextDlg.cpp" />
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
<ClCompile Include="CDrawingBoard.cpp" />
|
<ClCompile Include="CDrawingBoard.cpp" />
|
||||||
<ClCompile Include="IOCPKCPServer.cpp" />
|
<ClCompile Include="IOCPKCPServer.cpp" />
|
||||||
<ClCompile Include="..\..\common\ikcp.c" />
|
<ClCompile Include="..\..\common\ikcp.c" />
|
||||||
|
<ClCompile Include="CGridDialog.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\client\Audio.h" />
|
<ClInclude Include="..\..\client\Audio.h" />
|
||||||
@@ -116,6 +117,7 @@
|
|||||||
<ClInclude Include="CDrawingBoard.h" />
|
<ClInclude Include="CDrawingBoard.h" />
|
||||||
<ClInclude Include="IOCPKCPServer.h" />
|
<ClInclude Include="IOCPKCPServer.h" />
|
||||||
<ClInclude Include="..\..\common\ikcp.h" />
|
<ClInclude Include="..\..\common\ikcp.h" />
|
||||||
|
<ClInclude Include="CGridDialog.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="2015Remote.rc" />
|
<ResourceCompile Include="2015Remote.rc" />
|
||||||
|
|||||||
229
server/2015Remote/CGridDialog.cpp
Normal file
229
server/2015Remote/CGridDialog.cpp
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
#include "afxdialogex.h"
|
||||||
|
#include "CGridDialog.h"
|
||||||
|
#include "Resource.h"
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CGridDialog, CDialog)
|
||||||
|
ON_WM_SIZE()
|
||||||
|
ON_WM_LBUTTONDBLCLK()
|
||||||
|
ON_MESSAGE(WM_CHILD_CLOSED, &CGridDialog::OnChildClosed)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
CGridDialog::CGridDialog() : CDialog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CGridDialog::OnInitDialog()
|
||||||
|
{
|
||||||
|
m_hIcon = ::LoadIconA(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
|
||||||
|
SetIcon(m_hIcon, FALSE);
|
||||||
|
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGridDialog::SetGrid(int rows, int cols)
|
||||||
|
{
|
||||||
|
m_rows = rows;
|
||||||
|
m_cols = cols;
|
||||||
|
m_max = rows * cols;
|
||||||
|
LayoutChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CGridDialog::AddChild(CDialog* pDlg)
|
||||||
|
{
|
||||||
|
if (!pDlg || !::IsWindow(pDlg->GetSafeHwnd()) || m_children.size() >= m_max)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
pDlg->SetParent(this);
|
||||||
|
pDlg->ShowWindow(SW_SHOW);
|
||||||
|
|
||||||
|
// ȥ<><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD>С
|
||||||
|
LONG style = ::GetWindowLong(pDlg->GetSafeHwnd(), GWL_STYLE);
|
||||||
|
style &= ~(WS_CAPTION | WS_THICKFRAME | WS_SIZEBOX | WS_BORDER);
|
||||||
|
::SetWindowLong(pDlg->GetSafeHwnd(), GWL_STYLE, style);
|
||||||
|
::SetWindowPos(pDlg->GetSafeHwnd(), nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
|
|
||||||
|
m_children.push_back(pDlg);
|
||||||
|
LayoutChildren();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGridDialog::RemoveChild(CDialog* pDlg)
|
||||||
|
{
|
||||||
|
auto it = std::find(m_children.begin(), m_children.end(), pDlg);
|
||||||
|
if (it != m_children.end())
|
||||||
|
{
|
||||||
|
(*it)->ShowWindow(SW_HIDE);
|
||||||
|
(*it)->SetParent(nullptr);
|
||||||
|
m_children.erase(it);
|
||||||
|
|
||||||
|
// ɾ<><C9BE> m_origState <20>ж<EFBFBD>Ӧ<EFBFBD><D3A6>Ŀ
|
||||||
|
auto itState = m_origState.find(pDlg);
|
||||||
|
if (itState != m_origState.end())
|
||||||
|
m_origState.erase(itState);
|
||||||
|
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD>رյ<D8B1><D5B5>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD>ǵ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><F3BBAFB4>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD> m_pMaxChild
|
||||||
|
if (m_pMaxChild == pDlg)
|
||||||
|
m_pMaxChild = nullptr;
|
||||||
|
|
||||||
|
LayoutChildren();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CGridDialog::OnChildClosed(WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
CDialog* pDlg = (CDialog*)wParam;
|
||||||
|
RemoveChild(pDlg);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGridDialog::LayoutChildren()
|
||||||
|
{
|
||||||
|
if (m_children.size() == 0) {
|
||||||
|
// <20>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
if (m_parentStyle != 0)
|
||||||
|
{
|
||||||
|
::SetWindowLong(m_hWnd, GWL_STYLE, m_parentStyle);
|
||||||
|
::SetWindowPos(m_hWnd, nullptr, 0, 0, 0, 0,
|
||||||
|
SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
|
m_parentStyle = 0;
|
||||||
|
}
|
||||||
|
ShowWindow(SW_HIDE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_rows <= 0 || m_cols <= 0 || m_children.empty() || m_pMaxChild != nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CRect rcClient;
|
||||||
|
GetClientRect(&rcClient);
|
||||||
|
|
||||||
|
int w = rcClient.Width() / m_cols;
|
||||||
|
int h = rcClient.Height() / m_rows;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < m_children.size(); ++i)
|
||||||
|
{
|
||||||
|
int r = (int)i / m_cols;
|
||||||
|
int c = (int)i % m_cols;
|
||||||
|
|
||||||
|
if (r >= m_rows)
|
||||||
|
break; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ
|
||||||
|
|
||||||
|
int x = c * w;
|
||||||
|
int y = r * h;
|
||||||
|
|
||||||
|
m_children[i]->MoveWindow(x, y, w, h, TRUE);
|
||||||
|
m_children[i]->ShowWindow(SW_SHOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGridDialog::OnSize(UINT nType, int cx, int cy)
|
||||||
|
{
|
||||||
|
CDialog::OnSize(nType, cx, cy);
|
||||||
|
|
||||||
|
if (m_pMaxChild == nullptr) {
|
||||||
|
LayoutChildren();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD>
|
||||||
|
CRect rcClient;
|
||||||
|
GetClientRect(&rcClient);
|
||||||
|
m_pMaxChild->MoveWindow(rcClient, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGridDialog::OnLButtonDblClk(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3BBAFB5>Ӵ<EFBFBD><D3B4>ڣ<EFBFBD>˫<EFBFBD><CBAB><EFBFBD>κεط<CEB5><D8B7><EFBFBD><EFBFBD>ָ<EFBFBD>
|
||||||
|
if (m_pMaxChild != nullptr)
|
||||||
|
{
|
||||||
|
// <20>ָ<EFBFBD><D6B8>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>λ<EFBFBD><CEBB>
|
||||||
|
for (auto& kv : m_origState)
|
||||||
|
{
|
||||||
|
CDialog* dlg = kv.first;
|
||||||
|
const ChildState& state = kv.second;
|
||||||
|
|
||||||
|
::SetWindowLong(dlg->GetSafeHwnd(), GWL_STYLE, state.style);
|
||||||
|
::SetWindowPos(dlg->GetSafeHwnd(), nullptr, 0, 0, 0, 0,
|
||||||
|
SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
|
|
||||||
|
dlg->MoveWindow(state.rect, TRUE);
|
||||||
|
dlg->ShowWindow(SW_SHOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
// <20>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
if (m_parentStyle != 0)
|
||||||
|
{
|
||||||
|
::SetWindowLong(m_hWnd, GWL_STYLE, m_parentStyle);
|
||||||
|
::SetWindowPos(m_hWnd, nullptr, 0, 0, 0, 0,
|
||||||
|
SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
|
m_parentStyle = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ˢ<>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
m_pMaxChild = nullptr;
|
||||||
|
m_origState.clear();
|
||||||
|
LayoutChildren();
|
||||||
|
return; // <20>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
}
|
||||||
|
|
||||||
|
// û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><DFBC>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
for (auto dlg : m_children)
|
||||||
|
{
|
||||||
|
CRect rc;
|
||||||
|
dlg->GetWindowRect(&rc);
|
||||||
|
ScreenToClient(&rc);
|
||||||
|
|
||||||
|
if (rc.PtInRect(point))
|
||||||
|
{
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD>ԭʼ״̬
|
||||||
|
m_origState.clear();
|
||||||
|
for (auto d : m_children)
|
||||||
|
{
|
||||||
|
ChildState state;
|
||||||
|
d->GetWindowRect(&state.rect);
|
||||||
|
ScreenToClient(&state.rect);
|
||||||
|
state.style = ::GetWindowLong(d->GetSafeHwnd(), GWL_STYLE);
|
||||||
|
m_origState[d] = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
// <20><><EFBFBD><EFBFBD><F3BBAFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD>
|
||||||
|
LONG style = m_origState[dlg].style;
|
||||||
|
style |= (WS_CAPTION | WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
|
||||||
|
::SetWindowLong(dlg->GetSafeHwnd(), GWL_STYLE, style);
|
||||||
|
::SetWindowPos(dlg->GetSafeHwnd(), nullptr, 0, 0, 0, 0,
|
||||||
|
SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
|
|
||||||
|
// <20><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
if (m_parentStyle == 0)
|
||||||
|
m_parentStyle = ::GetWindowLong(m_hWnd, GWL_STYLE);
|
||||||
|
LONG parentStyle = m_parentStyle & ~(WS_CAPTION | WS_THICKFRAME);
|
||||||
|
::SetWindowLong(m_hWnd, GWL_STYLE, parentStyle);
|
||||||
|
::SetWindowPos(m_hWnd, nullptr, 0, 0, 0, 0,
|
||||||
|
SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
|
|
||||||
|
// ȫ<><C8AB><EFBFBD><EFBFBD>ʾ<EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD>
|
||||||
|
CRect rcClient;
|
||||||
|
GetClientRect(&rcClient);
|
||||||
|
dlg->MoveWindow(rcClient, TRUE);
|
||||||
|
m_pMaxChild = dlg;
|
||||||
|
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD>
|
||||||
|
for (auto d : m_children)
|
||||||
|
if (d != dlg) d->ShowWindow(SW_HIDE);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CDialog::OnLButtonDblClk(nFlags, point);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CGridDialog::PreTranslateMessage(MSG* pMsg)
|
||||||
|
{
|
||||||
|
if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE) {
|
||||||
|
return TRUE;// <20><><EFBFBD><EFBFBD>Enter<65><72>ESC<53>رնԻ<D5B6>
|
||||||
|
}
|
||||||
|
return CDialog::PreTranslateMessage(pMsg);
|
||||||
|
}
|
||||||
46
server/2015Remote/CGridDialog.h
Normal file
46
server/2015Remote/CGridDialog.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include <afxwin.h>
|
||||||
|
|
||||||
|
#define WM_CHILD_CLOSED (WM_USER + 100)
|
||||||
|
|
||||||
|
class CGridDialog : public CDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CGridDialog();
|
||||||
|
|
||||||
|
BOOL AddChild(CDialog* pDlg); // <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD>ӶԻ<D3B6><D4BB><EFBFBD>
|
||||||
|
void RemoveChild(CDialog* pDlg); // <20><>̬<EFBFBD>Ƴ<EFBFBD><C6B3>ӶԻ<D3B6><D4BB><EFBFBD>
|
||||||
|
void SetGrid(int rows, int cols); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
void LayoutChildren(); // <20><><EFBFBD><EFBFBD>
|
||||||
|
BOOL HasSlot() const {
|
||||||
|
return m_children.size() < m_max;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||||
|
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
||||||
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
|
afx_msg LRESULT OnChildClosed(WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
private:
|
||||||
|
HICON m_hIcon;
|
||||||
|
int m_rows = 0;
|
||||||
|
int m_cols = 0;
|
||||||
|
int m_max = 0;
|
||||||
|
std::vector<CDialog*> m_children;
|
||||||
|
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
CDialog* m_pMaxChild = nullptr; // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><F3BBAFB5>ӶԻ<D3B6><D4BB><EFBFBD>
|
||||||
|
LONG m_parentStyle = 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭʼ<D4AD><CABC>ʽ
|
||||||
|
|
||||||
|
struct ChildState {
|
||||||
|
CRect rect; // ԭʼλ<CABC><CEBB>
|
||||||
|
LONG style; // ԭʼ<D4AD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||||
|
};
|
||||||
|
std::map<CDialog*, ChildState> m_origState;
|
||||||
|
};
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "afxdialogex.h"
|
#include "afxdialogex.h"
|
||||||
#include <imm.h>
|
#include <imm.h>
|
||||||
#include <WinUser.h>
|
#include <WinUser.h>
|
||||||
|
#include "CGridDialog.h"
|
||||||
|
|
||||||
|
|
||||||
// CScreenSpyDlg 对话框
|
// CScreenSpyDlg 对话框
|
||||||
@@ -126,11 +127,26 @@ BEGIN_MESSAGE_MAP(CScreenSpyDlg, CDialog)
|
|||||||
ON_WM_MOUSELEAVE()
|
ON_WM_MOUSELEAVE()
|
||||||
ON_WM_KILLFOCUS()
|
ON_WM_KILLFOCUS()
|
||||||
ON_WM_SIZE()
|
ON_WM_SIZE()
|
||||||
|
ON_WM_LBUTTONDBLCLK()
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
// CScreenSpyDlg 消息处理程序
|
// CScreenSpyDlg 消息处理程序
|
||||||
|
|
||||||
|
void CScreenSpyDlg::OnLButtonDblClk(UINT nFlags, CPoint point)
|
||||||
|
{
|
||||||
|
if (!m_bIsCtrl) {
|
||||||
|
CWnd* parent = GetParent();
|
||||||
|
if (parent) {
|
||||||
|
// 通知父对话框,传递点击点
|
||||||
|
CPoint ptScreen = point;
|
||||||
|
ClientToScreen(&ptScreen);
|
||||||
|
GetParent()->ScreenToClient(&ptScreen);
|
||||||
|
GetParent()->SendMessage(WM_LBUTTONDBLCLK, nFlags, MAKELPARAM(ptScreen.x, ptScreen.y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CDialog::OnLButtonDblClk(nFlags, point);
|
||||||
|
}
|
||||||
|
|
||||||
BOOL CScreenSpyDlg::OnInitDialog()
|
BOOL CScreenSpyDlg::OnInitDialog()
|
||||||
{
|
{
|
||||||
@@ -195,13 +211,19 @@ BOOL CScreenSpyDlg::OnInitDialog()
|
|||||||
VOID CScreenSpyDlg::OnClose()
|
VOID CScreenSpyDlg::OnClose()
|
||||||
{
|
{
|
||||||
CancelIO();
|
CancelIO();
|
||||||
|
// 恢复鼠标状态
|
||||||
|
SetClassLongPtr(m_hWnd, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_ARROW));
|
||||||
|
// 通知父窗口
|
||||||
|
CWnd* parent = GetParent();
|
||||||
|
if (parent)
|
||||||
|
parent->SendMessage(WM_CHILD_CLOSED, (WPARAM)this, 0);
|
||||||
|
|
||||||
// 等待数据处理完毕
|
// 等待数据处理完毕
|
||||||
if (IsProcessing()) {
|
if (IsProcessing()) {
|
||||||
ShowWindow(SW_HIDE);
|
ShowWindow(SW_HIDE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 恢复鼠标状态
|
|
||||||
SetClassLongPtr(m_hWnd, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_ARROW));
|
|
||||||
DialogBase::OnClose();
|
DialogBase::OnClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,4 +120,5 @@ public:
|
|||||||
afx_msg void OnPaint();
|
afx_msg void OnPaint();
|
||||||
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
||||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||||
|
void OnLButtonDblClk(UINT nFlags, CPoint point);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ void CSettingDlg::DoDataExchange(CDataExchange* pDX)
|
|||||||
DDX_Control(pDX, IDC_EDIT_FRP_TOKEN, m_EditFrpToken);
|
DDX_Control(pDX, IDC_EDIT_FRP_TOKEN, m_EditFrpToken);
|
||||||
DDX_Text(pDX, IDC_EDIT_FRP_TOKEN, m_sFrpToken);
|
DDX_Text(pDX, IDC_EDIT_FRP_TOKEN, m_sFrpToken);
|
||||||
DDV_MaxChars(pDX, m_sFrpToken, 24);
|
DDV_MaxChars(pDX, m_sFrpToken, 24);
|
||||||
|
DDX_Control(pDX, IDC_COMBO_VIDEO_WALL, m_ComboVideoWall);
|
||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_MESSAGE_MAP(CSettingDlg, CDialog)
|
BEGIN_MESSAGE_MAP(CSettingDlg, CDialog)
|
||||||
@@ -143,6 +144,15 @@ BOOL CSettingDlg::OnInitDialog()
|
|||||||
m_nFrpPort = THIS_CFG.GetInt("frp", "server_port", 7000);
|
m_nFrpPort = THIS_CFG.GetInt("frp", "server_port", 7000);
|
||||||
m_sFrpToken = THIS_CFG.GetStr("frp", "token").c_str();
|
m_sFrpToken = THIS_CFG.GetStr("frp", "token").c_str();
|
||||||
|
|
||||||
|
int size = THIS_CFG.GetInt("settings", "VideoWallSize");
|
||||||
|
m_ComboVideoWall.InsertString(0, "<EFBFBD><EFBFBD>");
|
||||||
|
m_ComboVideoWall.InsertString(1, "2 x 2");
|
||||||
|
m_ComboVideoWall.InsertString(2, "3 x 3");
|
||||||
|
m_ComboVideoWall.InsertString(3, "4 x 4");
|
||||||
|
m_ComboVideoWall.InsertString(4, "5 x 5");
|
||||||
|
if (size < 1 || size > 5) size = 1;
|
||||||
|
m_ComboVideoWall.SetCurSel(size-1);
|
||||||
|
|
||||||
UpdateData(FALSE);
|
UpdateData(FALSE);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -174,6 +184,8 @@ void CSettingDlg::OnBnClickedButtonSettingapply()
|
|||||||
THIS_CFG.SetInt("frp", "server_port", m_nFrpPort);
|
THIS_CFG.SetInt("frp", "server_port", m_nFrpPort);
|
||||||
THIS_CFG.SetStr("frp", "token", m_sFrpToken.GetString());
|
THIS_CFG.SetStr("frp", "token", m_sFrpToken.GetString());
|
||||||
|
|
||||||
|
THIS_CFG.SetInt("settings", "VideoWallSize", m_ComboVideoWall.GetCurSel()+1);
|
||||||
|
|
||||||
m_ApplyButton.EnableWindow(FALSE);
|
m_ApplyButton.EnableWindow(FALSE);
|
||||||
m_ApplyButton.ShowWindow(SW_HIDE);
|
m_ApplyButton.ShowWindow(SW_HIDE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,4 +48,5 @@ public:
|
|||||||
int m_nFrpPort;
|
int m_nFrpPort;
|
||||||
CEdit m_EditFrpToken;
|
CEdit m_EditFrpToken;
|
||||||
CString m_sFrpToken;
|
CString m_sFrpToken;
|
||||||
|
CComboBox m_ComboVideoWall;
|
||||||
};
|
};
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user