Feature: Add get/set clipboard buttons to remote desktop toolbar
Add two toolbar buttons — get clipboard (letter C) and set clipboard (letter P) —
after the screenshot button and before the minimize button, so clipboard sync stays
reachable in fullscreen mode where the system menu cannot be opened.
The buttons reuse the existing IDM_GET_CLIPBOARD / IDM_SET_CLIPBOARD system-menu
handlers by posting WM_SYSCOMMAND to the parent. The toolbar button count grows
from 16 to 18, and the slide/animation dimensions are widened from 640 to 720.
Letter C/P icons and Simplified-Chinese source strings ("获取剪贴板", "设置剪贴板")
are added, along with English and Traditional-Chinese translations.
Co-Authored-By: deepseek-v4-pro
This commit is contained in:
@@ -39,6 +39,8 @@ BEGIN_MESSAGE_MAP(CToolbarDlg, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BTN_Y, &CToolbarDlg::OnBnClickedY)
|
||||
ON_BN_CLICKED(IDC_BTN_Z, &CToolbarDlg::OnBnClickedZ)
|
||||
ON_BN_CLICKED(IDC_BTN_SCREENSHOT, &CToolbarDlg::OnBnClickedScreenshot)
|
||||
ON_BN_CLICKED(IDC_BTN_GET_CLIPBOARD, &CToolbarDlg::OnBnClickedGetClipboard)
|
||||
ON_BN_CLICKED(IDC_BTN_SET_CLIPBOARD, &CToolbarDlg::OnBnClickedSetClipboard)
|
||||
ON_WM_ERASEBKGND()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
@@ -88,7 +90,7 @@ void CToolbarDlg::CheckMousePosition()
|
||||
int monWidth = monRight - monLeft;
|
||||
int monHeight = monBottom - monTop;
|
||||
|
||||
int btnSize = 32, btnSpacing = 8, btnCount = 16;
|
||||
int btnSize = 32, btnSpacing = 8, btnCount = 18;
|
||||
|
||||
if (m_nPosition <= 1) {
|
||||
// 水平模式 (上/下)
|
||||
@@ -153,9 +155,9 @@ void CToolbarDlg::SlideIn()
|
||||
int monWidth = monRight - monLeft;
|
||||
int monHeight = monBottom - monTop;
|
||||
|
||||
int hw = 640; // 水平工具栏宽度 (与垂直高度一致)
|
||||
int hw = 720; // 水平工具栏宽度 (与垂直高度一致)
|
||||
int vw = 40;
|
||||
int vh = 640;
|
||||
int vh = 720;
|
||||
|
||||
// 从边缘展开(改变窗口大小),避免多显示器时跑到相邻屏幕
|
||||
switch (m_nPosition) {
|
||||
@@ -212,9 +214,9 @@ void CToolbarDlg::SlideOut()
|
||||
int monWidth = monRight - monLeft;
|
||||
int monHeight = monBottom - monTop;
|
||||
|
||||
int hw = 640;
|
||||
int hw = 720;
|
||||
int vw = 40;
|
||||
int vh = 640;
|
||||
int vh = 720;
|
||||
|
||||
CWnd* btns[] = {
|
||||
&m_btnExit, &m_btnControl,
|
||||
@@ -224,9 +226,10 @@ void CToolbarDlg::SlideOut()
|
||||
&m_btnQuality, &m_btnRestoreConsole,
|
||||
&m_btnX, &m_btnY, &m_btnZ,
|
||||
&m_btnScreenshot,
|
||||
&m_btnGetClipboard, &m_btnSetClipboard,
|
||||
&m_btnMinimize, &m_btnClose,
|
||||
};
|
||||
const int N = 16;
|
||||
const int N = 18;
|
||||
CRect btnRects[N];
|
||||
for (int i = 0; i < N; i++) {
|
||||
btns[i]->GetWindowRect(&btnRects[i]);
|
||||
@@ -331,6 +334,8 @@ BOOL CToolbarDlg::OnInitDialog()
|
||||
m_btnY.SubclassDlgItem(IDC_BTN_Y, this);
|
||||
m_btnZ.SubclassDlgItem(IDC_BTN_Z, this);
|
||||
m_btnScreenshot.SubclassDlgItem(IDC_BTN_SCREENSHOT, this);
|
||||
m_btnGetClipboard.SubclassDlgItem(IDC_BTN_GET_CLIPBOARD, this);
|
||||
m_btnSetClipboard.SubclassDlgItem(IDC_BTN_SET_CLIPBOARD, this);
|
||||
m_btnMinimize.SubclassDlgItem(IDC_BTN_MINIMIZE, this);
|
||||
m_btnClose.SubclassDlgItem(IDC_BTN_CLOSE, this);
|
||||
|
||||
@@ -343,6 +348,8 @@ BOOL CToolbarDlg::OnInitDialog()
|
||||
// Y按钮图标在 UpdateButtonIcons 中根据音频状态动态设置
|
||||
m_btnZ.SetIconDrawFunc(CIconButton::DrawIconLetterZ); // 预留按钮 Z
|
||||
m_btnScreenshot.SetIconDrawFunc(CIconButton::DrawIconScreenshot);
|
||||
m_btnGetClipboard.SetIconDrawFunc(CIconButton::DrawIconLetterC);
|
||||
m_btnSetClipboard.SetIconDrawFunc(CIconButton::DrawIconLetterP);
|
||||
m_btnMinimize.SetIconDrawFunc(CIconButton::DrawIconMinimize);
|
||||
m_btnClose.SetIconDrawFunc(CIconButton::DrawIconClose);
|
||||
m_btnClose.SetIsCloseButton(true);
|
||||
@@ -367,6 +374,8 @@ BOOL CToolbarDlg::OnInitDialog()
|
||||
m_tooltip.AddTool(&m_btnY, pParent->m_Settings.AudioEnabled ? _TR("关闭系统音频") : _TR("打开系统音频"));
|
||||
m_tooltip.AddTool(&m_btnZ, _TR("选择ROI"));
|
||||
m_tooltip.AddTool(&m_btnScreenshot, _TR("截图"));
|
||||
m_tooltip.AddTool(&m_btnGetClipboard, _TR("获取剪贴板"));
|
||||
m_tooltip.AddTool(&m_btnSetClipboard, _TR("设置剪贴板"));
|
||||
m_tooltip.AddTool(&m_btnMinimize, _TR("最小化"));
|
||||
m_tooltip.AddTool(&m_btnClose, _TR("关闭"));
|
||||
|
||||
@@ -383,9 +392,9 @@ BOOL CToolbarDlg::OnInitDialog()
|
||||
int monWidth = rcMonitor.right - rcMonitor.left;
|
||||
int monHeight = rcMonitor.bottom - rcMonitor.top;
|
||||
|
||||
int hw = 640;
|
||||
int hw = 720;
|
||||
int vw = 40;
|
||||
int vh = 640;
|
||||
int vh = 720;
|
||||
int hx = rcMonitor.left + (monWidth - hw) / 2;
|
||||
|
||||
switch (m_nPosition) {
|
||||
@@ -514,7 +523,7 @@ void CToolbarDlg::LayoutButtons()
|
||||
{
|
||||
int btnSize = 32;
|
||||
int btnSpacing = 8;
|
||||
int btnCount = 16;
|
||||
int btnCount = 18;
|
||||
|
||||
CWnd* btns[] = {
|
||||
&m_btnExit,
|
||||
@@ -531,6 +540,8 @@ void CToolbarDlg::LayoutButtons()
|
||||
&m_btnY, // 预留按钮 Y
|
||||
&m_btnZ, // 预留按钮 Z
|
||||
&m_btnScreenshot,
|
||||
&m_btnGetClipboard,
|
||||
&m_btnSetClipboard,
|
||||
&m_btnMinimize,
|
||||
&m_btnClose,
|
||||
};
|
||||
@@ -588,9 +599,9 @@ void CToolbarDlg::UpdatePosition()
|
||||
int monWidth = rcMonitor.right - rcMonitor.left;
|
||||
int monHeight = rcMonitor.bottom - rcMonitor.top;
|
||||
|
||||
int hw = 640;
|
||||
int hw = 720;
|
||||
int vw = 40;
|
||||
int vh = 640;
|
||||
int vh = 720;
|
||||
int hx = rcMonitor.left + (monWidth - hw) / 2;
|
||||
|
||||
switch (m_nPosition) {
|
||||
@@ -785,6 +796,18 @@ void CToolbarDlg::OnBnClickedScreenshot()
|
||||
}
|
||||
}
|
||||
|
||||
void CToolbarDlg::OnBnClickedGetClipboard()
|
||||
{
|
||||
// 与系统菜单 IDM_GET_CLIPBOARD 相同的处理逻辑
|
||||
GetParent()->PostMessage(WM_SYSCOMMAND, IDM_GET_CLIPBOARD, 0);
|
||||
}
|
||||
|
||||
void CToolbarDlg::OnBnClickedSetClipboard()
|
||||
{
|
||||
// 与系统菜单 IDM_SET_CLIPBOARD 相同的处理逻辑
|
||||
GetParent()->PostMessage(WM_SYSCOMMAND, IDM_SET_CLIPBOARD, 0);
|
||||
}
|
||||
|
||||
BOOL CToolbarDlg::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
if (m_tooltip.GetSafeHwnd()) {
|
||||
|
||||
Reference in New Issue
Block a user