OSDN Git Service

PATCH: [ 708542 ] Make splash & about show language-independent version
authorPerry Rapp <elsapo@users.sourceforge.net>
Tue, 25 Mar 2003 22:25:00 +0000 (22:25 +0000)
committerPerry Rapp <elsapo@users.sourceforge.net>
Tue, 25 Mar 2003 22:25:00 +0000 (22:25 +0000)
Src/Common/version.cpp
Src/Common/version.h
Src/Merge.cpp
Src/Splash.cpp
Src/readme.txt

index 6f5d719..ba1a666 100644 (file)
@@ -42,6 +42,7 @@ void CVersionInfo::Init()
        m_strSpecialBuild = _T("");
        m_strPrivateBuild = _T("");
        m_bQueryDone=FALSE;
+       memset(&m_FixedFileInfo, 0, sizeof(m_FixedFileInfo));
 }
 
 CString CVersionInfo::GetFileVersion()
@@ -107,6 +108,21 @@ CString CVersionInfo::GetProductVersion()
        return m_strProductVersion;
 }
 
+static CString MakeVersionString(DWORD hi, DWORD lo)
+{
+       CString sver;
+       sver.Format(_T("%d.%d.%d.%d"), HIWORD(hi), LOWORD(hi), HIWORD(lo), LOWORD(lo));
+       return sver;
+}
+
+CString CVersionInfo::GetFixedProductVersion()
+{
+       if (!m_bQueryDone)
+               GetVersionInfo();
+       return MakeVersionString(m_FixedFileInfo.dwProductVersionMS
+               , m_FixedFileInfo.dwProductVersionLS);
+}
+
 CString CVersionInfo::GetComments()
 {
        if (!m_bQueryDone)
@@ -133,6 +149,7 @@ void CVersionInfo::GetVersionInfo()
                m_lpstrVffInfo  = (LPTSTR)GlobalLock(hMem);
                if (GetFileVersionInfo(szFileName, dwVerHnd, dwVerInfoSize, m_lpstrVffInfo))
                {
+                       GetFixedVersionInfo();
                        if (m_strLanguage.IsEmpty()
                                || m_strCodepage.IsEmpty())
                        {
@@ -188,6 +205,14 @@ void CVersionInfo::QueryValue(LPCTSTR szId, CString& s)
                s = _T("");
 }
 
+void CVersionInfo::GetFixedVersionInfo()
+{
+       VS_FIXEDFILEINFO * pffi;
+       UINT len = sizeof(*pffi);
+       BOOL bRetCode = VerQueryValue(
+               (LPVOID)m_lpstrVffInfo, _T("\\"), (LPVOID *)&pffi, &len);
+       memcpy(&m_FixedFileInfo, pffi, sizeof(m_FixedFileInfo));
+}
 
 
 /*******************************************************************************
index 798ebbb..9e38875 100644 (file)
@@ -8,6 +8,9 @@ FILE: version.h
 class CVersionInfo
 {
        LPTSTR   m_lpstrVffInfo;
+       BOOL m_bQueryDone;
+       VS_FIXEDFILEINFO m_FixedFileInfo;
+
        CString m_strFileName;
        CString m_strLanguage;
        CString m_strCodepage;
@@ -23,7 +26,6 @@ class CVersionInfo
        CString m_strSpecialBuild;
        CString m_strPrivateBuild;
        void Init();
-       BOOL m_bQueryDone;
 
 public:
        CVersionInfo(LPCTSTR szFileToVersion = NULL, 
@@ -40,8 +42,10 @@ public:
        CString GetComments();
        CString GetSpecialBuild();
        CString GetPrivateBuild();
+       CString GetFixedProductVersion();
 protected:
        void GetVersionInfo();
+       void GetFixedVersionInfo();
        void QueryValue(LPCTSTR szId, CString& s);
 };
 
index 39a883a..037fc86 100644 (file)
@@ -300,7 +300,8 @@ BOOL CAboutDlg::OnInitDialog()
        CDialog::OnInitDialog();
        
        CVersionInfo version;
-       AfxFormatString1(m_strVersion, IDS_VERSION_FMT, version.GetProductVersion());
+       CString sVersion = version.GetFixedProductVersion();
+       AfxFormatString1(m_strVersion, IDS_VERSION_FMT, sVersion);
 
        m_ctlCompany.SetWindowText(version.GetLegalCopyright());
        m_ctlWWW.m_link = _T("http://winmerge.sourceforge.net");
index 0778c4c..47a6dbc 100644 (file)
@@ -160,7 +160,8 @@ void CSplashWnd::OnPaint()
        if (ft.CreatePointFont( 100, _T("Arial"), &dc ))
                oldfont = dc.SelectObject(&ft);
 
-       AfxFormatString1(s, IDS_VERSION_FMT, version.GetProductVersion());
+       CString sVersion = version.GetFixedProductVersion();
+       AfxFormatString1(s, IDS_VERSION_FMT, sVersion);
        dc.SetBkMode(TRANSPARENT);
        dc.TextOut(90, 110, s);
        if (oldfont != NULL)
index 65e7cbc..cfef7af 100644 (file)
@@ -1,6 +1,9 @@
 2003-03-25 Perry
  PATCH: [ 709575 ] Fix sanity check in CChildFrame::UpdateHeaderSizes()
  WinMerge: ChildFrm.cpp
+ PATCH: [ 708542 ] Make splash & about show language-independent version
+ common: version.cpp version.h
+ WinMerge: Merge.cpp Splash.cpp
 
 2003-03-25 Christian
  Replace COPYING with corrected version from http://www.gnu.org/licenses/gpl.txt