1   /************************************************************************
  2           Copy Handler 1.x - program for copying data in Microsoft Windows
  3                                                    systems.
  4           Copyright (C) 2001-2004 Ixen Gerthannes (copyhandler@o2.pl)
  5  
  6           This program is free software; you can redistribute it and/or modify
  7           it under the terms of the GNU General Public License as published by
  8           the Free Software Foundation; either version 2 of the License, or
  9           (at your option) any later version.
  10  
  11           This program is distributed in the hope that it will be useful,
  12           but WITHOUT ANY WARRANTY; without even the implied warranty of
  13           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14           GNU General Public License for more details.
  15  
  16           You should have received a copy of the GNU General Public License
  17           along with this program; if not, write to the Free Software
  18           Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19   *************************************************************************/
  20  
  21   #include "stdafx.h"
  22   #include "Copy Handler.h"
  23   #include "resource.h"
  24   #include "AboutDlg.h"
  25   #include "StaticEx.h"
  26  
  27   bool CAboutDlg::m_bLock=false;
  28  
  29   CAboutDlg::CAboutDlg() : CHLanguageDialog(CAboutDlg::IDD, NULL, &m_bLock)
  30   {
  31           //{{AFX_DATA_INIT(CAboutDlg)
  32           //}}AFX_DATA_INIT
  33           RegisterStaticExControl(AfxGetInstanceHandle());
  34   }
  35  
  36   CAboutDlg::~CAboutDlg()
  37   {
  38   }
  39  
  40   BEGIN_MESSAGE_MAP(CAboutDlg, CHLanguageDialog)
  41           //{{AFX_MSG_MAP(CAboutDlg)
  42           //}}AFX_MSG_MAP
  43   END_MESSAGE_MAP()
  44  
  45   void CAboutDlg::UpdateProgramVersion()
  46   {
  47           CWnd* pCtl=(CWnd*)GetDlgItem(IDC_PROGRAM_STATICEX);
  48           CWnd* pCtl2=(CWnd*)GetDlgItem(IDC_FULLVERSION_STATICEX);
  49           if (!pCtl || !pCtl2)
  50                   return;
  51           else
  52           {
  53                   TCHAR szFull[256];
  54                   _stprintf(szFull, GetResManager()->LoadString(IDS_ABOUTVERSION_STRING), GetApp()->GetAppVersion());
  55  
  56                   pCtl->SetWindowText(GetApp()->GetAppNameVer());
  57                   pCtl2->SetWindowText(szFull);
  58           }
  59   }
  60  
  61   void CAboutDlg::UpdateThanks()
  62   {
  63           CEdit* pEdit=(CEdit*)GetDlgItem(IDC_THANX_EDIT);
  64           if (pEdit == NULL)
  65                   return;
  66  
  67           // get the info about current translations
  68           TCHAR szData[1024];
  69           GetConfig()->GetStringValue(PP_PLANGDIR, szData, 1024);
  70           GetApp()->ExpandPath(szData);
  71           vector<CLangData> vData;
  72           GetResManager()->Scan(szData, &vData);
  73  
  74           // format the info
  75           TCHAR szTI[8192];
  76           szTI[0]=_T('\0');
  77           for (vector<CLangData>::iterator it=vData.begin();it!=vData.end();it++)
  78           {
  79                   _stprintf(szData, _T("%s\t\t%s [%s%lu, %s%s]\r\n"), it->GetAuthor(), it->GetLangName(), GetResManager()->LoadString(IDS_LANGCODE_STRING), it->GetLangCode(), GetResManager()->LoadString(IDS_LANGVER_STRING), it->GetVersion());
  80                   _tcscat(szTI, szData);
  81           }
  82  
  83           TCHAR szText[16384];
  84           _sntprintf(szText, 16384, GetResManager()->LoadString(IDR_THANKS_TEXT), szTI);
  85           szText[16383]=0;
  86           pEdit->SetWindowText(szText);
  87   }
  88  
  89   BOOL CAboutDlg::OnInitDialog()
  90   {
  91           CHLanguageDialog::OnInitDialog();
  92  
  93           UpdateProgramVersion();
  94           UpdateThanks();
  95  
  96           return TRUE;
  97   }
  98  
  99   void CAboutDlg::OnLanguageChanged(WORD /*wOld*/, WORD /*wNew*/)
  100   {
  101           UpdateProgramVersion();
  102           UpdateThanks();
  103   }
  104  
  105   BOOL CAboutDlg::OnTooltipText(UINT uiID, TOOLTIPTEXT* pTip)
  106   {
  107           switch(uiID)
  108           {
  109           case IDC_HOMEPAGELINK_STATIC:
  110           case IDC_HOMEPAGELINK2_STATIC:
  111           case IDC_CONTACT1LINK_STATIC:
  112           case IDC_CONTACT2LINK_STATIC:
  113           case IDC_CONTACT3LINK_STATIC:
  114           case IDC_GENFORUMPAGELINK_STATIC:
  115           case IDC_GENFORUMSUBSCRIBELINK_STATIC:
  116           case IDC_GENFORUMUNSUBSCRIBELINK_STATIC:
  117           case IDC_GENFORUMSENDLINK_STATIC:
  118           case IDC_DEVFORUMPAGELINK_STATIC:
  119           case IDC_DEVFORUMSUBSCRIBELINK_STATIC:
  120           case IDC_DEVFORUMUNSUBSCRIBELINK_STATIC:
  121           case IDC_DEVFORUMSENDLINK_STATIC:
  122                   {
  123                           HWND hWnd=::GetDlgItem(this->m_hWnd, uiID);
  124                           if (!hWnd)
  125                                   return FALSE;
  126                           ::SendMessage(hWnd, SEM_GETLINK, (WPARAM)79, (LPARAM)pTip->szText);
  127                           pTip->szText[79]=_T('\0');
  128                           return TRUE;
  129                   }
  130           default:
  131                   return FALSE;
  132           }
  133   }