BOOL CGanttCreateDependsDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	CLocalizer::EnableTranslation(*GetDlgItem(IDC_CURRENTSTAGE), FALSE);
	
	// reset state
	m_dwFromTaskID = m_dwCurToTaskID = m_dwNewToTaskID = 0;

	// set initial stage and dialog title
	CEnString sTitle;

	switch (m_nMode)
	{
	case GCDDM_ADD:
		m_nStage = GCDDS_PICKINGFROMTASK;
		sTitle.LoadString(IDS_CREATEDEPEND_TITLE);
		break;

	case GCDDM_EDIT:
		m_nStage = GCDDS_PICKINGFROMDEPEND;
		sTitle.LoadString(IDS_EDITDEPEND_TITLE);
		break;
		
	case GCDDM_DELETE:
		m_nStage = GCDDS_PICKINGFROMDEPEND;
		sTitle.LoadString(IDS_DELETEDEPEND_TITLE);
		break;
		
	default:
		ASSERT(0);
	}

	SetWindowText(sTitle);
	UpdatePrompt();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
CString CTDLFindTaskAttributeComboBox::GetAttributeName(const SEARCHPARAM& sp) const
{
	TDC_ATTRIBUTE attrib = sp.GetAttribute();
	BOOL bRelativeDate = sp.GetFlags();

	int nAttrib = ATTRIB_COUNT;
	CEnString sName;

	while (nAttrib--)
	{
		if (ATTRIBUTES[nAttrib].attrib == attrib)
		{
			if (ATTRIBUTES[nAttrib].nAttribResID)
			{
				// handle relative dates
				sName.LoadString(ATTRIBUTES[nAttrib].nAttribResID);

				if (AttributeIsDate(attrib) && bRelativeDate)
				{
					sName += ' ';
					sName += CEnString(IDS_TDLBC_RELATIVEDATESUFFIX);
				}
			}

			return sName;
		}
	}

	// try custom attributes
	nAttrib = m_aAttribDefs.GetSize();

	while (nAttrib--)
	{
		if (m_aAttribDefs[nAttrib].GetAttributeID() == attrib)
		{
			if (AttributeIsDate(attrib) && bRelativeDate)
			{
				sName.Format(IDS_CUSTOMRELDATECOLUMN, m_aAttribDefs[nAttrib].sLabel);
			}
			else
			{
				sName.Format(IDS_CUSTOMCOLUMN, m_aAttribDefs[nAttrib].sLabel);
			}

			return sName;
		}
	}

	ASSERT (0); // not found
	return _T("");
}
예제 #3
0
CString TDCREMINDER::FormatWhenString() const
{
	ASSERT(pTDC);

	CString sWhen;

	if (pTDC && bRelative)
	{
		CEnString sFormat;
		COleDateTime date;
		double dWhen = 0;

		if (nRelativeFromWhen == TDCR_DUEDATE)
		{
			date = pTDC->GetTaskDate(dwTaskID, TDCD_DUE);
			dWhen = date - COleDateTime::GetCurrentTime();

			if (dWhen < 1.0)
			{
				sFormat.LoadString(IDS_DUEWHENREMINDERNOW);
			}
			else if (fabs(dWhen) < 1.0)
			{
				dWhen *= 24 * 60; // convert to minutes
				sFormat.LoadString(IDS_DUEWHENREMINDERMINS);
			}
			else
			{
				sFormat.LoadString(IDS_DUEWHENREMINDERHOURS);
			}
		}
		else
		{
			date = pTDC->GetTaskDate(dwTaskID, TDCD_START);
			dWhen = date - COleDateTime::GetCurrentTime();

			if (dWhen < 1.0)
			{
				sFormat.LoadString(IDS_BEGINWHENREMINDERNOW);
			}
			else if (fabs(dWhen) < 1.0)
			{
				dWhen *= 24 * 60; // convert to minutes
				sFormat.LoadString(IDS_BEGINWHENREMINDERMINS);
			}
			else
			{
				sFormat.LoadString(IDS_BEGINWHENREMINDERHOURS);
			}
		}

		CString sDateTime = CDateHelper::FormatDate(date, DHFD_DOW | DHFD_NOSEC | DHFD_TIME);

		if (dWhen < 1.0)
			sWhen.Format(sFormat, sDateTime);
		else
			sWhen.Format(sFormat, dWhen, sDateTime);
	}

	return sWhen;
}