Example #1
0
/*----------------------------------------------------------------------------------------------
	Process right button down (WM_LBUTTONDOWN). Activates an editor window if needed.
	@param grfmk Indicates whether various virtual keys are down.
	@param xp The x-coord of the mouse relative to the upper-left corner of the client.
	@param yp The y-coord of the mouse relative to the upper-left corner of the client.
	@return Return true if processed.
----------------------------------------------------------------------------------------------*/
bool CleDeSplitChild::OnRButtonDown(uint grfmk, int xp, int yp)
{
	m_fNeedSync = false; // Clear from previous EndEdits.
	bool f = SuperClass::OnRButtonDown(grfmk, xp, yp);
	if (m_fNeedSync)
	{
		// Update all lists now that we've changed.
		CleMainWnd * pcmw = dynamic_cast<CleMainWnd *>(MainWindow());
		Assert(pcmw);
		SyncInfo sync(ksyncPossList, pcmw->GetRootObj(), 0);
		m_qlpi->StoreAndSync(sync);
		m_fNeedSync = false;
	}
	return f;
}
Example #2
0
/*----------------------------------------------------------------------------------------------
	If there is another editable field above the currently open field, this closes the current
	field and opens the previous editable field. dxpCursor allows the insertion point in
	the new field to be located at some point other than the left margin. fTopCursor determines
	whether the insertion point is placed on the top or bottom line.
	@param dxpCursor Horiz. pixels from the left field margin for the insertion point.
	@param fTopCursor True if the insertion point is to be placed on the top field line.
	@return True if it succeeded in opening a new field. False if the current field editor
		can't be closed or if there are no editable fields above the current field.
----------------------------------------------------------------------------------------------*/
bool CleDeSplitChild::OpenPreviousEditor(int dxpCursor, bool fTopCursor)
{
	m_fNeedSync = false; // Clear from previous EndEdits.
	bool f = SuperClass::OpenPreviousEditor(dxpCursor, fTopCursor);
	if (m_fNeedSync)
	{
		// Update all lists now that we've changed.
		CleMainWnd * pcmw = dynamic_cast<CleMainWnd *>(MainWindow());
		Assert(pcmw);
		SyncInfo sync(ksyncPossList, pcmw->GetRootObj(), 0);
		m_qlpi->StoreAndSync(sync);
		m_fNeedSync = false;
	}
	return f;
}
Example #3
0
/*----------------------------------------------------------------------------------------------
	Clear out the window contents, and especially any active database connections, when the
	project is (about to be) changed. Return true if the close is OK.
	@return true if the close is OK.
----------------------------------------------------------------------------------------------*/
bool CleDeSplitChild::CloseProj()
{
	// Close current editor if there is one.
	if (!CloseEditor())
		return false;
	if (m_fNeedSync)
	{
		// Notify other apps of change.
		CleMainWnd * pcmw = dynamic_cast<CleMainWnd *>(MainWindow());
		Assert(pcmw);
		SyncInfo sync(ksyncPossList, pcmw->GetRootObj(), 0);
		m_qlpi->StoreSync(sync);
	}
	return SuperClass::CloseProj();
}
Example #4
0
/*----------------------------------------------------------------------------------------------
	Return the text string that gets shown to the user when this object needs to be displayed.
	This is the method for displaying the name of a single reference. This view shows the
	name for an RnGenericRec consisting of the type of record, hyphen, title, hyphen,
	creation date. "Subevent - Fishing for pirana - 3/22/2001"

	@param pguid Pointer to a database object's assigned GUID.
	@param pptss Address of a pointer to an ITsString COM object used for returning the text
					string.

	@return S_OK, E_POINTER, or E_FAIL.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP CleRecVc::GetStrForGuid(BSTR bstrGuid, ITsString ** pptss)
{
	Assert(false);  // rework

	BEGIN_COM_METHOD;
	ChkComBstrArg(bstrGuid);
	ChkComOutPtr(pptss);

	if (BstrLen(bstrGuid) != 8)
		ReturnHr(E_INVALIDARG);

	CleMainWnd * pcmw = dynamic_cast<CleMainWnd *>(AfApp::Papp()->GetCurMainWnd());
	AssertPtr(pcmw);
	CleLpInfo * plpi = dynamic_cast<CleLpInfo *>(pcmw->GetLpInfo());
	AssertPtr(plpi);

	HVO hvo = plpi->GetDbInfo()->GetIdFromGuid((GUID *)bstrGuid);

	CustViewDaPtr qcvd;
	plpi->GetDataAccess(&qcvd);
	AssertPtr(qcvd);
	int clid;
	HVO hvoOwn;
	int64 ntim;
	ITsStringPtr qtssTitle;
	CheckHr(qcvd->get_IntProp(hvo, kflidCmObject_Class, &clid));
	CheckHr(qcvd->get_ObjectProp(hvo, kflidCmObject_Owner, &hvoOwn));
			// REVIEW KenZ(RandyR) Whey are DN flids in this app?
	CheckHr(qcvd->get_TimeProp(hvo, kflidRnGenericRec_DateCreated, &ntim));
	CheckHr(qcvd->get_StringProp(hvo, kflidRnGenericRec_Title, &qtssTitle));

	int stid;
			// REVIEW KenZ(RandyR) Whey are DN flids in this app?
	if (clid == kclidRnEvent)
	{
		if (pcmw->GetRootObj() == hvoOwn)
			stid = kstidEvent;
		else
			stid = kstidSubevent;
	}
	else if (clid == kclidRnAnalysis)
	{
		if (pcmw->GetRootObj() == hvoOwn)
			stid = kstidAnalysis;
		else
			stid = kstidSubanalysis;
	}
	StrUni stu(stid);
	StrUni stuSep(kstidSpHyphenSp);

	ITsStrFactoryPtr qtsf;
	ITsIncStrBldrPtr qtisb;
	qtsf.CreateInstance(CLSID_TsStrFactory);
	CheckHr(qtsf->GetIncBldr(&qtisb));
	CheckHr(qtisb->Append(stu.Bstr()));

	CheckHr(qtisb->Append(stuSep.Bstr()));
	CheckHr(qtisb->AppendTsString(qtssTitle)); // The title.
	CheckHr(qtisb->Append(stuSep.Bstr()));
	// Leave the date blank if a date doesn't exist.
	if (ntim)
	{
		// Convert the date to a system date.
		SilTime tim = ntim;
		SYSTEMTIME stim;
		stim.wYear = (unsigned short) tim.Year();
		stim.wMonth = (unsigned short) tim.Month();
		stim.wDay = (unsigned short) tim.Date();

		// Then format it to a time based on the current user locale.
		achar rgchDate[50]; // Tuesday, August 15, 2000		mardi 15 août 2000
		::GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &stim, NULL, rgchDate, 50);
		stu = rgchDate;
		CheckHr(qtisb->Append(stu.Bstr()));
	}
	CheckHr(qtisb->GetString(pptss));

	return S_OK;

	END_COM_METHOD(g_fact2, IID_IVwViewConstructor)
}