From a8e888b0c0b6dfa9194c33f0515988d23d42f1bf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 8 Feb 2009 09:46:03 +0000 Subject: [PATCH] translate (c) and (C) to \u00a9 in wxAboutDialog [backport of r57245, r57514 and r57840 from trunk] (closes #4216) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@58748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/aboutdlg.h | 6 ++++++ src/generic/aboutdlgg.cpp | 15 ++++++++++++++- src/gtk/aboutdlg.cpp | 11 ++++++++++- src/msw/aboutdlg.cpp | 2 +- 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 40bd9fd27f..3f5d619d9b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -131,6 +131,7 @@ All (GUI): - Added wxAUI_MGR_LIVE_RESIZE flag to wxAuiManager and made it the default on wxMac with CoreGraphics where sash drawing isn't implemented. - Use bitmap mask in wxSplashScreen. +- Translate "(c)" and "(C)" to the real copyright sign in wxAboutBox. All (Unix): diff --git a/include/wx/aboutdlg.h b/include/wx/aboutdlg.h index 2c38167c7d..5b57247d3d 100644 --- a/include/wx/aboutdlg.h +++ b/include/wx/aboutdlg.h @@ -128,6 +128,12 @@ public: // artists and translators) as a one long multiline string wxString GetDescriptionAndCredits() const; +#if wxABI_VERSION >= 20810 + // returns the copyright with the (C) string substituted by the Unicode + // character U+00A9 + wxString GetCopyrightToDisplay() const; +#endif // wx 2.8.10+ + private: wxString m_name, m_version, diff --git a/src/generic/aboutdlgg.cpp b/src/generic/aboutdlgg.cpp index 85e864acd6..a8ba024361 100644 --- a/src/generic/aboutdlgg.cpp +++ b/src/generic/aboutdlgg.cpp @@ -96,6 +96,19 @@ wxIcon wxAboutDialogInfo::GetIcon() const return icon; } +wxString wxAboutDialogInfo::GetCopyrightToDisplay() const +{ + wxString ret = m_copyright; + +#if wxUSE_UNICODE + const wxString copyrightSign = wxString::FromUTF8("\xc2\xa9"); + ret.Replace("(c)", copyrightSign); + ret.Replace("(C)", copyrightSign); +#endif // wxUSE_UNICODE + + return ret; +} + // ---------------------------------------------------------------------------- // wxGenericAboutDialog // ---------------------------------------------------------------------------- @@ -120,7 +133,7 @@ bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info) m_sizerText->Add(label, wxSizerFlags().Centre().Border()); m_sizerText->AddSpacer(5); - AddText(info.GetCopyright()); + AddText(info.GetCopyrightToDisplay()); AddText(info.GetDescription()); if ( info.HasWebSite() ) diff --git a/src/gtk/aboutdlg.cpp b/src/gtk/aboutdlg.cpp index b6d960990b..f5fc3a0b1a 100644 --- a/src/gtk/aboutdlg.cpp +++ b/src/gtk/aboutdlg.cpp @@ -50,6 +50,13 @@ public: class GtkArray { public: + // Create empty GtkArray + GtkArray() : m_strings(0), m_count(0) + { + } + + // Create GtkArray from wxArrayString. Note that the created object is + // only valid as long as 'a' is! GtkArray(const wxArrayString& a) { m_count = a.size(); @@ -105,7 +112,9 @@ void wxAboutBox(const wxAboutDialogInfo& info) if ( info.HasVersion() ) gtk_about_dialog_set_version(dlg, GtkStr(info.GetVersion())); if ( info.HasCopyright() ) - gtk_about_dialog_set_copyright(dlg, GtkStr(info.GetCopyright())); + gtk_about_dialog_set_copyright(dlg, GtkStr(info.GetCopyrightToDisplay())); + else + gtk_about_dialog_set_copyright(dlg, NULL); if ( info.HasDescription() ) gtk_about_dialog_set_comments(dlg, GtkStr(info.GetDescription())); if ( info.HasLicence() ) diff --git a/src/msw/aboutdlg.cpp b/src/msw/aboutdlg.cpp index 1d8823b816..fe223a85a5 100644 --- a/src/msw/aboutdlg.cpp +++ b/src/msw/aboutdlg.cpp @@ -53,7 +53,7 @@ void wxAboutBox(const wxAboutDialogInfo& info) msg << _T('\n'); if ( info.HasCopyright() ) - msg << info.GetCopyright() << _T('\n'); + msg << info.GetCopyrightToDisplay() << _T('\n'); // add everything remaining msg << info.GetDescriptionAndCredits();