diff --git a/WinHTTrack/MainTab.cpp b/WinHTTrack/MainTab.cpp index 686b1fc..063dc0d 100755 --- a/WinHTTrack/MainTab.cpp +++ b/WinHTTrack/MainTab.cpp @@ -132,6 +132,18 @@ void CMainTab::AddControlPages() AddPage(&m_option3); /* Expert */ } +/* The pages are built before a first run knows its language, so each one re-reads its + title here. It must happen before the base creates the sheet: comctl32 sizes the tab + strip from the captions in effect then, and relabelling afterwards loses a row. */ +INT_PTR CMainTab::DoModal() +{ + m_option1.SetLangTitle(); m_option2.SetLangTitle(); m_option3.SetLangTitle(); + m_option4.SetLangTitle(); m_option5.SetLangTitle(); m_option6.SetLangTitle(); + m_option7.SetLangTitle(); m_option8.SetLangTitle(); m_option9.SetLangTitle(); + m_option10.SetLangTitle(); m_option11.SetLangTitle(); + return CPropertySheet::DoModal(); +} + void CMainTab::DefineDefaultProxy() { while(GetPageCount()>0) diff --git a/WinHTTrack/MainTab.h b/WinHTTrack/MainTab.h index 6681f0b..81909db 100644 --- a/WinHTTrack/MainTab.h +++ b/WinHTTrack/MainTab.h @@ -54,6 +54,9 @@ class CMainTab : public CPropertySheet CMainTab(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); CMainTab(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); +public: + virtual INT_PTR DoModal(); + protected: void AddControlPages(void); diff --git a/WinHTTrack/OptionTab1.cpp b/WinHTTrack/OptionTab1.cpp index b823e33..afa3257 100755 --- a/WinHTTrack/OptionTab1.cpp +++ b/WinHTTrack/OptionTab1.cpp @@ -42,14 +42,22 @@ static char THIS_FILE[] = __FILE__; IMPLEMENT_DYNCREATE(COptionTab1, CPropertyPage) -COptionTab1::COptionTab1() : CPropertyPage(COptionTab1::IDD) +/* Called again before each show: the page is built before a first run knows its + language. The copy is page-owned, since a language change frees the hash string. */ +void COptionTab1::SetLangTitle(void) { - // Patcher titre - if (LANG_T(-1)) { // Patcher en français - m_strCaption = LANG(LANG_IOPT1); // page-owned copy; the hash-table string is freed on a language change + const char *const title = LANG(LANG_IOPT1); + /* English keeps the .rc caption, as it did when this ran only from the constructor. */ + if (LANG_T(-1) != 0 && title[0] != '\0') { + m_strCaption = title; m_psp.pszTitle = m_strCaption; m_psp.dwFlags|=PSP_USETITLE; } +} + +COptionTab1::COptionTab1() : CPropertyPage(COptionTab1::IDD) +{ + SetLangTitle(); m_psp.dwFlags|=PSP_HASHELP; // //{{AFX_DATA_INIT(COptionTab1) diff --git a/WinHTTrack/OptionTab1.h b/WinHTTrack/OptionTab1.h index 12ccea5..343859e 100644 --- a/WinHTTrack/OptionTab1.h +++ b/WinHTTrack/OptionTab1.h @@ -42,6 +42,7 @@ class COptionTab1 : public CPropertyPage // Construction public: + void SetLangTitle(void); COptionTab1(); ~COptionTab1(); const char* GetTip(int id); diff --git a/WinHTTrack/OptionTab10.cpp b/WinHTTrack/OptionTab10.cpp index a680275..d9c5859 100755 --- a/WinHTTrack/OptionTab10.cpp +++ b/WinHTTrack/OptionTab10.cpp @@ -56,14 +56,22 @@ extern "C" { IMPLEMENT_DYNCREATE(COptionTab10, CPropertyPage) -COptionTab10::COptionTab10() : CPropertyPage(COptionTab10::IDD) +/* Called again before each show: the page is built before a first run knows its + language. The copy is page-owned, since a language change frees the hash string. */ +void COptionTab10::SetLangTitle(void) { - // Patcher titre - if (LANG_T(-1)) { // Patcher en français - m_strCaption = LANG(LANG_IOPT10); // page-owned copy; the hash-table string is freed on a language change + const char *const title = LANG(LANG_IOPT10); + /* English keeps the .rc caption, as it did when this ran only from the constructor. */ + if (LANG_T(-1) != 0 && title[0] != '\0') { + m_strCaption = title; m_psp.pszTitle = m_strCaption; m_psp.dwFlags|=PSP_USETITLE; } +} + +COptionTab10::COptionTab10() : CPropertyPage(COptionTab10::IDD) +{ + SetLangTitle(); m_psp.dwFlags|=PSP_HASHELP; // //{{AFX_DATA_INIT(COptionTab10) diff --git a/WinHTTrack/OptionTab10.h b/WinHTTrack/OptionTab10.h index 0907cbf..46daa37 100644 --- a/WinHTTrack/OptionTab10.h +++ b/WinHTTrack/OptionTab10.h @@ -42,6 +42,7 @@ class COptionTab10 : public CPropertyPage // Construction public: + void SetLangTitle(void); COptionTab10(); ~COptionTab10(); const char* GetTip(int id); diff --git a/WinHTTrack/OptionTab11.cpp b/WinHTTrack/OptionTab11.cpp index 8a35cef..2cf6ab3 100755 --- a/WinHTTrack/OptionTab11.cpp +++ b/WinHTTrack/OptionTab11.cpp @@ -42,14 +42,22 @@ static char THIS_FILE[] = __FILE__; IMPLEMENT_DYNCREATE(COptionTab11, CPropertyPage) -COptionTab11::COptionTab11() : CPropertyPage(COptionTab11::IDD) +/* Called again before each show: the page is built before a first run knows its + language. The copy is page-owned, since a language change frees the hash string. */ +void COptionTab11::SetLangTitle(void) { - // Patcher titre - if (LANG_T(-1)) { // Patcher en français - m_strCaption = LANG(LANG_IOPT11); // page-owned copy; the hash-table string is freed on a language change + const char *const title = LANG(LANG_IOPT11); + /* English keeps the .rc caption, as it did when this ran only from the constructor. */ + if (LANG_T(-1) != 0 && title[0] != '\0') { + m_strCaption = title; m_psp.pszTitle = m_strCaption; m_psp.dwFlags|=PSP_USETITLE; } +} + +COptionTab11::COptionTab11() : CPropertyPage(COptionTab11::IDD) +{ + SetLangTitle(); m_psp.dwFlags|=PSP_HASHELP; //{{AFX_DATA_INIT(COptionTab11) m_ext1 = _T(""); diff --git a/WinHTTrack/OptionTab11.h b/WinHTTrack/OptionTab11.h index 8454fd9..b8fd3d6 100644 --- a/WinHTTrack/OptionTab11.h +++ b/WinHTTrack/OptionTab11.h @@ -44,6 +44,7 @@ class COptionTab11 : public CPropertyPage // Construction public: + void SetLangTitle(void); COptionTab11(); ~COptionTab11(); const char* GetTip(int id); diff --git a/WinHTTrack/OptionTab2.cpp b/WinHTTrack/OptionTab2.cpp index 0892615..b772095 100755 --- a/WinHTTrack/OptionTab2.cpp +++ b/WinHTTrack/OptionTab2.cpp @@ -42,14 +42,22 @@ static char THIS_FILE[] = __FILE__; IMPLEMENT_DYNCREATE(COptionTab2, CPropertyPage) -COptionTab2::COptionTab2() : CPropertyPage(COptionTab2::IDD) +/* Called again before each show: the page is built before a first run knows its + language. The copy is page-owned, since a language change frees the hash string. */ +void COptionTab2::SetLangTitle(void) { - // Patcher titre - if (LANG_T(-1)) { // Patcher en français - m_strCaption = LANG(LANG_IOPT2); // page-owned copy; the hash-table string is freed on a language change + const char *const title = LANG(LANG_IOPT2); + /* English keeps the .rc caption, as it did when this ran only from the constructor. */ + if (LANG_T(-1) != 0 && title[0] != '\0') { + m_strCaption = title; m_psp.pszTitle = m_strCaption; m_psp.dwFlags|=PSP_USETITLE; } +} + +COptionTab2::COptionTab2() : CPropertyPage(COptionTab2::IDD) +{ + SetLangTitle(); m_psp.dwFlags|=PSP_HASHELP; // //{{AFX_DATA_INIT(COptionTab2) diff --git a/WinHTTrack/OptionTab2.h b/WinHTTrack/OptionTab2.h index 49149c2..d018673 100644 --- a/WinHTTrack/OptionTab2.h +++ b/WinHTTrack/OptionTab2.h @@ -47,6 +47,7 @@ class COptionTab2 : public CPropertyPage // Construction public: + void SetLangTitle(void); COptionTab2(); ~COptionTab2(); CBuildOptions Bopt; diff --git a/WinHTTrack/OptionTab3.cpp b/WinHTTrack/OptionTab3.cpp index e9d9ae4..daeab56 100755 --- a/WinHTTrack/OptionTab3.cpp +++ b/WinHTTrack/OptionTab3.cpp @@ -42,14 +42,22 @@ static char THIS_FILE[] = __FILE__; IMPLEMENT_DYNCREATE(COptionTab3, CPropertyPage) -COptionTab3::COptionTab3() : CPropertyPage(COptionTab3::IDD) +/* Called again before each show: the page is built before a first run knows its + language. The copy is page-owned, since a language change frees the hash string. */ +void COptionTab3::SetLangTitle(void) { - // Patcher titre - if (LANG_T(-1)) { // Patcher en français - m_strCaption = LANG(LANG_IOPT3); // page-owned copy; the hash-table string is freed on a language change + const char *const title = LANG(LANG_IOPT3); + /* English keeps the .rc caption, as it did when this ran only from the constructor. */ + if (LANG_T(-1) != 0 && title[0] != '\0') { + m_strCaption = title; m_psp.pszTitle = m_strCaption; m_psp.dwFlags|=PSP_USETITLE; } +} + +COptionTab3::COptionTab3() : CPropertyPage(COptionTab3::IDD) +{ + SetLangTitle(); m_psp.dwFlags|=PSP_HASHELP; // //{{AFX_DATA_INIT(COptionTab3) diff --git a/WinHTTrack/OptionTab3.h b/WinHTTrack/OptionTab3.h index 3be8967..5d03bc3 100644 --- a/WinHTTrack/OptionTab3.h +++ b/WinHTTrack/OptionTab3.h @@ -44,6 +44,7 @@ class COptionTab3 : public CPropertyPage // Construction public: + void SetLangTitle(void); COptionTab3(); ~COptionTab3(); int modify; diff --git a/WinHTTrack/OptionTab4.cpp b/WinHTTrack/OptionTab4.cpp index f709b94..5a4a654 100755 --- a/WinHTTrack/OptionTab4.cpp +++ b/WinHTTrack/OptionTab4.cpp @@ -42,14 +42,22 @@ static char THIS_FILE[] = __FILE__; IMPLEMENT_DYNCREATE(COptionTab4, CPropertyPage) -COptionTab4::COptionTab4() : CPropertyPage(COptionTab4::IDD) +/* Called again before each show: the page is built before a first run knows its + language. The copy is page-owned, since a language change frees the hash string. */ +void COptionTab4::SetLangTitle(void) { - // Patcher titre - if (LANG_T(-1)) { // Patcher en français - m_strCaption = LANG(LANG_IOPT4); // page-owned copy; the hash-table string is freed on a language change + const char *const title = LANG(LANG_IOPT4); + /* English keeps the .rc caption, as it did when this ran only from the constructor. */ + if (LANG_T(-1) != 0 && title[0] != '\0') { + m_strCaption = title; m_psp.pszTitle = m_strCaption; m_psp.dwFlags|=PSP_USETITLE; } +} + +COptionTab4::COptionTab4() : CPropertyPage(COptionTab4::IDD) +{ + SetLangTitle(); m_psp.dwFlags|=PSP_HASHELP; // //{{AFX_DATA_INIT(COptionTab4) diff --git a/WinHTTrack/OptionTab4.h b/WinHTTrack/OptionTab4.h index 28cef5e..412d28e 100644 --- a/WinHTTrack/OptionTab4.h +++ b/WinHTTrack/OptionTab4.h @@ -42,6 +42,7 @@ class COptionTab4 : public CPropertyPage // Construction public: + void SetLangTitle(void); COptionTab4(); ~COptionTab4(); const char* GetTip(int id); diff --git a/WinHTTrack/OptionTab5.cpp b/WinHTTrack/OptionTab5.cpp index 3c4d124..b8371ed 100755 --- a/WinHTTrack/OptionTab5.cpp +++ b/WinHTTrack/OptionTab5.cpp @@ -42,14 +42,22 @@ static char THIS_FILE[] = __FILE__; IMPLEMENT_DYNCREATE(COptionTab5, CPropertyPage) -COptionTab5::COptionTab5() : CPropertyPage(COptionTab5::IDD) +/* Called again before each show: the page is built before a first run knows its + language. The copy is page-owned, since a language change frees the hash string. */ +void COptionTab5::SetLangTitle(void) { - // Patcher titre - if (LANG_T(-1)) { // Patcher en français - m_strCaption = LANG(LANG_IOPT5); // page-owned copy; the hash-table string is freed on a language change + const char *const title = LANG(LANG_IOPT5); + /* English keeps the .rc caption, as it did when this ran only from the constructor. */ + if (LANG_T(-1) != 0 && title[0] != '\0') { + m_strCaption = title; m_psp.pszTitle = m_strCaption; m_psp.dwFlags|=PSP_USETITLE; } +} + +COptionTab5::COptionTab5() : CPropertyPage(COptionTab5::IDD) +{ + SetLangTitle(); m_psp.dwFlags|=PSP_HASHELP; // //{{AFX_DATA_INIT(COptionTab5) diff --git a/WinHTTrack/OptionTab5.h b/WinHTTrack/OptionTab5.h index 74d0f3d..33017a6 100644 --- a/WinHTTrack/OptionTab5.h +++ b/WinHTTrack/OptionTab5.h @@ -42,6 +42,7 @@ class COptionTab5 : public CPropertyPage // Construction public: + void SetLangTitle(void); COptionTab5(); ~COptionTab5(); const char* GetTip(int id); diff --git a/WinHTTrack/OptionTab6.cpp b/WinHTTrack/OptionTab6.cpp index d19de05..1961a17 100755 --- a/WinHTTrack/OptionTab6.cpp +++ b/WinHTTrack/OptionTab6.cpp @@ -54,14 +54,22 @@ extern const char *const FooterPresets[] = { IMPLEMENT_DYNCREATE(COptionTab6, CPropertyPage) -COptionTab6::COptionTab6() : CPropertyPage(COptionTab6::IDD) +/* Called again before each show: the page is built before a first run knows its + language. The copy is page-owned, since a language change frees the hash string. */ +void COptionTab6::SetLangTitle(void) { - // Patcher titre - if (LANG_T(-1)) { // Patcher en français - m_strCaption = LANG(LANG_IOPT6); // page-owned copy; the hash-table string is freed on a language change + const char *const title = LANG(LANG_IOPT6); + /* English keeps the .rc caption, as it did when this ran only from the constructor. */ + if (LANG_T(-1) != 0 && title[0] != '\0') { + m_strCaption = title; m_psp.pszTitle = m_strCaption; m_psp.dwFlags|=PSP_USETITLE; } +} + +COptionTab6::COptionTab6() : CPropertyPage(COptionTab6::IDD) +{ + SetLangTitle(); m_psp.dwFlags|=PSP_HASHELP; // //{{AFX_DATA_INIT(COptionTab6) diff --git a/WinHTTrack/OptionTab6.h b/WinHTTrack/OptionTab6.h index bf0e9aa..38a1c12 100644 --- a/WinHTTrack/OptionTab6.h +++ b/WinHTTrack/OptionTab6.h @@ -48,6 +48,7 @@ class COptionTab6 : public CPropertyPage // Construction public: + void SetLangTitle(void); COptionTab6(); ~COptionTab6(); const char* GetTip(int id); diff --git a/WinHTTrack/OptionTab7.cpp b/WinHTTrack/OptionTab7.cpp index d6bc242..8b8ce57 100755 --- a/WinHTTrack/OptionTab7.cpp +++ b/WinHTTrack/OptionTab7.cpp @@ -50,14 +50,22 @@ static char THIS_FILE[] = __FILE__; IMPLEMENT_DYNCREATE(COptionTab7, CPropertyPage) -COptionTab7::COptionTab7() : CPropertyPage(COptionTab7::IDD) +/* Called again before each show: the page is built before a first run knows its + language. The copy is page-owned, since a language change frees the hash string. */ +void COptionTab7::SetLangTitle(void) { - // Patcher titre - if (LANG_T(-1)) { // Patcher en français - m_strCaption = LANG(LANG_IOPT7); // page-owned copy; the hash-table string is freed on a language change + const char *const title = LANG(LANG_IOPT7); + /* English keeps the .rc caption, as it did when this ran only from the constructor. */ + if (LANG_T(-1) != 0 && title[0] != '\0') { + m_strCaption = title; m_psp.pszTitle = m_strCaption; m_psp.dwFlags|=PSP_USETITLE; } +} + +COptionTab7::COptionTab7() : CPropertyPage(COptionTab7::IDD) +{ + SetLangTitle(); m_psp.dwFlags|=PSP_HASHELP; // //{{AFX_DATA_INIT(COptionTab7) diff --git a/WinHTTrack/OptionTab7.h b/WinHTTrack/OptionTab7.h index 0f3cbab..3588878 100644 --- a/WinHTTrack/OptionTab7.h +++ b/WinHTTrack/OptionTab7.h @@ -44,6 +44,7 @@ class COptionTab7 : public CPropertyPage // Construction public: + void SetLangTitle(void); COptionTab7(); ~COptionTab7(); const char* GetTip(int id); diff --git a/WinHTTrack/OptionTab8.cpp b/WinHTTrack/OptionTab8.cpp index ae4547e..40889ce 100755 --- a/WinHTTrack/OptionTab8.cpp +++ b/WinHTTrack/OptionTab8.cpp @@ -42,14 +42,22 @@ static char THIS_FILE[] = __FILE__; IMPLEMENT_DYNCREATE(COptionTab8, CPropertyPage) -COptionTab8::COptionTab8() : CPropertyPage(COptionTab8::IDD) +/* Called again before each show: the page is built before a first run knows its + language. The copy is page-owned, since a language change frees the hash string. */ +void COptionTab8::SetLangTitle(void) { - // Patcher titre - if (LANG_T(-1)) { // Patcher en français - m_strCaption = LANG(LANG_IOPT8); // page-owned copy; the hash-table string is freed on a language change + const char *const title = LANG(LANG_IOPT8); + /* English keeps the .rc caption, as it did when this ran only from the constructor. */ + if (LANG_T(-1) != 0 && title[0] != '\0') { + m_strCaption = title; m_psp.pszTitle = m_strCaption; m_psp.dwFlags|=PSP_USETITLE; } +} + +COptionTab8::COptionTab8() : CPropertyPage(COptionTab8::IDD) +{ + SetLangTitle(); m_psp.dwFlags|=PSP_HASHELP; // //{{AFX_DATA_INIT(COptionTab8) diff --git a/WinHTTrack/OptionTab8.h b/WinHTTrack/OptionTab8.h index 877378a..ae8de75 100644 --- a/WinHTTrack/OptionTab8.h +++ b/WinHTTrack/OptionTab8.h @@ -44,6 +44,7 @@ class COptionTab8 : public CPropertyPage // Construction public: + void SetLangTitle(void); COptionTab8(); ~COptionTab8(); const char* GetTip(int id); diff --git a/WinHTTrack/OptionTab9.cpp b/WinHTTrack/OptionTab9.cpp index f5f3d5d..ccf3c49 100755 --- a/WinHTTrack/OptionTab9.cpp +++ b/WinHTTrack/OptionTab9.cpp @@ -42,14 +42,22 @@ static char THIS_FILE[] = __FILE__; IMPLEMENT_DYNCREATE(COptionTab9, CPropertyPage) -COptionTab9::COptionTab9() : CPropertyPage(COptionTab9::IDD) +/* Called again before each show: the page is built before a first run knows its + language. The copy is page-owned, since a language change frees the hash string. */ +void COptionTab9::SetLangTitle(void) { - // Patcher titre - if (LANG_T(-1)) { // Patcher en français - m_strCaption = LANG(LANG_IOPT9); // page-owned copy; the hash-table string is freed on a language change + const char *const title = LANG(LANG_IOPT9); + /* English keeps the .rc caption, as it did when this ran only from the constructor. */ + if (LANG_T(-1) != 0 && title[0] != '\0') { + m_strCaption = title; m_psp.pszTitle = m_strCaption; m_psp.dwFlags|=PSP_USETITLE; } +} + +COptionTab9::COptionTab9() : CPropertyPage(COptionTab9::IDD) +{ + SetLangTitle(); m_psp.dwFlags|=PSP_HASHELP; // //{{AFX_DATA_INIT(COptionTab9) diff --git a/WinHTTrack/OptionTab9.h b/WinHTTrack/OptionTab9.h index cbf0954..a79ef1f 100644 --- a/WinHTTrack/OptionTab9.h +++ b/WinHTTrack/OptionTab9.h @@ -42,6 +42,7 @@ class COptionTab9 : public CPropertyPage // Construction public: + void SetLangTitle(void); COptionTab9(); ~COptionTab9(); const char* GetTip(int id); diff --git a/tools/screenshot-walk.py b/tools/screenshot-walk.py index 46173f1..e8bf5e8 100644 --- a/tools/screenshot-walk.py +++ b/tools/screenshot-walk.py @@ -327,8 +327,8 @@ def options(main, pid, ids, shots, connections=8, rate=2_000_000): sheet, tabs, captions = open_options(main, pid, ids) count = win32gui.SendMessage(tabs, TCM_GETITEMCOUNT, 0, 0) print(f" options sheet {sheet:#x}: {count} tabs") - # Keyed by a control each page owns: tab labels come from the .rc and stay - # English, but a display string would be the wrong key regardless. + # Keyed by a control each page owns, because the tab labels are translated, and a + # display string would be the wrong key regardless. wanted = {"IDC_maxrate": rate, "IDC_connexion": connections} owns = {} for i in range(count):