Пример #1
0
void CuDlgSqlQueryStatement::LoadDocument() 
{
	CvSqlQueryUpperView* pParent1 = (CvSqlQueryUpperView*)GetParent ();                 // CvSqlQueryUpperView.
	ASSERT (pParent1);
	CdSqlQueryRichEditDoc* pDoc =  (CdSqlQueryRichEditDoc*)pParent1->GetDocument();     // CdSqlQueryRichEditDoc.
	ASSERT (pDoc);
	if (pDoc && pDoc->IsLoadedDoc())
	{
		m_strCom  = pDoc->m_strCom;
		m_strExec = pDoc->m_strExec;
		m_strElap = pDoc->m_strElap;
		m_strCost = pDoc->m_strCost;
		UpdateData (FALSE);
	}
}
Пример #2
0
BOOL CuDlgSqlQueryStatement::OnInitDialog() 
{
	CDialog::OnInitDialog();

	CvSqlQueryUpperView* pParent1 = (CvSqlQueryUpperView*)GetParent ();                 // CvSqlQueryUpperView.
	ASSERT (pParent1);
	CdSqlQueryRichEditDoc* pDoc =  (CdSqlQueryRichEditDoc*)pParent1->GetDocument();     // CdSqlQueryRichEditDoc.
	ASSERT (pDoc);
	if (pDoc && pDoc->IsLoadedDoc())
	{
		m_strCom  = pDoc->m_strCom;
		m_strExec = pDoc->m_strExec;
		m_strElap = pDoc->m_strElap;
		m_strCost = pDoc->m_strCost;
		UpdateData (FALSE);
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Пример #3
0
void CvSqlQueryRichEditView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	int nHint = (int)lHint;
	CdSqlQueryRichEditDoc* pDoc =(CdSqlQueryRichEditDoc*)GetDocument();
	switch (nHint)
	{
	case UPDATE_HINT_LOAD:
		if (pHint && pHint == pDoc)
		{
			// Load document from the serialization:
			if (!pDoc->IsLoadedDoc())
				return;
			//
			// Put the global statement.
			CRichEditCtrl& redit = GetRichEditCtrl();
			LONG oldEventMask = redit.SetEventMask(ENM_NONE); // Do not send EN_CHANGE.
			redit.SetWindowText (pDoc->m_strStatement);
			// Set the highlight statement.
			if (pDoc->m_bHighlight)
			{
				redit.SetSel (0, -1);
				OnColorPick (pDoc->m_crColorText);
				redit.SetSel (pDoc->m_nStart, pDoc->m_nEnd);
				OnColorPick (pDoc->m_crColorSelect);
				redit.SetSel (-1, 0);
			}
			redit.SetEventMask(oldEventMask);// Restore the old event mask
			pDoc->SetTitle (pDoc->m_strTitle);
			//
			// Splitbar placement
			CfSqlQueryFrame* pFrame  = (CfSqlQueryFrame*)GetParentFrame();
			CSplitterWnd* pNestSplitter = pFrame->GetNestSplitterWnd();
			ASSERT (pNestSplitter); 
			CSplitterWnd* pMainSplitter = pFrame->GetMainSplitterWnd();
			ASSERT (pMainSplitter); 
			if (!(pMainSplitter && pNestSplitter))
				return;

			pMainSplitter->SetRowInfo(0, pDoc->GetSplitterCyCurMainSplit(), pDoc->GetSplitterCyMinMainSplit());
			pMainSplitter->RecalcLayout();
			pNestSplitter->SetRowInfo(0, pDoc->GetSplitterCyCurNestSplit(), pDoc->GetSplitterCyMinNestSplit());
			pNestSplitter->RecalcLayout();
		}
		break;
	case UPDATE_HINT_SETTINGCHANGE:
/*UKS
		if (pHint && pHint == pDoc && pDoc->GetSetting().GetFont())
		{
			long nStart;
			long nEnd;
			GetRichEditCtrl().GetSel(nStart, nEnd);
			//
			// The control simply uses the WM_SETFONT message to change the font.
			// There is no need to use the member:
			//    SetSelectionCharFormat,
			//    SetDefaultCharFormat,
			//    SetParaFormat,
			//    SetCharFormat,
			// because the control does not manage the text in different font.
			CString strText;
			GetRichEditCtrl().GetWindowText (strText);
			LONG oldEventMask = GetRichEditCtrl().SetEventMask(ENM_NONE); // Do not send EN_CHANGE.
			GetRichEditCtrl().Clear();
			SendMessage(WM_SETFONT, (WPARAM)pDoc->GetSetting().GetFont());
			Invalidate();
			GetRichEditCtrl().SetWindowText(strText);
			if (pDoc->m_bHighlight)
			{
				GetRichEditCtrl().SetSel (pDoc->m_nStart, pDoc->m_nEnd);
				OnColorPick (pDoc->m_crColorSelect);
				GetRichEditCtrl().SetSel (nStart, nEnd);
			}
			GetRichEditCtrl().SetEventMask(oldEventMask); 
		}
*/
		break;

	default:
		break;
	}
}