Example #1
0
void CvIpmLeft::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	CdIpmDoc* pDoc = (CdIpmDoc*)GetDocument();
	ASSERT (pDoc);
	if (!pDoc)
		return;
	CaIpmProperty& property = pDoc->GetProperty();

	BOOL bSetToDefaultPercentage = FALSE; //UKS
	BOOL bRegularStaticSet = TRUE;
	int nHint = (int)lHint;
	switch (nHint)
	{
	case 1: // Invoked by CdIpmDoc::Initiate()
		GetTreeCtrl().SendMessage (WM_SETFONT, (WPARAM)property.GetFont(), MAKELPARAM(TRUE, 0));
		if (bSetToDefaultPercentage) 
		{
			CRect rcClient;
			CfIpmFrame* pFrame = (CfIpmFrame*)GetParentFrame();
			ASSERT (pFrame);
			CSplitterWnd* pSplit = (CSplitterWnd *)pFrame->GetSplitterWnd();
			ASSERT (pSplit);
			pFrame->GetClientRect (rcClient);
			pSplit->SetColumnInfo(0, (int) (0.4 * (double)rcClient.Width()), 10);
			pSplit->RecalcLayout();
		}

		// Create regular static set, if needed
		if (bRegularStaticSet) 
		{
			CuTMServerStatic    *pItem1 = new CuTMServerStatic   (pDoc->GetPTreeGD());
			CuTMLockinfoStatic  *pItem3 = new CuTMLockinfoStatic (pDoc->GetPTreeGD());
			CuTMLoginfoStatic   *pItem4 = new CuTMLoginfoStatic  (pDoc->GetPTreeGD());
			CuTMAllDbStatic     *pItem5 = new CuTMAllDbStatic    (pDoc->GetPTreeGD());
			CuTMActiveUsrStatic *pItem6 = new CuTMActiveUsrStatic(pDoc->GetPTreeGD());
			CuTMReplAllDbStatic *pItem7 = new CuTMReplAllDbStatic(pDoc->GetPTreeGD());

			HTREEITEM hItem1 = pItem1->CreateTreeLine();
			HTREEITEM hItem2 = pItem3->CreateTreeLine();
			HTREEITEM hItem3 = pItem4->CreateTreeLine();
			HTREEITEM hItem4 = pItem5->CreateTreeLine();
			HTREEITEM hItem5 = pItem6->CreateTreeLine();
			HTREEITEM hItem6 = pItem7->CreateTreeLine();
			ASSERT (hItem1 && hItem2 && hItem3 && hItem4 && hItem5 && hItem6);
			CTreeCtrl& cTree = GetTreeCtrl();
			cTree.SelectItem(hItem1);
		}
		break;
	default:
		break;
	}
}
BOOL COXChildFrameState::ApplySplitterPanes(CFrameWnd* pFrameWnd) const
	// --- In  :
	// --- Out : 
	// --- Returns : Whether it succeeded or not
	// --- Effect : Applies all the states of the splitter panes that are in the
	//				internal collection
	{
	ASSERT_VALID(this);

	// Check for a CSplitterWnd child window
	CSplitterWnd* pSplitterWnd = GetSplitterWindow(pFrameWnd);
	if (pSplitterWnd  == NULL)
		// ... No splitter window found : nothing to do
		return TRUE;

	BOOL bAllSucceeded = TRUE;
	int nSplitterColRowStateIndex = 0;
	COXSplitterColRowState* pSplitterColRowState = NULL;
	for(nSplitterColRowStateIndex = 0; 
		nSplitterColRowStateIndex < m_pSplitterPanes->GetSize(); 
		nSplitterColRowStateIndex++)
		{
		pSplitterColRowState = DYNAMIC_DOWNCAST(COXSplitterColRowState, 
			m_pSplitterPanes->GetAt(nSplitterColRowStateIndex));
		if (pSplitterColRowState != NULL)
			{
			if (!pSplitterColRowState->ApplyProperties(pSplitterWnd))
				{
				TRACE0("COXChildFrameState::ApplySplitterPanes : Failed to apply properties\n");
				bAllSucceeded = FALSE;
				}
			}
		}

	// Make the changes visible
	pSplitterWnd->RecalcLayout();

	ASSERT_VALID(this);
	return bAllSucceeded;
	}
Example #3
0
void CDbeventView::OnInitialUpdate() 
{
    CView::OnInitialUpdate();
    CDbeventDoc* pDoc        = (CDbeventDoc*)GetDocument();
    CSplitterWnd*  pSplitter = (CSplitterWnd*)GetParent ();
    CDbeventFrame* pFrame    = (CDbeventFrame*)pSplitter->GetParent();
    
    ASSERT (pDoc);

    // toolbar caption according to doc caption
    CString docTitle = pDoc->GetTitle();
    pFrame->GetDialogBar()->SetWindowText(docTitle);

    if (pDoc->IsLoadedDoc()) {
      // frame window placement
      BOOL bResult = pFrame->SetWindowPlacement(pDoc->GetWPLJ());
      ASSERT (bResult);

      // splitbar placement
      int cxCur = pDoc->GetSplitterCxCur();
      int cxMin = pDoc->GetSplitterCxMin();
      pSplitter->SetColumnInfo(0, cxCur, cxMin);
      pSplitter->RecalcLayout();

      // set full state of all toolbars in the frame
      CDockState& ToolbarsState = pDoc->GetToolbarState();
      pFrame->SetDockState(ToolbarsState);
    
      // Set frame toolbar visibility state according to load info
      if (pDoc->m_bToolbarVisible)
        SetToolbarVisible(pFrame, TRUE);      // force immediate update
      else
        SetToolbarInvisible(pFrame, TRUE);    // force immediate update
    }
    else
    {
        //
        // The left pane (Register DBEvent pane) is 30% of the Frame Client erea.
        CRect rcClient;
        pFrame->GetClientRect (rcClient);
        pSplitter->SetColumnInfo(0, (int) (0.3 * (double)rcClient.Width()), 10);
        pSplitter->RecalcLayout();
    }
    //
    // Initialize the MaxLine Edit Box
    CuDbeDlgBar* pDlgBar = pFrame->GetDialogBar ();
    CEdit* pEdit = pDlgBar->GetEditMaxLine();
    if (pEdit && IsWindow (pEdit->m_hWnd))
    {
        CString strFormat;
        strFormat.Format ("%d", pDoc->m_nMaxLine);
        pEdit->SetLimitText  (4);
        pEdit->SetWindowText (strFormat);
    }
    //
    // Initialize the Sys DBEvent Check Box.
    CButton* pButton = pDlgBar->GetSysDBEventButton ();
    pButton->SetCheck (pDoc->m_bSysDBEvent);
    //
    // Initialize the Popup On Raise Check Box.
    pButton = pDlgBar->GetPopupButton ();
    pButton->SetCheck (pDoc->m_bPopupOnRaise);
    //
    // Initialize the Clear First Check Box.
    pButton = pDlgBar->GetClearFirstButton ();
    pButton->SetCheck (pDoc->m_bClearFirst);

    //
    // Initialize the ComboBox of Databases.
    CString strNone;
    CComboBox* pCombo =  pDlgBar->GetComboDatabase ();
    if (strNone.LoadString (IDS_DATABASE_NONE) == 0)
        strNone = "<None>";
    pCombo->AddString (strNone);
    if (pDoc->m_strDBName == "" || pDoc->m_strDBName == strNone)
    {
        pCombo->SetCurSel (0);
        return;
    }
    pCombo->AddString (pDoc->m_strDBName);
    pCombo->SelectString (-1, pDoc->m_strDBName);
}
Example #4
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;
	}
}
Example #5
0
long CCompileEditView::OnSendAddStr(WPARAM wParam /*= 0*/, LPARAM lParam /*= 0*/)
{
	if(lParam == NULL) 
		return 0;
		
	if( IsCompileEdit(COMPILE) )
	{
		HSAddStrCompileEdit* pData = (HSAddStrCompileEdit*)lParam;
		CString strRep;
		long nStartChar;
		long nEndChar;
		GetRichEditCtrl().GetSel( nStartChar, nEndChar );
		if(wParam == HX_EXPRESSSENTENCE)
		{
			CExpression* pExpression = (CExpression*)pData->m_strText;
			pData->m_strText = NULL;
						
			strRep.Format(_T("\n\n{ 插入%s公式体开始 }\n\n %s \n\n{ 插入%s公式体结束 }\n"),
				pExpression->GetName(),pExpression->GetSource(),pExpression->GetName());
			GetRichEditCtrl().SetSel (-1,-1); // 插入到最后
			GetRichEditCtrl().ReplaceSel(strRep,TRUE);

			if( m_pParentDlg->m_WndGridCtrl.GetSafeHwnd() )
			{
				//m_pParentDlg->m_WndGridCtrl.SetParamer(pExpression->GetParamVar(),TRUE);

				CMapVariabile* pVarsMap = pExpression->GetParamVar();
				int nRow = m_pParentDlg->m_WndGridCtrl.GetFixedRowCount();
				if ( pVarsMap ==NULL )
				{
					for(;nRow < m_pParentDlg->m_WndGridCtrl.GetRowCount(); nRow++)
					{
						m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,1,"");
						m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,2,"");
						m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,3,"");
						m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,4,"");
						m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,5,"");
					}
				}
				CNumericValue* pValue;
				CArray<class CValue*,class CValue*>* pArray = pVarsMap->GetObjArray();
				CString sName;
				CString strRetName;
				for(int nObj = 0; pArray != NULL && nObj < pArray->GetSize(); nObj++)
				{
					pValue = (CNumericValue*)pArray->GetAt(nObj);
					if( !pValue->IsStyle(HX_EXPRESSNUMBER) )
						continue;
					CString strValue;
					sName = pVarsMap->GetObjectName(pValue);			
					strRetName.Format("%s",sName);
					m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,1,strRetName);
					strValue.Format("%d", pValue->GetMinValue());
					m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,2,strValue);
					strValue.Format("%d", pValue->GetMaxValue());
					m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,3,strValue);
					strValue.Format("%d", pValue->GetValue());
					m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,4,strValue);
					strValue.Format("%d", pValue->GetTestStepValue());
					m_pParentDlg->m_WndGridCtrl.SetItemText(nRow,5,strValue);
		
					nRow++;
				}
				m_pParentDlg->m_WndGridCtrl.Invalidate();
			}
		}
		else
		{
			strRep.Format("%s",*pData->m_strText);
			GetRichEditCtrl().ReplaceSel(strRep,FALSE);
			GetRichEditCtrl().SetSel( nStartChar+pData->m_nCharPos, nStartChar+pData->m_nCharPos );
		}		
		SetFocus();
	}
	else if( IsCompileEdit(HELP) )
	{
		CString* str = (CString*)lParam;

		GetRichEditCtrl().SetWindowText(*str);
		int nCount = GetRichEditCtrl().GetLineCount();
		CDC* pDC = GetRichEditCtrl().GetDC();
		if(pDC != NULL)
		{
			nCount = pDC->GetTextExtent("A").cy * (nCount + 1);
			GetRichEditCtrl().ReleaseDC(pDC);
		}

		CSplitterWnd* pWnd = (CSplitterWnd*)this->GetParent();
		if( pWnd != NULL && pWnd->IsKindOf(RUNTIME_CLASS(CSplitterWnd)) )
		{	
			CRect rect;
			pWnd->GetClientRect(rect);
			int nHeight = rect.Height() - nCount;
			if(nHeight < 0) nHeight = rect.Height();
			pWnd->SetRowInfo(0,nHeight,0);
			pWnd->SetRowInfo(1,nCount,0);
			pWnd->RecalcLayout();
		}
	}
	return 0;
}
Example #6
0
/////////////////////////////////////////////////////////////////////////////
// switch to the new selected view tab
/////////////////////////////////////////////////////////////////////////////
BOOL CBonfireDoc::SwitchToView(CString strTab)
{
	if (strTab == "")
		return FALSE;

	CChildFrame*	pChild		= (CChildFrame*)g_pMainFrame->MDIGetActive();
	if (!pChild || pChild->GetActiveDocument() != this)
	{
		POSITION pos = GetFirstViewPosition();
		pChild	= (CChildFrame*)GetNextView(pos)->GetParentFrame();
	}

	if (!pChild)
		return FALSE;

	CView*			pViewAdd	= NULL;
	CBonfireView*	pGlobalView	= NULL;
	CBonfireView*	pBNewView	= NULL;
	
	// get the view to "hide"
	CView*			pViewDel	= pChild->GetActiveView();
	
	// if we're already displaying this kind of view, no need to go further.
	for (int i = 0; i < theApp.m_arAllViews.GetSize(); i++)
	{
		if ( ((CBonfireView*)theApp.m_arAllViews[i])->m_strCaption.Compare(strTab) == 0 )
		{
			pGlobalView = (CBonfireView*)theApp.m_arAllViews[i];
			break;
		}
	}

	if ( pViewDel && pViewDel->IsKindOf(pGlobalView->m_pClass) )
		return TRUE;

	// check if a view of this type already exists
 	if ( !m_pViews->Lookup(pGlobalView->m_strCaption, (void*&)pBNewView) )
	{
		// doesn't exist so create a new view
		pViewAdd = (CView*)pGlobalView->m_pClass->CreateObject();
		if (pViewAdd == NULL)
		{
			TRACE1("Warning: Dynamic create of view type %Fs failed\n", pGlobalView->m_pClass->m_lpszClassName);
			return FALSE;
		}

		// draw new view
		CCreateContext context;
		context.m_pNewViewClass		= pGlobalView->m_pClass;
		context.m_pCurrentDoc		= NULL;
		context.m_pNewDocTemplate	= this->GetDocTemplate();
		context.m_pLastView			= NULL;
		context.m_pCurrentFrame		= pChild;

		// draw new view
		if (!pViewAdd->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0),
			pChild, AFX_IDW_PANE_FIRST, &context))
		{
			TRACE0("Warning: couldn't create view for frame\n");
			delete pViewAdd;
			return FALSE;
		}

		// add the view to the map
		pBNewView			= new CBonfireView(pGlobalView);
		pBNewView->m_pView	= pViewAdd;
		pBNewView->m_pClass	= pViewAdd->GetRuntimeClass();

		// add this view to the document's map
		AddViewToMap(pBNewView);

		// WM_INITIALUPDATE is defined in afxpriv.h
		pViewAdd->SendMessage(WM_INITIALUPDATE,0,0);

		// connect the view to the document
		AddView(pViewAdd);
	}
	else
	{
		pViewAdd = pBNewView->m_pView;
	}

	// save file on switching views
	if (theApp.m_opOptions.general.dwSaveOnSwitch && !m_xTextBuffer.GetReadOnly() && pViewDel)
		DoFileSave();
	
	CSplitterWnd*	pSplitter	= NULL;
	POSITION pos				= GetFirstViewPosition();
	BOOL firstOne				= true;
	while (pos)
	{
		CView* pv	= GetNextView(pos);
		if (pv == pViewAdd)	
		{
			pv->SetDlgCtrlID(AFX_IDW_PANE_FIRST);

			// show the view
			if (pBNewView->m_bAllowsSplitter)
			{
				pSplitter	= (CSplitterWnd*)pViewAdd->GetParent();
				
				// show the splitter (show the children view(s) as well)
				pSplitter->ShowWindow(SW_SHOW);
			}
			else
				// show the view
				pViewAdd->ShowWindow(SW_SHOW);
		}
		else 
		{
			// check if the view is inside a splitter
			if (pv->GetParent()->GetRuntimeClass() == (CRuntimeClass*)RUNTIME_CLASS(CSplitterWnd))
			{
				pSplitter	= (CSplitterWnd*)pv->GetParent();
				
				// hide the splitter (hide all views with the splitter)
				pSplitter->ShowWindow(SW_HIDE);
			}
			else
			{
				// hide the view
				pv->ShowWindow(SW_HIDE);
				pv->SetDlgCtrlID(AFX_IDW_PANE_FIRST + 255);
			}
		}

		TRACE("%s (%d) ", pv->GetRuntimeClass()->m_lpszClassName, (unsigned)(pv->GetDlgCtrlID() - AFX_IDW_PANE_FIRST));
		if (pv == pViewDel)		TRACE("= D ");
		if (pv == pViewAdd)		TRACE("= A ");
		if (pv->GetRuntimeClass() == pGlobalView->m_pClass)
		{
			if (firstOne)
				firstOne = false;
			else
				TRACE("removing ");
		}
	}
	TRACE("\n");

	// get rid of extra views created by the splitter
	if (pSplitter)
	{
		for (int cols = 1; cols < pSplitter->GetColumnCount(); cols++)
			pSplitter->DeleteColumn(cols);
		for (int rows = 1; rows < pSplitter->GetRowCount(); rows++)
			pSplitter->DeleteRow(rows);

		pSplitter->RecalcLayout();
	}

	pViewAdd->UpdateWindow();
	pChild->SetActiveView(pViewAdd);
	pChild->RecalcLayout();

	if (pBNewView->m_bModifiedSinceRefresh)
	{
		pBNewView->m_bModifiedSinceRefresh = FALSE;
		if (pGlobalView->m_pClass == RUNTIME_CLASS(CXMLTreeView))
		{
			((CXMLTreeView*)pViewAdd)->RefreshView();
		}
		else if (pGlobalView->m_pClass == RUNTIME_CLASS(CBrowserView))
		{
			((CBrowserView*)pViewAdd)->RefreshView();
		}
		else
		{
			pBNewView->m_bModifiedSinceRefresh = TRUE;
		}
	}

	return TRUE;
}