00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "precomp.h"
00028 #include "CCLicenseWizJurisdictionPage.h"
00029
00030 #include <tchar.h>
00031
00038 BOOL CCLicenseWizJurisdictionPage::PageProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
00039 {
00040 switch (uMsg)
00041 {
00042 case WM_COMMAND:
00043
00044 if (HIWORD(wParam) == BN_CLICKED)
00045 {
00046 UINT uID = LOWORD(wParam);
00047 if ((uID >= IDC_GENERAL) && (uID <= IDC_SPECIFIC))
00048 {
00049
00050 UpdateControls();
00051 return TRUE;
00052 }
00053 }
00054 break;
00055 }
00056
00057 return CCLicenseWizBasePage::PageProc(uMsg, wParam, lParam);
00058 }
00059
00063 BOOL CCLicenseWizJurisdictionPage::OnSetActive()
00064 {
00065
00066 CleanDlgCombo(IDC_JURISDICTION);
00067
00068 LicenseInfo::LoadedLicenseDataType eType = (m_pLicenseInfo->m_eLicense == LicenseInfo::LTCC) ? LicenseInfo::LLDTCC : LicenseInfo::LLDTSampling;
00069
00070
00071 const LPXNode pJuri = LicenseInfoLoader::GetLicenseXML(eType).Find(_T("field"), _T("jurisdiction"));
00072 if (pJuri != NULL)
00073 {
00074 DISP_OPT opt;
00075 opt.reference_value = false;
00076
00077
00078 const LPXNode pDescription = pJuri->GetChild(_T("description"));
00079 if (pDescription != NULL)
00080 SetDlgItemText(IDC_DESCRIPTION, (RemoveHtmlTags(pDescription->GetText(&opt))).c_str());
00081
00082
00083 for (XNodes::const_iterator i = pJuri->childs.begin(); i != pJuri->childs.end(); i++)
00084 {
00085 const LPXAttr pID = (*i)->GetAttr(_T("id"));
00086 if ((pID == NULL) || pID->value.empty())
00087
00088 continue;
00089
00090
00091 const LPXNode pLabel = (*i)->GetChild(_T("label"));
00092 if ((pLabel != NULL) && !pLabel->GetText().empty())
00093 {
00094
00095 AddDlgComboString(IDC_JURISDICTION, pLabel->GetText(&opt).c_str(), 0);
00096 }
00097 }
00098 }
00099
00100
00101 if (m_pLicenseInfo->HasJurisdiction())
00102 {
00103
00104 CheckRadioButton(m_hDlg, IDC_GENERAL, IDC_SPECIFIC, IDC_SPECIFIC);
00105 SetDlgComboSel(IDC_JURISDICTION, m_pLicenseInfo->m_cJurisdiction);
00106 }
00107 else
00108
00109 CheckRadioButton(m_hDlg, IDC_GENERAL, IDC_SPECIFIC, IDC_GENERAL);
00110
00111
00112 UpdateControls();
00113
00114 return TRUE;
00115 }
00116
00120 void CCLicenseWizJurisdictionPage::UpdateControls()
00121 {
00122
00123 int nSel = GetCheckedRadioBtn(IDC_GENERAL, IDC_SPECIFIC);
00124
00125
00126 SetWizardButtons(PSWIZB_BACK|((nSel == -1) ? 0 : PSWIZB_NEXT));
00127
00128
00129 EnableDlgItem(IDC_JURISDICTION, (nSel == 1));
00130 if (nSel == 1)
00131 {
00132
00133 if ((GetDlgComboSel(IDC_JURISDICTION) == CB_ERR) && (GetDlgComboCount(IDC_JURISDICTION) > 0))
00134 SetDlgComboItem(IDC_JURISDICTION, 0);
00135 }
00136 }
00137
00141 int CCLicenseWizJurisdictionPage::OnWizNext()
00142 {
00143 return IDD_LICENSEPAGE_SUMMERY;
00144 }
00145
00149 int CCLicenseWizJurisdictionPage::OnWizBack()
00150 {
00151
00152 return (m_pLicenseInfo->m_eLicense == LicenseInfo::LTCC) ? IDD_LICENSEPAGE_MODIFICATION : IDD_LICENSEPAGE_SAMPLING;
00153 }
00154
00158 BOOL CCLicenseWizJurisdictionPage::OnKillActive()
00159 {
00160
00161 int nSel = GetCheckedRadioBtn(IDC_GENERAL, IDC_SPECIFIC);
00162 if (nSel == -1)
00163
00164 return FALSE;
00165
00166 if (nSel == 0)
00167
00168 m_pLicenseInfo->SetJurisdiction(_T(""));
00169 else
00170 {
00171
00172 m_pLicenseInfo->SetJurisdiction(GetDlgComboText(IDC_JURISDICTION).c_str());
00173 }
00174 return true;
00175 }
00176
00181 bool CCLicenseWizJurisdictionPage::PreparePage(PROPSHEETPAGE& page)
00182 {
00183
00184 if (!CCLicenseWizBasePage::PreparePage(page))
00185 return false;
00186
00187
00188 page.dwFlags |= PSP_USEHEADERTITLE;
00189 page.pszHeaderTitle = MAKEINTRESOURCE(IDS_TITLE_LICENSE_JURISDICTION);
00190 return true;
00191 }