From d0210446fa9e2bf7cf35996f91fc32ebd0567680 Mon Sep 17 00:00:00 2001 From: Takashi Sawanaka Date: Sun, 12 Nov 2023 02:42:13 +0900 Subject: [PATCH] Translate the One Page Button and Two Page Button on the Print Preivew toolbar. --- Src/MergeEditFrm.cpp | 24 ++++++++++++++++++++++++ Src/MergeEditFrm.h | 4 ++++ 2 files changed, 28 insertions(+) diff --git a/Src/MergeEditFrm.cpp b/Src/MergeEditFrm.cpp index d1353839c1e..c04a73e9760 100644 --- a/Src/MergeEditFrm.cpp +++ b/Src/MergeEditFrm.cpp @@ -391,6 +391,29 @@ void CMergeEditFrame::OnIdleUpdateCmdUI() CMergeFrameCommon::OnIdleUpdateCmdUI(); } +LRESULT CMergeEditFrame::CPreviewNumPageButton::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_SETTEXT: + { + // Translate the One Page Button and Two Page Button on the Print Preivew toolbar. + String text = reinterpret_cast(lParam); + String translated = tr(text); + if (translated != text) + { + SetWindowText(translated.c_str()); + return TRUE; + } + break; + } + case WM_DESTROY: + UnsubclassWindow(); + break; + } + return __super::WindowProc(message, wParam, lParam); +} + void CMergeEditFrame::OnTimer(UINT_PTR nIDEvent) { if (nIDEvent == IDT_SAVEPOSITION) @@ -406,6 +429,7 @@ void CMergeEditFrame::OnTimer(UINT_PTR nIDEvent) { pPreviewBar->Invalidate(); theApp.TranslateDialog(pPreviewBar->GetSafeHwnd()); + m_wndPreviewNumPage.SubclassWindow(pPreviewBar->GetDlgItem(AFX_ID_PREVIEW_NUMPAGE)->GetSafeHwnd()); } } else diff --git a/Src/MergeEditFrm.h b/Src/MergeEditFrm.h index 3feb4f21454..3d656e28e0c 100644 --- a/Src/MergeEditFrm.h +++ b/Src/MergeEditFrm.h @@ -48,6 +48,10 @@ class CMergeEditFrame : public CMergeFrameCommon CMergeEditSplitterView *m_pwndDetailMergeEditSplitterView; CMergeStatusBar m_wndStatusBar; CLocationBar m_wndLocationBar; + class CPreviewNumPageButton : public CButton + { + virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); + } m_wndPreviewNumPage; // Overrides public: