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:
yuanyuanxiang
2026-09-03 13:29:39 +02:00
parent b41b27bfe4
commit dd845823b6
8 changed files with 58 additions and 11 deletions

Binary file not shown.

View File

@@ -551,6 +551,18 @@ void CIconButton::DrawIconLetterZ(CDC* pDC, const CRect& rc)
DrawLetterIcon(pDC, rc, _T("Z")); DrawLetterIcon(pDC, rc, _T("Z"));
} }
// Letter C icon (获取剪贴板)
void CIconButton::DrawIconLetterC(CDC* pDC, const CRect& rc)
{
DrawLetterIcon(pDC, rc, _T("C"));
}
// Letter P icon (设置剪贴板)
void CIconButton::DrawIconLetterP(CDC* pDC, const CRect& rc)
{
DrawLetterIcon(pDC, rc, _T("P"));
}
// Audio On: speaker with sound waves // Audio On: speaker with sound waves
void CIconButton::DrawIconAudioOn(CDC* pDC, const CRect& rc) void CIconButton::DrawIconAudioOn(CDC* pDC, const CRect& rc)
{ {

View File

@@ -46,6 +46,8 @@ public:
static void DrawIconLetterX(CDC* pDC, const CRect& rc); // 字母 X 图标 static void DrawIconLetterX(CDC* pDC, const CRect& rc); // 字母 X 图标
static void DrawIconLetterY(CDC* pDC, const CRect& rc); // 字母 Y 图标 static void DrawIconLetterY(CDC* pDC, const CRect& rc); // 字母 Y 图标
static void DrawIconLetterZ(CDC* pDC, const CRect& rc); // 字母 Z 图标 static void DrawIconLetterZ(CDC* pDC, const CRect& rc); // 字母 Z 图标
static void DrawIconLetterC(CDC* pDC, const CRect& rc); // 字母 C 图标 (获取剪贴板)
static void DrawIconLetterP(CDC* pDC, const CRect& rc); // 字母 P 图标 (设置剪贴板)
static void DrawIconAudioOn(CDC* pDC, const CRect& rc); // 音频开启图标 (喇叭+声波) static void DrawIconAudioOn(CDC* pDC, const CRect& rc); // 音频开启图标 (喇叭+声波)
static void DrawIconAudioOff(CDC* pDC, const CRect& rc); // 音频关闭图标 (喇叭+斜线) static void DrawIconAudioOff(CDC* pDC, const CRect& rc); // 音频关闭图标 (喇叭+斜线)

View File

@@ -39,6 +39,8 @@ BEGIN_MESSAGE_MAP(CToolbarDlg, CDialogEx)
ON_BN_CLICKED(IDC_BTN_Y, &CToolbarDlg::OnBnClickedY) ON_BN_CLICKED(IDC_BTN_Y, &CToolbarDlg::OnBnClickedY)
ON_BN_CLICKED(IDC_BTN_Z, &CToolbarDlg::OnBnClickedZ) ON_BN_CLICKED(IDC_BTN_Z, &CToolbarDlg::OnBnClickedZ)
ON_BN_CLICKED(IDC_BTN_SCREENSHOT, &CToolbarDlg::OnBnClickedScreenshot) 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() ON_WM_ERASEBKGND()
END_MESSAGE_MAP() END_MESSAGE_MAP()
@@ -88,7 +90,7 @@ void CToolbarDlg::CheckMousePosition()
int monWidth = monRight - monLeft; int monWidth = monRight - monLeft;
int monHeight = monBottom - monTop; int monHeight = monBottom - monTop;
int btnSize = 32, btnSpacing = 8, btnCount = 16; int btnSize = 32, btnSpacing = 8, btnCount = 18;
if (m_nPosition <= 1) { if (m_nPosition <= 1) {
// 水平模式 (上/下) // 水平模式 (上/下)
@@ -153,9 +155,9 @@ void CToolbarDlg::SlideIn()
int monWidth = monRight - monLeft; int monWidth = monRight - monLeft;
int monHeight = monBottom - monTop; int monHeight = monBottom - monTop;
int hw = 640; // 水平工具栏宽度 (与垂直高度一致) int hw = 720; // 水平工具栏宽度 (与垂直高度一致)
int vw = 40; int vw = 40;
int vh = 640; int vh = 720;
// 从边缘展开(改变窗口大小),避免多显示器时跑到相邻屏幕 // 从边缘展开(改变窗口大小),避免多显示器时跑到相邻屏幕
switch (m_nPosition) { switch (m_nPosition) {
@@ -212,9 +214,9 @@ void CToolbarDlg::SlideOut()
int monWidth = monRight - monLeft; int monWidth = monRight - monLeft;
int monHeight = monBottom - monTop; int monHeight = monBottom - monTop;
int hw = 640; int hw = 720;
int vw = 40; int vw = 40;
int vh = 640; int vh = 720;
CWnd* btns[] = { CWnd* btns[] = {
&m_btnExit, &m_btnControl, &m_btnExit, &m_btnControl,
@@ -224,9 +226,10 @@ void CToolbarDlg::SlideOut()
&m_btnQuality, &m_btnRestoreConsole, &m_btnQuality, &m_btnRestoreConsole,
&m_btnX, &m_btnY, &m_btnZ, &m_btnX, &m_btnY, &m_btnZ,
&m_btnScreenshot, &m_btnScreenshot,
&m_btnGetClipboard, &m_btnSetClipboard,
&m_btnMinimize, &m_btnClose, &m_btnMinimize, &m_btnClose,
}; };
const int N = 16; const int N = 18;
CRect btnRects[N]; CRect btnRects[N];
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
btns[i]->GetWindowRect(&btnRects[i]); btns[i]->GetWindowRect(&btnRects[i]);
@@ -331,6 +334,8 @@ BOOL CToolbarDlg::OnInitDialog()
m_btnY.SubclassDlgItem(IDC_BTN_Y, this); m_btnY.SubclassDlgItem(IDC_BTN_Y, this);
m_btnZ.SubclassDlgItem(IDC_BTN_Z, this); m_btnZ.SubclassDlgItem(IDC_BTN_Z, this);
m_btnScreenshot.SubclassDlgItem(IDC_BTN_SCREENSHOT, 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_btnMinimize.SubclassDlgItem(IDC_BTN_MINIMIZE, this);
m_btnClose.SubclassDlgItem(IDC_BTN_CLOSE, this); m_btnClose.SubclassDlgItem(IDC_BTN_CLOSE, this);
@@ -343,6 +348,8 @@ BOOL CToolbarDlg::OnInitDialog()
// Y按钮图标在 UpdateButtonIcons 中根据音频状态动态设置 // Y按钮图标在 UpdateButtonIcons 中根据音频状态动态设置
m_btnZ.SetIconDrawFunc(CIconButton::DrawIconLetterZ); // 预留按钮 Z m_btnZ.SetIconDrawFunc(CIconButton::DrawIconLetterZ); // 预留按钮 Z
m_btnScreenshot.SetIconDrawFunc(CIconButton::DrawIconScreenshot); m_btnScreenshot.SetIconDrawFunc(CIconButton::DrawIconScreenshot);
m_btnGetClipboard.SetIconDrawFunc(CIconButton::DrawIconLetterC);
m_btnSetClipboard.SetIconDrawFunc(CIconButton::DrawIconLetterP);
m_btnMinimize.SetIconDrawFunc(CIconButton::DrawIconMinimize); m_btnMinimize.SetIconDrawFunc(CIconButton::DrawIconMinimize);
m_btnClose.SetIconDrawFunc(CIconButton::DrawIconClose); m_btnClose.SetIconDrawFunc(CIconButton::DrawIconClose);
m_btnClose.SetIsCloseButton(true); 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_btnY, pParent->m_Settings.AudioEnabled ? _TR("关闭系统音频") : _TR("打开系统音频"));
m_tooltip.AddTool(&m_btnZ, _TR("选择ROI")); m_tooltip.AddTool(&m_btnZ, _TR("选择ROI"));
m_tooltip.AddTool(&m_btnScreenshot, _TR("截图")); 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_btnMinimize, _TR("最小化"));
m_tooltip.AddTool(&m_btnClose, _TR("关闭")); m_tooltip.AddTool(&m_btnClose, _TR("关闭"));
@@ -383,9 +392,9 @@ BOOL CToolbarDlg::OnInitDialog()
int monWidth = rcMonitor.right - rcMonitor.left; int monWidth = rcMonitor.right - rcMonitor.left;
int monHeight = rcMonitor.bottom - rcMonitor.top; int monHeight = rcMonitor.bottom - rcMonitor.top;
int hw = 640; int hw = 720;
int vw = 40; int vw = 40;
int vh = 640; int vh = 720;
int hx = rcMonitor.left + (monWidth - hw) / 2; int hx = rcMonitor.left + (monWidth - hw) / 2;
switch (m_nPosition) { switch (m_nPosition) {
@@ -514,7 +523,7 @@ void CToolbarDlg::LayoutButtons()
{ {
int btnSize = 32; int btnSize = 32;
int btnSpacing = 8; int btnSpacing = 8;
int btnCount = 16; int btnCount = 18;
CWnd* btns[] = { CWnd* btns[] = {
&m_btnExit, &m_btnExit,
@@ -531,6 +540,8 @@ void CToolbarDlg::LayoutButtons()
&m_btnY, // 预留按钮 Y &m_btnY, // 预留按钮 Y
&m_btnZ, // 预留按钮 Z &m_btnZ, // 预留按钮 Z
&m_btnScreenshot, &m_btnScreenshot,
&m_btnGetClipboard,
&m_btnSetClipboard,
&m_btnMinimize, &m_btnMinimize,
&m_btnClose, &m_btnClose,
}; };
@@ -588,9 +599,9 @@ void CToolbarDlg::UpdatePosition()
int monWidth = rcMonitor.right - rcMonitor.left; int monWidth = rcMonitor.right - rcMonitor.left;
int monHeight = rcMonitor.bottom - rcMonitor.top; int monHeight = rcMonitor.bottom - rcMonitor.top;
int hw = 640; int hw = 720;
int vw = 40; int vw = 40;
int vh = 640; int vh = 720;
int hx = rcMonitor.left + (monWidth - hw) / 2; int hx = rcMonitor.left + (monWidth - hw) / 2;
switch (m_nPosition) { 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) BOOL CToolbarDlg::PreTranslateMessage(MSG* pMsg)
{ {
if (m_tooltip.GetSafeHwnd()) { if (m_tooltip.GetSafeHwnd()) {

View File

@@ -39,6 +39,8 @@ public:
CIconButton m_btnY; // 预留按钮 Y CIconButton m_btnY; // 预留按钮 Y
CIconButton m_btnZ; // 预留按钮 Z CIconButton m_btnZ; // 预留按钮 Z
CIconButton m_btnScreenshot; CIconButton m_btnScreenshot;
CIconButton m_btnGetClipboard; // 获取剪贴板
CIconButton m_btnSetClipboard; // 设置剪贴板
CIconButton m_btnMinimize; CIconButton m_btnMinimize;
CIconButton m_btnClose; CIconButton m_btnClose;
@@ -80,6 +82,8 @@ public:
afx_msg void OnBnClickedY(); // 预留按钮 Y 响应函数 afx_msg void OnBnClickedY(); // 预留按钮 Y 响应函数
afx_msg void OnBnClickedZ(); // 预留按钮 Z 响应函数 afx_msg void OnBnClickedZ(); // 预留按钮 Z 响应函数
afx_msg void OnBnClickedScreenshot(); afx_msg void OnBnClickedScreenshot();
afx_msg void OnBnClickedGetClipboard();
afx_msg void OnBnClickedSetClipboard();
afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg BOOL OnEraseBkgnd(CDC* pDC);
virtual BOOL OnInitDialog(); virtual BOOL OnInitDialog();
}; };

View File

@@ -231,6 +231,8 @@ RTT=RTT
放下面=Send Back 放下面=Send Back
透明度=Opacity 透明度=Opacity
截图=Capture 截图=Capture
获取剪贴板=Get Clipboard
设置剪贴板=Set Clipboard
; ============================================ ; ============================================
; Settings Dialog ; Settings Dialog

View File

@@ -230,6 +230,8 @@ RTT=RTT
放下面=置於下層 放下面=置於下層
透明度=透明度 透明度=透明度
截图=擷取螢幕 截图=擷取螢幕
获取剪贴板=取得剪貼簿
设置剪贴板=設定剪貼簿
; ============================================ ; ============================================
; Settings Dialog ; Settings Dialog

View File

@@ -582,6 +582,8 @@
#define IDC_BTN_X 2312 #define IDC_BTN_X 2312
#define IDC_BTN_Y 2313 #define IDC_BTN_Y 2313
#define IDC_BTN_Z 2314 #define IDC_BTN_Z 2314
#define IDC_BTN_GET_CLIPBOARD 2315
#define IDC_BTN_SET_CLIPBOARD 2316
#define IDC_STATIC_ABOUTBOX_YamaV12_2340 2340 #define IDC_STATIC_ABOUTBOX_YamaV12_2340 2340
#define IDC_STATIC_ABOUTBOX_Copyleft__2341 2341 #define IDC_STATIC_ABOUTBOX_Copyleft__2341 2341
#define IDC_STATIC_FILE_MANAGER_LOCAL_PATH 2342 #define IDC_STATIC_FILE_MANAGER_LOCAL_PATH 2342