示例#1
0
void CReferenceDlg::OnSelchangeCombobook() 
{
	int nMaxChapter, nMaxVerse;
	CWnd* pWnd;
	CSpinButtonCtrl* pSpin;
	CReferenceUtils ref;

	UpdateData(TRUE);
	m_nBook=m_ncboBook+1;                //get the selected book
	nMaxChapter=ref.GetMaxChapter(m_nBook, m_nSourceText); //get num of chapters in book
	pSpin=(CSpinButtonCtrl*) GetDlgItem(IDC_SPINCHAPTER);
	pSpin->SetRange(1,nMaxChapter);       
	pSpin->SetPos(1);
	m_strChapter=L"1";
	pWnd=GetDlgItem(IDC_SPINCHAPTER);
	if (nMaxChapter==1) pWnd->EnableWindow(FALSE);    //if only one chapter in book, disable
	else pWnd->EnableWindow(TRUE);

	nMaxVerse=ref.GetMaxVerse(m_nBook,1, m_nSourceText, m_pDoc);   //get verses in first chapter
	pSpin=(CSpinButtonCtrl*) GetDlgItem(IDC_SPINVERSE);
	pSpin->SetRange(1,nMaxVerse);
	pSpin->SetPos(1);
	m_strVerse=L"1";
	pWnd=GetDlgItem(IDC_SPINVERSE);
	if (nMaxVerse==1) pWnd->EnableWindow(FALSE);    //if only one chapter in book, disable
	else pWnd->EnableWindow(TRUE);
	UpdateData(FALSE);
	m_nChapter=m_nVerse=1;	
}
BOOL C3DGORangeWire::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	CSpinButtonCtrl *pXint = (CSpinButtonCtrl*) GetDlgItem(IDC_X_INTERVAL_SPIN);
	pXint->SetRange(1, 10000);
	pXint->SetPos(m_XIntervals);	

	CSpinButtonCtrl *pYint = (CSpinButtonCtrl*) GetDlgItem(IDC_Y_INTERVAL_SPIN);
	pYint->SetRange(1, 10000);
	pYint->SetPos(m_YIntervals);	

	CSpinButtonCtrl *pWW = (CSpinButtonCtrl*) GetDlgItem(IDC_WIRE_WIDTH_SPIN);
	pWW->SetRange(1, 20);
	pWW->SetPos(m_WireWidth);	

	CSpinButtonCtrl *pWI = (CSpinButtonCtrl*) GetDlgItem(IDC_WIRE_SPACE_SPIN);
	if(m_XIntervals > m_YIntervals){
		m_max_interval = m_XIntervals;
		pWI->SetRange(1, m_XIntervals);
	}
	else{
		m_max_interval = m_YIntervals;
		pWI->SetRange(1, m_YIntervals);
	}
	pWI->SetPos(m_WireInterval);
	
	UpdateGraphMode();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
示例#3
0
void ExtFrame::SpinChanged(CSpinButtonCtrl& spin, CEdit& edit)
{
    CString str;
    edit.GetWindowText(str);
    if(str.GetLength() == 0)
    {
        spin.SetPos(0);
    }
    else
    {
        spin.SetPos(atoi(str));
    }
}
void C3DGORangeWire::OnChangeWireWidth() 
{
	CSpinButtonCtrl *pWW = (CSpinButtonCtrl*) GetDlgItem(IDC_WIRE_WIDTH_SPIN);
	m_WireWidth = GetDlgItemInt(IDC_WIRE_WIDTH);
	pWW->SetPos(m_WireWidth);
	SetModified(true);
}
示例#5
0
void CReferenceDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
	int nMaxVerse;
	wchar_t c[5];
	CSpinButtonCtrl* pSpin;
	CReferenceUtils ref;

	switch(pScrollBar->GetDlgCtrlID())
	{
		case IDC_SPINCHAPTER:
			pSpin=(CSpinButtonCtrl*) GetDlgItem(IDC_SPINCHAPTER);
			m_nChapter=pSpin->GetPos();
			_itow(m_nChapter,c,10);
			m_strChapter=c;
			nMaxVerse=ref.GetMaxVerse(m_nBook,m_nChapter, m_nSourceText, m_pDoc);
			pSpin=(CSpinButtonCtrl*) GetDlgItem(IDC_SPINVERSE);
			pSpin->SetRange(1,nMaxVerse);  //set the verse spinner's range
			pSpin->SetPos(1);                //select first verse
			m_nVerse=1;
			m_strVerse=L"1";
			break;
		case IDC_SPINVERSE:
			pSpin=(CSpinButtonCtrl*) GetDlgItem(IDC_SPINVERSE);
			m_nVerse=pSpin->GetPos();
			_itow(m_nVerse,c,10);
			m_strVerse=c;
			break;
	}
	UpdateData(FALSE);
}
示例#6
0
void ExtFrame::SetSpinValue(CSpinButtonCtrl& spin, CEdit& edit, int val, bool two)
{
    int rangeMin;
    int rangeMax;
    spin.GetRange32(rangeMin, rangeMax);
    if(val < rangeMin)
    {
        val = rangeMin;
    }
    else if(val > rangeMax)
    {
        val = rangeMax;
    }
    char num[33];
    if(two && val < 10)
    {
        *num = '0';
        _itoa_s(val, num + 1, sizeof(num) - 1, 10);
    }
    else
    {
        _itoa_s(val, num, sizeof(num), 10);
    }
    spin.SetPos(val);

    edit.SetWindowText(num);
}
示例#7
0
BOOL COptionsDisplay::OnInitDialog() 
{
  COptions_PropertyPage::OnInitDialog();

  for (int i = 0; i < 4; i++) {
    m_chkbox[i].SetTextColour(CR_DATABASE_OPTIONS);
    m_chkbox[i].ResetBkgColour();//Use current window's background
  }
  for (int i = 0; i < 3; i++) {
    m_radiobtn[i].SetTextColour(CR_DATABASE_OPTIONS);
    m_radiobtn[i].SetType(BS_AUTORADIOBUTTON);
    m_radiobtn[i].ResetBkgColour();//Use current window's background
  }

  if (m_ShowUsernameInTree == FALSE) {
    m_ShowPasswordInTree = FALSE;
    GetDlgItem(IDC_DEFPWSHOWINTREE)->EnableWindow(FALSE);
  }

  OnPreWarn();
  CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_PREWARNEXPIRYSPIN);

  pspin->SetBuddy(GetDlgItem(IDC_PREEXPIRYWARNDAYS));
  pspin->SetRange(1, 30);
  pspin->SetBase(10);
  pspin->SetPos(m_PreExpiryWarnDays);

  return TRUE;  // return TRUE unless you set the focus to a control
  // EXCEPTION: OCX Property Pages should return FALSE
}
示例#8
0
BOOL COptionsSecurity::OnInitDialog() 
{
  COptions_PropertyPage::OnInitDialog();

  for (int i = 0; i < 2; i++) {
    m_chkbox[i].SetTextColour(CR_DATABASE_OPTIONS);
    m_chkbox[i].ResetBkgColour();//Use current window's background
  }

  OnLockOnIdleTimeout();
  CSpinButtonCtrl *pspin;

  pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_IDLESPIN);
  pspin->SetBuddy(GetDlgItem(IDC_IDLE_TIMEOUT));
  pspin->SetRange(1, 120);
  pspin->SetBase(10);
  pspin->SetPos(m_IdleTimeOut);

  CSliderCtrl *pslider = (CSliderCtrl *)GetDlgItem(IDC_HASHITERSLIDER);
  pslider->SetRange(MinHIslider, MaxHIslider);
  pslider->SetTicFreq(1);
  pslider->SetPos(m_HashIterSliderValue);

  return TRUE;
}
示例#9
0
// CEmployeeModify 消息处理程序
BOOL CEmployeeModify::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化
	CSpinButtonCtrl* pSpin = (CSpinButtonCtrl *)GetDlgItem(IDC_SPIN_AGE);
	pSpin->SetRange(0,100);
	pSpin->SetPos(m_nAge);

	//
	pConn=mySql.openConnection(_com_util::ConvertStringToBSTR(m_strConn),"","",adOpenUnspecified);
	_RecordsetPtr pSet;
	try
	{
		pSet = mySql.getUserDetailsByUserId(m_strNo,pConn);
	}
	catch(_com_error e)
	{
		AfxMessageBox(e.Description());
	}
	if( !pSet->EndOfFile )
	{
		pSet->MoveFirst();
		m_strSex = (LPCTSTR)(_bstr_t)pSet->GetCollect(_variant_t("Sex"));
		m_nAge = atoi((_bstr_t)pSet->GetCollect(_variant_t("Age")));
		m_strPwd1 = m_strPwd2 = (LPCTSTR)(_bstr_t)pSet->GetCollect(_variant_t("Pwd"));
	}

	UpdateData(FALSE);

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
/*
	OnInitDialog()
*/
BOOL CWallBrowserOneParamDlg::OnInitDialog(void)
{
	CDialog::OnInitDialog();

	HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	SetIcon(hIcon,TRUE);
	SetIcon(hIcon,FALSE);
	
	SetDlgItemText(IDC_STATIC_PROPERTY,m_strProperty);
	SetDlgItemText(IDC_STATIC_OPERATION,m_strOperation);

	CSpinButtonCtrl *pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_VALUE);
	pSpin->SetRange((int)m_nMin,(int)m_nMax); 
	pSpin->SetPos((int)m_nDefaultValue);
	pSpin->SetBuddy(GetDlgItem(IDC_EDIT_VALUE));

	m_ctrlSlider.SetRangeMin((int)m_nMin,TRUE);
	m_ctrlSlider.SetRangeMax((int)m_nMax,TRUE);
	m_ctrlSlider.SetPos((int)m_nDefaultValue);

	CString strValue;
	strValue.Format("%d",(int)m_nMin);
	SetDlgItemText(IDC_STATIC_RANGE_MIN,strValue);
	strValue.Format("%d",(int)m_nMax);
	SetDlgItemText(IDC_STATIC_RANGE_MAX,strValue);

	UpdateData(FALSE);

	return(TRUE); 
}
void C3DGORangeWire::OnChangeWireInterval() 
{
	CSpinButtonCtrl *pWI = (CSpinButtonCtrl*) GetDlgItem(IDC_WIRE_SPACE_SPIN);
	m_WireInterval = GetDlgItemInt(IDC_WIRE_RES);
	pWI->SetPos(m_WireInterval);
	SetModified(true);
}
void C3DGORangeWire::OnChangeYInterval() 
{
	CSpinButtonCtrl *pYint = (CSpinButtonCtrl*) GetDlgItem(IDC_Y_INTERVAL_SPIN);
	m_YIntervals = GetDlgItemInt(IDC_Y_INTERVAL);
	pYint->SetPos(m_YIntervals);
	UpdateWireIntervalRange();
	SetModified(true);
}
void C3DGOAxes::OnChangeAxisWidth() 
{ 
	CSpinButtonCtrl *pAW = (CSpinButtonCtrl*) GetDlgItem(IDC_AXIS_WIDTH_SPIN);
	m_AxisWidth = GetDlgItemInt(IDC_AXIS_WIDTH);
	pAW->SetPos(m_AxisWidth);
	SetModified(true);
	SetEnabledFields(IsDlgButtonChecked(IDC_AXIS_ON));
}
示例#14
0
// Following copied from AddEdit_PasswordPolicy.cpp. Move to common mixin?
static void setupBuddy(CWnd *p, int spinid, int id, int &length, short min = 0)
{
  CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)p->GetDlgItem(spinid);
  pspin->SetBuddy(p->GetDlgItem(id));
  pspin->SetRange(min, 1024);
  pspin->SetBase(10);
  pspin->SetPos((int)length);
}
示例#15
0
void ExtFrame::IncrementSpin(CSpinButtonCtrl& spin, CEdit& edit, unsigned int val)
{
    char num[33];
    _ultoa_s(val, num, sizeof(num), 10);
    spin.SetPos(val);
    edit.SetWindowText(num);
    ScrollEnd(edit);
}   
示例#16
0
BOOL CInstrumentEditorDPCM::OnInitDialog()
{
	CInstrumentEditPanel::OnInitDialog();

	CString Text;

	m_iOctave = 3;
	m_iSelectedKey = 0;

	CComboBox *pPitch  = reinterpret_cast<CComboBox*>(GetDlgItem(IDC_PITCH));
	CComboBox *pOctave = reinterpret_cast<CComboBox*>(GetDlgItem(IDC_OCTAVE));

	m_pTableListCtrl = reinterpret_cast<CListCtrl*>(GetDlgItem(IDC_TABLE));
	m_pTableListCtrl->DeleteAllItems();
	m_pTableListCtrl->InsertColumn(0, _T("Key"), LVCFMT_LEFT, 30);
	m_pTableListCtrl->InsertColumn(1, _T("Pitch"), LVCFMT_LEFT, 35);
	m_pTableListCtrl->InsertColumn(2, _T("Sample"), LVCFMT_LEFT, 90);
	m_pTableListCtrl->SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);

	m_pSampleListCtrl = reinterpret_cast<CListCtrl*>(GetDlgItem(IDC_SAMPLE_LIST));
	m_pSampleListCtrl->DeleteAllItems();
	m_pSampleListCtrl->InsertColumn(0, _T("#"), LVCFMT_LEFT, 22);
	m_pSampleListCtrl->InsertColumn(1, _T("Name"), LVCFMT_LEFT, 88);
	m_pSampleListCtrl->InsertColumn(2, _T("Size"), LVCFMT_LEFT, 39);
	m_pSampleListCtrl->SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);

	for (int i = 0; i < 16; ++i) {
		Text.Format(_T("%i"), i);
		pPitch->AddString(Text);
	}

	pPitch->SetCurSel(15);

	for (int i = 0; i < OCTAVE_RANGE; ++i) {
		Text.Format(_T("%i"), i);
		pOctave->AddString(Text);
	}

	pOctave->SetCurSel(3);
	CheckDlgButton(IDC_LOOP, 0);
	m_pTableListCtrl->DeleteAllItems();

	for (int i = 0; i < 12; ++i)
		m_pTableListCtrl->InsertItem(i, KEY_NAMES[i], 0);

	BuildSampleList();
	m_iSelectedSample = 0;

	CSpinButtonCtrl *pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_DELTA_SPIN);
	pSpin->SetRange(-1, 127);
	pSpin->SetPos(-1);

	SetDlgItemText(IDC_DELTA_COUNTER, _T("Off"));

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
void CInstrumentEditorN163Wave::SelectInstrument(int Instrument)
{
	m_pInstrument = (CInstrumentN163*)GetDocument()->GetInstrument(Instrument);

	CComboBox *pSizeBox = (CComboBox*)GetDlgItem(IDC_WAVE_SIZE);
	CComboBox *pPosBox = (CComboBox*)GetDlgItem(IDC_WAVE_POS);

	CString SizeStr;
	SizeStr.Format(_T("%i"), m_pInstrument->GetWaveSize());
	pSizeBox->SelectString(0, SizeStr);

	FillPosBox(m_pInstrument->GetWaveSize());

	CString PosStr;
	PosStr.Format(_T("%i"), m_pInstrument->GetWavePos());
	pPosBox->SetWindowText(PosStr);

	/*
	if (m_pInstrument->GetAutoWavePos()) {
		CheckDlgButton(IDC_POSITION, 1);
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(FALSE);
	}
	else {
		CheckDlgButton(IDC_POSITION, 0);
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(TRUE);
	}
	*/

	if (m_pWaveEditor) {
		m_pWaveEditor->SetInstrument(m_pInstrument);
		m_pWaveEditor->SetLength(m_pInstrument->GetWaveSize());
	}

	CSpinButtonCtrl *pIndexSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_INDEX_SPIN);
	CSpinButtonCtrl *pWavesSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_WAVES_SPIN);

	int WaveCount = m_pInstrument->GetWaveCount();

	pIndexSpin->SetRange(0, WaveCount - 1);
	pIndexSpin->SetPos(0);
	pWavesSpin->SetPos(WaveCount - 1);

	m_iWaveIndex = 0;
}
示例#18
0
BOOL CGrid::OnInitDialog() {
	CDialog::OnInitDialog();

	CSpinButtonCtrl* pSpin = (CSpinButtonCtrl*) GetDlgItem(IDC_SPIN_GRID_SIZE);
	pSpin->SetRange(2, 20);
	if ((m_GridSize < 2) || (m_GridSize > 20))
		m_GridSize = The_grid->ncols / 5;
	pSpin->SetPos(m_GridSize);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL C3DGOAxes::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();

	CSpinButtonCtrl *pAW = (CSpinButtonCtrl*) GetDlgItem(IDC_AXIS_WIDTH_SPIN);
	pAW->SetRange(1, 20);
	pAW->SetPos(m_AxisWidth);

	SetEnabledFields(m_AxisOn);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
BOOL COptionsBackup::OnInitDialog()
{
  COptions_PropertyPage::OnInitDialog();

  m_chkbox.SetTextColour(CR_DATABASE_OPTIONS);
  m_chkbox.ResetBkgColour(); //Use current window's background

  if (!GetMainDlg()->IsDBReadOnly())
    GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->ShowWindow(SW_HIDE);

  if (m_backupsuffix_cbox.GetCount() == 0) {
    // add the strings in alphabetical order
    CString cs_text(MAKEINTRESOURCE(IDS_NONE));
    int nIndex;
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_None);
    m_BKSFX_to_Index[PWSprefs::BKSFX_None] = nIndex;

    cs_text.LoadString(IDS_DATETIMESTRING);
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_DateTime);
    m_BKSFX_to_Index[PWSprefs::BKSFX_DateTime] = nIndex;

    cs_text.LoadString(IDS_INCREMENTNUM);
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_IncNumber);
    m_BKSFX_to_Index[PWSprefs::BKSFX_IncNumber] = nIndex;
  }

  m_backupsuffix_cbox.SetCurSel(m_BKSFX_to_Index[m_BackupSuffix]);

  GetDlgItem(IDC_BACKUPEXAMPLE)->SetWindowText(L"");

  CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_BKPMAXINCSPIN);

  pspin->SetBuddy(GetDlgItem(IDC_BACKUPMAXINC));
  pspin->SetRange(1, 999);
  pspin->SetBase(10);
  pspin->SetPos(m_MaxNumIncBackups);

  OnComboChanged();
  OnBackupBeforeSave();

  InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 4);
  // Note naming convention: string IDS_xxx corresponds to control IDC_xxx
  AddTool(IDC_BACKUPBEFORESAVE,        IDS_BACKUPBEFORESAVE);
  AddTool(IDC_USERBACKUPOTHERLOCATION, IDS_USERBACKUPOTHERLOCATION);
  ActivateToolTip();

  return TRUE;
}
示例#21
0
void CInstrumentEditorDPCM::OnNMClickTable(NMHDR *pNMHDR, LRESULT *pResult)
{
	CSpinButtonCtrl *pSpinButton;
	CComboBox *pSampleBox, *pPitchBox;
	CEdit *pDeltaValue;
	CString Text;

	m_pTableListCtrl	= reinterpret_cast<CListCtrl*>(GetDlgItem(IDC_TABLE));
	m_iSelectedKey		= m_pTableListCtrl->GetSelectionMark();

	int Sample			= m_pInstrument->GetSample(m_iOctave, m_iSelectedKey) - 1;
	int Pitch			= m_pInstrument->GetSamplePitch(m_iOctave, m_iSelectedKey);
	int Delta			= m_pInstrument->GetSampleDeltaValue(m_iOctave, m_iSelectedKey);

	m_pTableListCtrl	= static_cast<CListCtrl*>(GetDlgItem(IDC_TABLE));
	pSampleBox			= static_cast<CComboBox*>(GetDlgItem(IDC_SAMPLES));
	pPitchBox			= static_cast<CComboBox*>(GetDlgItem(IDC_PITCH));
	pDeltaValue			= static_cast<CEdit*>(GetDlgItem(IDC_DELTA_COUNTER));
	pSpinButton			= static_cast<CSpinButtonCtrl*>(GetDlgItem(IDC_DELTA_SPIN));

	Text.Format(_T("%02i - %s"), Sample, (LPCTSTR)m_pTableListCtrl->GetItemText(m_pTableListCtrl->GetSelectionMark(), 2));

	if (Sample != -1)
		pSampleBox->SelectString(0, Text);
	else
		pSampleBox->SetCurSel(0);
	
	if (Sample >= 0) {
		pPitchBox->SetCurSel(Pitch & 0x0F);

		if (Pitch & 0x80)
			CheckDlgButton(IDC_LOOP, 1);
		else
			CheckDlgButton(IDC_LOOP, 0);

		if (Delta == -1)
			pDeltaValue->SetWindowText(_T("Off"));
		else
			SetDlgItemInt(IDC_DELTA_COUNTER, Delta, FALSE);

		pSpinButton->SetPos(Delta);
	}

	*pResult = 0;
}
示例#22
0
BOOL COptionsMisc::OnInitDialog() 
{
  COptions_PropertyPage::OnInitDialog();

  for (int i = 0; i < 2; i++) {
    m_chkbox[i].SetTextColour(CR_DATABASE_OPTIONS);
    m_chkbox[i].ResetBkgColour();//Use current window's background
  }

  OnUseDefUser();

  // For some reason, MFC calls us twice when initializing.
  // Populate the combo box only once.
  if (m_dblclk_cbox.GetCount() == 0) {
    SetupCombo(&m_dblclk_cbox);
  }

  if (m_shiftdblclk_cbox.GetCount() == 0) {
    SetupCombo(&m_shiftdblclk_cbox);
  }

  m_dblclk_cbox.SetCurSel(m_DCA_to_Index[m_DoubleClickAction]);
  m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[m_ShiftDoubleClickAction]);

  GetDlgItem(IDC_OTHERBROWSERLOCATION)->SetWindowText(m_OtherBrowserLocation);
  GetDlgItem(IDC_OTHEREDITORLOCATION)->SetWindowText(m_OtherEditorLocation);

  CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_DADSPIN);

  pspin->SetBuddy(GetDlgItem(IDC_DB_DEF_AUTOTYPE_DELAY));
  pspin->SetRange32(1, 60000);
  pspin->SetBase(10);
  pspin->SetPos(m_AutotypeDelay);

  InitToolTip();
  // Note naming convention: string IDS_xxx corresponds to control IDC_xxx
  AddTool(IDC_MAINTAINDATETIMESTAMPS, IDS_MAINTAINDATETIMESTAMPS);
  AddTool(IDC_OTHERBROWSERLOCATION,   IDS_OTHERBROWSERLOCATION);
  AddTool(IDC_OTHEREDITORLOCATION,    IDS_OTHEREDITORLOCATION);
  ActivateToolTip();

  return TRUE;
}
/*
void CInstrumentEditorN163Wave::OnPositionClicked()
{
	if (IsDlgButtonChecked(IDC_POSITION)) {
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(FALSE);
		m_pInstrument->SetAutoWavePos(true);
	}
	else {
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(TRUE);
		m_pInstrument->SetAutoWavePos(false);
	}
}
*/
void CInstrumentEditorN163Wave::OnWavesChange()
{
	CSpinButtonCtrl *pIndexSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_INDEX_SPIN);

	int count = GetDlgItemInt(IDC_WAVES) + 1;
	
	if (m_pInstrument != NULL)
		m_pInstrument->SetWaveCount(count);

	pIndexSpin->SetRange(0, count - 1);
	pIndexSpin->RedrawWindow();

	if (pIndexSpin->GetPos() > (count - 1))
		pIndexSpin->SetPos(count - 1);

	if (m_pWaveEditor != NULL) {
		m_pWaveEditor->SetWave(m_iWaveIndex);
		m_pWaveEditor->WaveChanged();
	}
}
/*
	OnInitDialog()
*/
BOOL CWallPaperDrawSettingsAlphaDlg::OnInitDialog(void)
{
	// classe base
	CPropertyPage::OnInitDialog();

	// imposta lo spin button per la trasparenza
	CSpinButtonCtrl* pSpin;
	pSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_LAYERED);
	pSpin->SetRange(LWA_ALPHA_INVISIBLE,LWA_ALPHA_OPAQUE);
	pSpin->SetPos(m_nLayered);
	pSpin->SetBuddy(GetDlgItem(IDC_EDIT_LAYERED));

	// abilita i controlli
	GetDlgItem(IDC_CHECK_LAYERED)->EnableWindow(m_enumOsVer==WINDOWS_2000 || m_enumOsVer==WINDOWS_XP || m_enumOsVer==WINDOWS_VISTA || m_enumOsVer==WINDOWS_SEVEN);
	GetDlgItem(IDC_STATIC_LAYERED)->EnableWindow(m_enumOsVer==WINDOWS_2000 || m_enumOsVer==WINDOWS_XP || m_enumOsVer==WINDOWS_VISTA || m_enumOsVer==WINDOWS_SEVEN);
	GetDlgItem(IDC_EDIT_LAYERED)->EnableWindow(m_bLayered);
	GetDlgItem(IDC_SPIN_LAYERED)->EnableWindow(m_bLayered);

	char szBuffer[2048] = {"The transparency effect requires Windows 2000 or higher, currently you are running on:\r\n\r\n"};
	int n = strlen(szBuffer)-1;
	m_winVer.GetPlatformInfo(szBuffer+n,sizeof(szBuffer)-n);
	GetDlgItem(IDC_STATIC_OS)->SetWindowText(szBuffer);

	CString strLayered;
	strLayered.Format("(%d = invisible, %d = opaque)",LWA_ALPHA_INVISIBLE,LWA_ALPHA_OPAQUE);
	SetDlgItemText(IDC_STATIC_LAYERED,strLayered);

	// aggiunge i tooltips
	if(m_Tooltip.Create(this,TTS_ALWAYSTIP))
	{
		m_Tooltip.SetWidth(TOOLTIP_REASONABLE_WIDTH);
		m_Tooltip.SetDelay(TOOLTIP_REASONABLE_DELAYTIME);
		m_Tooltip.AddTooltip(GetDlgItem(IDC_CHECK_LAYERED),IDC_CHECK_LAYERED,IDS_TOOLTIP_OPTIONS_DRAW_TRANSPARENCY);
		m_Tooltip.AddTooltip(GetDlgItem(IDC_EDIT_LAYERED),IDC_EDIT_LAYERED,IDS_TOOLTIP_OPTIONS_DRAW_TRANSPARENCYVALUE);
		m_Tooltip.AddTooltip(GetDlgItem(IDC_SPIN_LAYERED),IDC_SPIN_LAYERED,IDS_TOOLTIP_OPTIONS_DRAW_TRANSPARENCYVALUE);
	}

	UpdateData(FALSE);

	return(FALSE);
}
示例#25
0
void CPage_Status::Display()
{
	if (*m_ppbFile == NULL) return;

	PBYTE pbMSFI = (PBYTE)&m_pMsFileInfo->HPMax;
	for (WORD nID = IDC_STATUS_HP_UP; nID != IDC_STATUS_HP_DEF + 1; ++nID)
	{
		SetDlgItemInt(nID, *(DWORD *)pbMSFI);
		pbMSFI += sizeof(DWORD);
	}

	for (WORD nID = IDC_STATUS_EP_UP; nID != IDC_STATUS_RNG + 1; ++nID)
	{
		SetDlgItemInt(nID, *(WORD *)pbMSFI);
		pbMSFI += sizeof(WORD);
	}

	CSpinButtonCtrl *pSpin;
	for (WORD nID = 0; nID != 7; ++nID)
	{
		pSpin = ((CSpinButtonCtrl *)GetDlgItem(IDC_STATUS_CHI_SPIN + nID));
		pSpin->SetPos(m_pMsFileInfo->ConditionGuard[nID]);
	}
}
示例#26
0
BOOL COptionsSystem::OnInitDialog() 
{
  COptions_PropertyPage::OnInitDialog();

  PWSprefs *prefs = PWSprefs::GetInstance();
  if (!m_bShowConfigFile) {
    GetDlgItem(IDC_STATIC_CONFIGFILE)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_STATIC_RWSTATUS)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_CONFIGFILE)->ShowWindow(SW_HIDE);
  } else {
    PWSprefs::ConfigOption configoption;
    std::wstring wsCF = prefs->GetConfigFile(configoption);
    std::wstring wsCO(L"");
    switch (configoption) {
      case PWSprefs::CF_NONE:
        LoadAString(wsCF, IDS_NONE);
        break;
      case PWSprefs::CF_REGISTRY:
        LoadAString(wsCF, IDS_REGISTRY);
        break;
      case PWSprefs::CF_FILE_RO:
        LoadAString(wsCO, IDS_READ_ONLY);
        break;
      case PWSprefs::CF_FILE_RW:
      case PWSprefs::CF_FILE_RW_NEW:
        LoadAString(wsCO, IDS_READ_WRITE);
        break;
      default:
        ASSERT(0);
    }
    GetDlgItem(IDC_CONFIGFILE)->SetWindowText(wsCF.c_str());
    GetDlgItem(IDC_STATIC_RWSTATUS)->SetWindowText(wsCO.c_str());
  }

  bool bofferdeleteregistry = prefs->OfferDeleteRegistry();

  bool boffermigrate2appdata = OfferConfigMigration();

  if (!bofferdeleteregistry) {
    GetDlgItem(IDC_REGDEL)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_REGDEL)->EnableWindow(FALSE);
  }

  if (!boffermigrate2appdata) {
    GetDlgItem(IDC_MIGRATETOAPPDATA)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_MIGRATETOAPPDATA)->EnableWindow(FALSE);
  }

  if (!bofferdeleteregistry && !boffermigrate2appdata) {
    GetDlgItem(IDC_CONFIG_GRP)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_APPLYCONFIGCHANGES)->ShowWindow(SW_HIDE);
  } else {
    GetDlgItem(IDC_APPLYCONFIGCHANGES)->ShowWindow(SW_SHOW);
  }

  GetDlgItem(IDC_APPLYCONFIGCHANGES)->EnableWindow(FALSE);

  CSpinButtonCtrl *pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_RESPIN);

  pspin->SetBuddy(GetDlgItem(IDC_MAXREITEMS));
  pspin->SetRange(0, ID_TRAYRECENT_ENTRYMAX - ID_TRAYRECENT_ENTRY1 + 1);
  pspin->SetBase(10);
  pspin->SetPos(m_MaxREItems);

  pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_MRUSPIN);

  pspin->SetBuddy(GetDlgItem(IDC_MAXMRUITEMS));
  pspin->SetRange(0, ID_FILE_MRU_ENTRYMAX - ID_FILE_MRU_ENTRY1 + 1);
  pspin->SetBase(10);
  pspin->SetPos(m_MaxMRUItems);

  OnUseSystemTray();

  InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 2);
  AddTool(IDC_REGDEL,           IDS_REGDEL);
  AddTool(IDC_MIGRATETOAPPDATA, IDS_MIGRATETOAPPDATA);
  ActivateToolTip();

  return TRUE;  // return TRUE unless you set the focus to a control
  // EXCEPTION: OCX Property Pages should return FALSE
}
/*
	OnInitDialog()
*/
BOOL CWallBrowserTwoParamsDlg::OnInitDialog(void)
{
	CDialog::OnInitDialog();

	HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	SetIcon(hIcon,TRUE);
	SetIcon(hIcon,FALSE);

	SetDlgItemText(IDC_STATIC_PROPERTY,m_strProperty);

	CSpinButtonCtrl* pSpinFirst = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_VALUE);
	pSpinFirst->SetRange(m_nFirstMin,m_nFirstMax); 
	pSpinFirst->SetPos(m_nFirstDefaultValue);
	pSpinFirst->SetBuddy(GetDlgItem(IDC_EDIT_VALUE));

	if(m_strSubOperation=="Halftone")
	{
		m_CComboSubValue.AddString("print");		// HT_PRINT
		m_CComboSubValue.AddString("display");		// HT_VIEW
	}
	else if(m_strSubOperation=="Emboss")
	{
		m_CComboSubValue.AddString("north");		// EMBOSS_N
		m_CComboSubValue.AddString("north/east");	// EMBOSS_NE
		m_CComboSubValue.AddString("east");		// EMBOSS_E
		m_CComboSubValue.AddString("south/east");	// EMBOSS_SE
		m_CComboSubValue.AddString("south");		// EMBOSS_S
		m_CComboSubValue.AddString("south/west");	// EMBOSS_SW
		m_CComboSubValue.AddString("west");		// EMBOSS_W
		m_CComboSubValue.AddString("north/west");	// EMBOSS_NW
	}
	else if(m_strSubOperation=="Noise")
	{
		m_CComboSubValue.AddString("all channels");	// NOISE_CHANNEL_MASTER
		m_CComboSubValue.AddString("red channel");	// NOISE_CHANNEL_RED
		m_CComboSubValue.AddString("green channel");	// NOISE_CHANNEL_GREEN
		m_CComboSubValue.AddString("blue channel");	// NOISE_CHANNEL_BLUE
	}
	else
		m_bHaveCombo = FALSE;

	CString str;
	str.Format("%s (%d/%d)",m_strOperation,m_nFirstMin,m_nFirstMax);
	SetDlgItemText(IDC_STATIC_OPERATION,str);

	if(m_bHaveCombo)
	{
		SetDlgItemText(IDC_STATIC_SUBOPERATION,m_strSubOperation);
		GetDlgItem(IDC_EDIT_SUBVALUE)->EnableWindow(FALSE);
		GetDlgItem(IDC_EDIT_SUBVALUE)->ShowWindow(SW_HIDE);
		GetDlgItem(IDC_SPIN_SUBVALUE)->EnableWindow(FALSE);
		GetDlgItem(IDC_SPIN_SUBVALUE)->ShowWindow(SW_HIDE);
		m_CComboSubValue.SetCurSel(0);
	}
	else
	{
		str.Format("%s (%d/%d)",m_strSubOperation,m_nSecondMin,m_nSecondMax);
		SetDlgItemText(IDC_STATIC_SUBOPERATION,str);
		GetDlgItem(IDC_COMBO_SUBVALUE)->EnableWindow(FALSE);
		GetDlgItem(IDC_COMBO_SUBVALUE)->ShowWindow(SW_HIDE);
		CSpinButtonCtrl *pSpinSecond = (CSpinButtonCtrl*)GetDlgItem(IDC_SPIN_SUBVALUE);
		pSpinSecond->SetRange(m_nSecondMin,m_nSecondMax); 
		pSpinFirst->SetPos(m_nSecondDefaultValue);
		pSpinSecond->SetBuddy(GetDlgItem (IDC_EDIT_SUBVALUE));
	}

	UpdateData(FALSE);

	return(TRUE); 
}
BOOL CAddEdit_Additional::OnInitDialog()
{
  CAddEdit_PropertyPage::OnInitDialog();

  ModifyStyleEx(0, WS_EX_CONTROLPARENT);

  m_stc_warning.SetColour(RGB(255, 0, 0));
  m_stc_warning.ShowWindow(SW_HIDE);

  CString cs_dats;
  StringX sx_dats = PWSprefs::GetInstance()->
                           GetPref(PWSprefs::DefaultAutotypeString);
  if (sx_dats.empty())
    cs_dats = DEFAULT_AUTOTYPE;
  else
    cs_dats.Format(IDS_DEFAULTAUTOTYPE, sx_dats.c_str());

  GetDlgItem(IDC_DEFAULTAUTOTYPE)->SetWindowText(cs_dats);

  if (M_uicaller() != IDS_ADDENTRY) {
    InitToolTip();
    AddTool(IDC_STATIC_AUTO, IDS_CLICKTOCOPYEXPAND);
    AddTool(IDC_STATIC_RUNCMD, IDS_CLICKTOCOPYEXPAND);
    AddTool(IDC_ENTKBSHCTHOTKEY, IDS_KBS_TOOLTIP0);
    ActivateToolTip();

    m_stc_autotype.SetHighlight(true, CAddEdit_PropertyPage::crefWhite);
    m_stc_runcommand.SetHighlight(true, CAddEdit_PropertyPage::crefWhite);
  }

  m_KBShortcutCtrl.SetMyParent(this);

  // These wil be zero for Add entry
  WORD wVirtualKeyCode = M_KBShortcut() & 0xff;
  WORD wPWSModifiers = M_KBShortcut() >> 16;

  // Translate from PWS to CHotKeyCtrl modifiers
  WORD wHKModifiers = ConvertModifersPWS2MFC(wPWSModifiers);

  m_KBShortcutCtrl.SetHotKey(wVirtualKeyCode, wHKModifiers);

  // We could do this to ensure user has at least Alt or Ctrl key
  // But it gets changed without the user knowing - so we do it elsewhere
  // instead and tell them.
  //m_KBShortcutCtrl.SetRules(HKCOMB_NONE | HKCOMB_S, HOTKEYF_ALT);

  if (M_uicaller() == IDS_VIEWENTRY || M_protected() != 0) {
    // Disable normal Edit controls
    GetDlgItem(IDC_AUTOTYPE)->SendMessage(EM_SETREADONLY, TRUE, 0);
    GetDlgItem(IDC_RUNCMD)->SendMessage(EM_SETREADONLY, TRUE, 0);

    // Disable HotKey
    m_KBShortcutCtrl.EnableWindow(FALSE);

    // Disable Combobox
    GetDlgItem(IDC_DOUBLE_CLICK_ACTION)->EnableWindow(FALSE);
    GetDlgItem(IDC_SHIFT_DOUBLE_CLICK_ACTION)->EnableWindow(FALSE);
  }

  // For some reason, MFC calls us twice when initializing.
  // SetupDCAComboBoxes is idempotent
  SetupDCAComboBoxes(&m_dblclk_cbox, false);
  SetupDCAComboBoxes(&m_shiftdblclk_cbox, true);

  short iDCA;
  if (M_DCA() < PWSprefs::minDCA || M_DCA() > PWSprefs::maxDCA)
    iDCA = (short)PWSprefs::GetInstance()->GetPref(PWSprefs::DoubleClickAction);
  else
    iDCA = M_DCA();
  m_dblclk_cbox.SetCurSel(m_DCA_to_Index[iDCA]);

  if (M_ShiftDCA() < PWSprefs::minDCA || M_ShiftDCA() > PWSprefs::maxDCA)
    iDCA = (short)PWSprefs::GetInstance()->GetPref(PWSprefs::ShiftDoubleClickAction);
  else
    iDCA = M_ShiftDCA();
  m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[iDCA]);

  // Password History
  M_oldMaxPWHistory() = M_MaxPWHistory();

  GetDlgItem(IDC_MAXPWHISTORY)->EnableWindow(M_SavePWHistory());

  CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_PWHSPIN);

  pspin->SetBuddy(GetDlgItem(IDC_MAXPWHISTORY));
  pspin->SetRange(1, 255);
  pspin->SetBase(10);
  pspin->SetPos((int)M_MaxPWHistory());

  if (M_uicaller() == IDS_ADDENTRY) {
    GetDlgItem(IDC_CLEAR_PWHIST)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_PWHISTORY_LIST)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_PWH_COPY_ALL)->ShowWindow(SW_HIDE);
    GetDlgItem(IDC_STATIC_PWH_EDIT)->ShowWindow(SW_HIDE);
    UpdateData(FALSE);
    m_bInitdone = true;
    return TRUE;
  }

  GetDlgItem(IDC_STATIC_PWH_ADD)->ShowWindow(SW_HIDE);

  BOOL bpwh_count = M_pwhistlist().empty() ? FALSE : TRUE;
  GetDlgItem(IDC_CLEAR_PWHIST)->EnableWindow(bpwh_count);
  GetDlgItem(IDC_PWHISTORY_LIST)->EnableWindow(bpwh_count);
  GetDlgItem(IDC_PWH_COPY_ALL)->EnableWindow(bpwh_count);

  if (M_uicaller() == IDS_VIEWENTRY || M_protected() != 0) {
    GetDlgItem(IDC_MAXPWHISTORY)->EnableWindow(FALSE);
    GetDlgItem(IDC_PWHSPIN)->EnableWindow(FALSE);
    GetDlgItem(IDC_SAVE_PWHIST)->EnableWindow(FALSE);
    GetDlgItem(IDC_CLEAR_PWHIST)->EnableWindow(FALSE);
  }

  m_PWHistListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT);
  m_PWHistListCtrl.UpdateRowHeight(false);
  CString cs_text;
  cs_text.LoadString(IDS_SETDATETIME);
  m_PWHistListCtrl.InsertColumn(0, cs_text);
  cs_text.LoadString(IDS_PASSWORD);
  m_PWHistListCtrl.InsertColumn(1, cs_text);

  PWHistList::iterator iter;
  DWORD nIdx;
  for (iter = M_pwhistlist().begin(), nIdx = 0;
       iter != M_pwhistlist().end(); iter++, nIdx++) {
    int nPos = 0;
    const PWHistEntry pwhentry = *iter;
    if (pwhentry.changetttdate != 0) {
      const StringX locTime = PWSUtil::ConvertToDateTimeString(pwhentry.changetttdate,
                                                               PWSUtil::TMC_LOCALE);
      nPos = m_PWHistListCtrl.InsertItem(nPos, locTime.c_str());
    } else {
      cs_text.LoadString(IDS_UNKNOWN);
      cs_text.Trim();
      nPos = m_PWHistListCtrl.InsertItem(nPos, cs_text);
    }
    m_PWHistListCtrl.SetItemText(nPos, 1, pwhentry.password.c_str());
    m_PWHistListCtrl.SetItemData(nPos, nIdx);
  }

  m_PWHistListCtrl.SetRedraw(FALSE);
  for (int i = 0; i < 2; i++) {
    m_PWHistListCtrl.SetColumnWidth(i, LVSCW_AUTOSIZE);
    int nColumnWidth = m_PWHistListCtrl.GetColumnWidth(i);
    m_PWHistListCtrl.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);
    int nHeaderWidth = m_PWHistListCtrl.GetColumnWidth(i);
    m_PWHistListCtrl.SetColumnWidth(i, max(nColumnWidth, nHeaderWidth));
  }
  m_PWHistListCtrl.SetRedraw(TRUE);

  wchar_t buffer[10];
  swprintf_s(buffer, 10, L"%lu", M_NumPWHistory());

  if (M_original_entrytype() == CItemData::ET_ALIAS) {
    GetDlgItem(IDC_MAXPWHISTORY)->EnableWindow(FALSE);
    GetDlgItem(IDC_PWHSPIN)->EnableWindow(FALSE);
    GetDlgItem(IDC_SAVE_PWHIST)->EnableWindow(FALSE);
    GetDlgItem(IDC_CLEAR_PWHIST)->EnableWindow(FALSE);
    GetDlgItem(IDC_STATIC_OLDPW1)->EnableWindow(FALSE);
  }

  m_stc_warning.SetColour(RGB(255, 0, 0));
  m_stc_warning.ShowWindow(SW_HIDE);
  UpdateData(FALSE);
  m_bInitdone = true;
  return TRUE;
}
示例#29
0
void COpPropertyDlg::updateData ()
{
	// Operator name
	SetWindowText (theApp.getOperatorName (const_cast<ITexGenOperator*>(_Op)->getClassName().c_str()));

	// Update each widget
	// Create each widget
	uint i;
	for (i=0; i<_Op->getNumParameter(); i++)
	{
		// The parameter
		const CParameter &param = _Op->getParameter(i);

		// Type ?
		if (Widgets[i])
		{
			switch (param.Type)
			{
			case CParameter::TypeEnum:
				{
					if (param.EnumString)
					{
						CExtComboBox *comboBox = (CExtComboBox*)Widgets[i];
						comboBox->SetCurSel(param.Integer);
					}
				}
				break;
			case CParameter::TypeColor:
				{
					CColorBox *colorBox = (CColorBox*)Widgets[i];
					colorBox->setColor(getColorRef(param.Color));
				}
				break;
			case CParameter::TypeGradient:
				{
					CGradientRectWnd *gradientWnd = (CGradientRectWnd*)Widgets[i];
					gradientWnd->setGradient(param.Gradient);
				}
				break;
			case CParameter::TypeFloat:
				{
					/* CSliderCtrl *spinner = (CSliderCtrl*)Widgets[i];
					spinner->SetPos((int)(param.Color[0]*(float)SPINNER_MAX));					*/

					CRotButton *rotButton = (CRotButton*)Widgets[i];
					rotButton->setValue (param.Value);
				}
				break;
			case CParameter::TypeInt:
				{
					char number[100];
					Widgets[i]->GetWindowText (number, 100);
					int oldValue = atoi(number);
					if ((oldValue != param.Integer) || (number[0] == 0))
					{
						itoa(param.Integer, number, 10);
						Widgets[i]->SendMessage(WM_SETTEXT, 0, (LPARAM)number);
					}

					uint j;
					for (j=0; j<Others.size(); j++)
					{
						if (Others[j]->GetDlgCtrlID() == (sint)(i + FirstID))
						{
							CSpinButtonCtrl *spin = (CSpinButtonCtrl*)Others[j];
							spin->SetPos (param.Integer);
						}
					}
				}
				break;
			case CParameter::TypeBool:
				{
					((CExtBtnOnFlat*)(Widgets[i]))->SetCheck(param.Integer);
				}
				break;
			case CParameter::TypeString:
				{
					CString text;
					Widgets[i]->GetWindowText (text);
					if ((const char*)text != param.StringValue)
					{
						Widgets[i]->SendMessage(WM_SETTEXT, 0, (LPARAM)param.StringValue.c_str());
					}
				}
				break;
			}
		}
	}

	// Update
	UpdateData (FALSE);
}
示例#30
0
BOOL COptionsBackup::OnInitDialog()
{
  COptions_PropertyPage::OnInitDialog();

  m_chkbox.SetTextColour(CR_DATABASE_OPTIONS);
  m_chkbox.ResetBkgColour(); //Use current window's background

  if (GetMainDlg()->IsDBOpen() && !GetMainDlg()->IsDBReadOnly()) {
    GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->ShowWindow(SW_HIDE);
  }

  // Database preferences - can't change in R/O mode of if no DB is open
  if (!GetMainDlg()->IsDBOpen() || GetMainDlg()->IsDBReadOnly()) {
    CString cs_Preference_Warning;
    CString cs_temp(MAKEINTRESOURCE(GetMainDlg()->IsDBOpen() ? IDS_DB_READ_ONLY : IDS_NO_DB));

    cs_Preference_Warning.Format(IDS_STATIC_DB_PREFS_RO_WARNING, static_cast<LPCWSTR>(cs_temp));
    GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->SetWindowText(cs_Preference_Warning);

    GetDlgItem(IDC_SAVEIMMEDIATELY)->EnableWindow(FALSE);
  }

  if (m_backupsuffix_cbox.GetCount() == 0) {
    // add the strings in alphabetical order
    CString cs_text(MAKEINTRESOURCE(IDS_NONE));
    int nIndex;
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_None);
    m_BKSFX_to_Index[PWSprefs::BKSFX_None] = nIndex;

    cs_text.LoadString(IDS_DATETIMESTRING);
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_DateTime);
    m_BKSFX_to_Index[PWSprefs::BKSFX_DateTime] = nIndex;

    cs_text.LoadString(IDS_INCREMENTNUM);
    nIndex = m_backupsuffix_cbox.AddString(cs_text);
    m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_IncNumber);
    m_BKSFX_to_Index[PWSprefs::BKSFX_IncNumber] = nIndex;
  }

  m_backupsuffix_cbox.SetCurSel(m_BKSFX_to_Index[m_BackupSuffix]);

  GetDlgItem(IDC_BACKUPEXAMPLE)->SetWindowText(L"");

  CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_BKPMAXINCSPIN);

  pspin->SetBuddy(GetDlgItem(IDC_BACKUPMAXINC));
  pspin->SetRange(1, 999);
  pspin->SetBase(10);
  pspin->SetPos(m_MaxNumIncBackups);

  OnComboChanged();
  OnBackupBeforeSave();

  if (m_BackupLocation == 1) {
    ExpandBackupPath();
  }

  if (InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 0)) {
    m_Help1.Init(IDB_QUESTIONMARK);
    m_Help2.Init(IDB_QUESTIONMARK);
    m_Help3.Init(IDB_QUESTIONMARK);
    m_Help4.Init(IDB_QUESTIONMARK);

    // Note naming convention: string IDS_xxx corresponds to control IDC_xxx_HELP
    AddTool(IDC_BACKUPBEFORESAVEHELP, IDS_BACKUPBEFORESAVE);
    AddTool(IDC_USERBACKUPOTHERLOCATIONHELP, IDS_USERBACKUPOTHERLOCATION);
    AddTool(IDC_USERBACKUPOTHERLOCATIONHELP2, IDS_USERBACKUPOTHERLOCATION2);
    AddTool(IDC_SAVEIMMEDIATELYHELP, IDS_SAVEIMMEDIATELY);
    ActivateToolTip();
  } else {
    m_Help1.EnableWindow(FALSE);
    m_Help1.ShowWindow(SW_HIDE);
    m_Help2.EnableWindow(FALSE);
    m_Help2.ShowWindow(SW_HIDE);
    m_Help3.EnableWindow(FALSE);
    m_Help3.ShowWindow(SW_HIDE);
    m_Help4.EnableWindow(FALSE);
    m_Help4.ShowWindow(SW_HIDE);
  }

  return TRUE;
}