示例#1
0
void CView::OnUpdateNextPaneMenu(CCmdUI* pCmdUI)
{
	ASSERT(pCmdUI->m_nID == ID_NEXT_PANE ||
		pCmdUI->m_nID == ID_PREV_PANE);
	CSplitterWnd* pSplitter = GetParentSplitter(this, FALSE);
	pCmdUI->Enable(pSplitter != NULL &&
		pSplitter->CanActivateNext(pCmdUI->m_nID == ID_PREV_PANE));
}
示例#2
0
BOOL CView::OnSplitCmd(UINT)
{
	CSplitterWnd* pSplitter = GetParentSplitter(this, FALSE);
	if (pSplitter == NULL)
		return FALSE;

	pSplitter->DoKeyboardSplit();
	return TRUE;    // attempted at least
}
示例#3
0
BOOL CView::OnNextPaneCmd(UINT nID)
{
	CSplitterWnd* pSplitter = GetParentSplitter(this, FALSE);
	if (pSplitter == NULL)
		return FALSE;

	ASSERT(nID == ID_NEXT_PANE || nID == ID_PREV_PANE);
	pSplitter->ActivateNext(nID == ID_PREV_PANE);
	return TRUE;
}
示例#4
0
/**
 * @brief Same purpose as the one as in MergeEditView.cpp
 * @note Nearly the same code also
 */
void CMergeDiffDetailView::UpdateSiblingScrollPos (BOOL bHorz)
{
	CSplitterWnd *pSplitterWnd = GetParentSplitter (this, FALSE);
	if (pSplitterWnd != NULL)
	{
		//  See CSplitterWnd::IdFromRowCol() implementation for details
		int nCurrentRow = (GetDlgCtrlID () - MY_IDW_PANE_FIRST) / 16;
		int nCurrentCol = (GetDlgCtrlID () - MY_IDW_PANE_FIRST) % 16;
		ASSERT (nCurrentRow >= 0 && nCurrentRow < pSplitterWnd->GetRowCount ());
		ASSERT (nCurrentCol >= 0 && nCurrentCol < pSplitterWnd->GetColumnCount ());

		// limit the TopLine : must be smaller than GetLineCount for all the panels
		int nNewTopLine = m_nTopLine;
		int nRows = pSplitterWnd->GetRowCount ();
		int nCols = pSplitterWnd->GetColumnCount ();
		int nRow=0;
		for (nRow = 0; nRow < nRows; nRow++)
		{
			for (int nCol = 0; nCol < nCols; nCol++)
			{
				CMergeDiffDetailView *pSiblingView = static_cast<CMergeDiffDetailView*>(GetSiblingView (nRow, nCol));
				if (pSiblingView != NULL)
					if (pSiblingView->GetLineCount() <= nNewTopLine)
						nNewTopLine = pSiblingView->GetLineCount()-1;
			}
		}

		if (m_nTopLine != nNewTopLine) 
		{
			// only modification from code in MergeEditView.cpp
			// Where are we now, are we still in a diff ? So set to no diff
			nNewTopLine = m_lineBegin = 0;
			m_lineEnd = -1;
			m_diffLength = 0;

			ScrollToLine(nNewTopLine);
		}


		for (nRow = 0; nRow < nRows; nRow++)
		{
			for (int nCol = 0; nCol < nCols; nCol++)
			{
				if (!(nRow == nCurrentRow && nCol == nCurrentCol))  //  We don't need to update ourselves
				{
					CMergeDiffDetailView *pSiblingView = static_cast<CMergeDiffDetailView*>(GetSiblingView (nRow, nCol));
					if (pSiblingView != NULL)
						pSiblingView->OnUpdateSibling (this, bHorz);
				}
			}
		}
	}
}
示例#5
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;
	}
}
示例#6
0
BOOL CMyFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs,CCreateContext* pContext){

#if 0  // 创建动态切分窗口 
	//1 指定所需要的视图类
	CCreateContext cxt;
	cxt.m_pNewViewClass = RUNTIME_CLASS(CMyView);
	//2 创建动态切分
	m_wndSplit.Create(this,2,2,CSize(200,200),&cxt);	
#else  //静态切分窗口的创建
	//1 创建静态切分
	m_wndSplit.CreateStatic(this,2,1);
	//这里最后参数填写的是默认id,即充满与客户区窗口
	m_wndSplit.CreateView(0,0,RUNTIME_CLASS(CHtmlView),CSize(200,200),pContext);
//	m_wndSplit.CreateView(1,0,RUNTIME_CLASS(CHtmlView),CSize(200,200),pContext);

	m_wndSplit2.CreateStatic(&m_wndSplit,1,2,WS_CHILD|WS_VISIBLE,
		m_wndSplit.IdFromRowCol(1,0));
	m_wndSplit2.CreateView(0,0,RUNTIME_CLASS(CMyView),CSize(100,100),pContext);
	m_wndSplit2.CreateView(0,1,RUNTIME_CLASS(CMyView),CSize(100,100),pContext);
	
	m_wndSplit2.SetColumnInfo(0,200,10);
	/*
	for(int i=0;i<3;++i){
		for(int j=0;j<3;++j)
		m_wndSplit.CreateView(i,j,RUNTIME_CLASS(CEditView),CSize(200,200),pContext);
	}
	*/
	//2 获取创建好的视图
	CHtmlView* pHtmlView = (CHtmlView*) m_wndSplit.GetPane(0,0);
	pHtmlView -> Navigate("D:/");
#endif
	return true;	
}
示例#7
0
void CMergeDiffDetailView::OnDisplayDiff(int nDiff /*=0*/)
{
	int newlineBegin, newlineEnd;
	CMergeDoc *pd = GetDocument();
	if (nDiff < 0 || nDiff >= pd->m_diffList.GetSize())
	{
		newlineBegin = 0;
		newlineEnd = -1;
	}
	else
	{
		DIFFRANGE curDiff;
		VERIFY(pd->m_diffList.GetDiff(nDiff, curDiff));

		newlineBegin = curDiff.dbegin0;
		ASSERT (newlineBegin >= 0);
		newlineEnd = curDiff.dend0;
	}

	if (newlineBegin == m_lineBegin && newlineEnd == m_lineEnd)
		return;
	m_lineBegin = newlineBegin;
	m_lineEnd = newlineEnd;
	m_diffLength = m_lineEnd - m_lineBegin + 1;

	// scroll to the first line of the diff
	ScrollToLine(m_lineBegin);

	// tell the others views about this diff (no need to call UpdateSiblingScrollPos)
	CSplitterWnd *pSplitterWnd = GetParentSplitter(this, FALSE);

	// pSplitterWnd is NULL if WinMerge started minimized.
	if (pSplitterWnd != NULL)
	{
		int nRows = pSplitterWnd->GetRowCount ();
		int nCols = pSplitterWnd->GetColumnCount ();
		for (int nRow = 0; nRow < nRows; nRow++)
		{
			for (int nCol = 0; nCol < nCols; nCol++)
			{
				CMergeDiffDetailView *pSiblingView = static_cast<CMergeDiffDetailView*>(GetSiblingView (nRow, nCol));
				if (pSiblingView != NULL)
					pSiblingView->OnDisplayDiff(nDiff);
			}
		}
	}

	// update the width of the horizontal scrollbar
	RecalcHorzScrollBar();
}
BOOL COXChildFrameState::ComputeSplitterPanes(CFrameWnd* pFrameWnd)
	// --- In  :
	// --- Out : 
	// --- Returns : Whether it succeeded or not
	// --- Effect : Computes all the states of the splitter panes and adds them
	//				to an 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 nRowColIndex = 0;

	// Calculate the row properties
	for (nRowColIndex = 0; nRowColIndex < pSplitterWnd->GetRowCount(); nRowColIndex++)
		{
		COXSplitterColRowState* pSplitterColRowState = new COXSplitterColRowState;
		if (pSplitterColRowState->ComputeProperties(pSplitterWnd, nRowColIndex, TRUE))
			m_pSplitterPanes->Add(pSplitterColRowState);
		else
			{
			TRACE0("COXChildFrameState::ComputeSplitterPanes : Failed to compute properties (row)\n");
			bAllSucceeded = FALSE;
			delete pSplitterColRowState;
			}
		}

	// Calculate the column properties
	for (nRowColIndex = 0; nRowColIndex < pSplitterWnd->GetColumnCount(); nRowColIndex++)
		{
		COXSplitterColRowState* pSplitterColRowState = new COXSplitterColRowState;
		if (pSplitterColRowState->ComputeProperties(pSplitterWnd, nRowColIndex, FALSE))
			m_pSplitterPanes->Add(pSplitterColRowState);
		else
			{
			TRACE0("COXChildFrameState::ComputeSplitterPanes : Failed to compute properties (column)\n");
			bAllSucceeded = FALSE;
			delete pSplitterColRowState;
			}
		}

	ASSERT_VALID(this);
	return bAllSucceeded;
	}
示例#9
0
LONG CuDlgDBEventPane02::OnDbeventTraceIncoming (WPARAM wParam, LPARAM lParam)
{
    LPRAISEDDBE lpStruct = (LPRAISEDDBE)lParam;
    CView*  pView = (CView*)GetParent();
    ASSERT  (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT  (pDoc);
    CSplitterWnd* pSplitter = (CSplitterWnd*)pView->GetParent();
    ASSERT (pSplitter);
    CDbeventFrame*  pFrame = (CDbeventFrame*)pSplitter->GetParent();
    ASSERT  (pFrame);
    if (!pFrame->GetPaneRegisteredDBEvent()->Find ((LPCTSTR)lpStruct->DBEventName, (LPCTSTR)lpStruct->DBEventOwner))
    {
        IncomingDBEvent (
            pDoc, 
            "r",
            (LPCTSTR)lpStruct->StrTimeStamp, 
            (LPCTSTR)lpStruct->DBEventName, 
            (LPCTSTR)lpStruct->DBEventOwner, 
            (LPCTSTR)lpStruct->DBEventText,
            "*");
    }
    else
    {
        IncomingDBEvent (
            pDoc, 
            "r",
            (LPCTSTR)lpStruct->StrTimeStamp, 
            (LPCTSTR)lpStruct->DBEventName, 
            (LPCTSTR)lpStruct->DBEventOwner, 
            (LPCTSTR)lpStruct->DBEventText);
    }
    if (pDoc->m_bPopupOnRaise)
    {
        CString strMsg;
        strMsg.GetBuffer (520);
        TCHAR tchszAll [80];

        StringWithOwner ((LPUCHAR)lpStruct->DBEventName, (LPUCHAR)lpStruct->DBEventOwner, (LPUCHAR)tchszAll);
        //"%s: Database Event %s '%s' was raised on node %s."
            strMsg.Format (IDS_I_DB_EVENT_RAISED,
            (LPCTSTR)lpStruct->StrTimeStamp,
            (LPCTSTR)tchszAll,
            (LPCTSTR)lpStruct->DBEventText,
            (LPCTSTR)GetVirtNodeName (pDoc->m_hNode));
        BfxMessageBox (strMsg);
    }
    return RES_SUCCESS;
}
示例#10
0
CSplitterWnd* PASCAL
CView::GetParentSplitter(const CWnd* pWnd, BOOL bAnyState)
{
	CSplitterWnd* pSplitter = (CSplitterWnd*)pWnd->GetParent();
	if (!pSplitter->IsKindOf(RUNTIME_CLASS(CSplitterWnd)))
		return NULL;        // not a splitter
	if (!bAnyState)
	{
		// ignore splitters in minimized (iconic) windows
		while ((pWnd = pWnd->GetParent()) != NULL)
			if (pWnd->IsIconic())
				return NULL;
	}
	return pSplitter;
}
示例#11
0
BOOL COleClientItem::OnScrollBy(CSize sizeExtent)
{
	ASSERT_VALID(this);
	ASSERT_VALID(m_pView);

	// scroll through splitter or view
	CSplitterWnd* pSplitter = CView::GetParentSplitter(m_pView, FALSE);
	BOOL bResult;
	if (pSplitter != NULL)
		bResult = pSplitter->DoScrollBy(m_pView, sizeExtent);
	else
		bResult = m_pView->OnScrollBy(sizeExtent);

	return bResult;
}
示例#12
0
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
	// TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다.

	if (!m_wndSplitter.CreateStatic(this, 1, 2)) {
		TRACE0("Fail to create splitter.\n");
		return FALSE;
	}

	m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CProject3View), CSize(300, 300), pContext);
	m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CProject3View), CSize(300, 300), pContext);

	return TRUE;

	return CFrameWnd::OnCreateClient(lpcs, pContext);
}
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;
	}
示例#14
0
BOOL CMyFrameWnd::OnCreateClient(
		LPCREATESTRUCT lpcs,CCreateContext* pContext)
{
	CCreateContext cct;
	cct.m_pNewViewClass = RUNTIME_CLASS(CMyView);
	split1.Create(this,2,2,CSize(100,100),&cct);
	return TRUE;
/*	
静态切分
	split1.CreateStatic(this,1,2);
	split2.CreateStatic(&split1,2,1,WS_CHILD|WS_VISIBLE,
		split1.IdFromRowCol(0,0));
	split2.CreateView(1,0,RUNTIME_CLASS(CMyView),
		CSize(100,100),pContext);
	split2.CreateView(0,0,RUNTIME_CLASS(CEditView),
		CSize(100,100),pContext);
	split1.CreateView(0,1,RUNTIME_CLASS(CHtmlView),
		CSize(100,100),pContext);
	CHtmlView*pView = (CHtmlView*)split1.GetPane(0,1);
	pView->Navigate("sina.com.cn");
	split1.SetColumnInfo(0,200,100);
	return TRUE;//为何不调父类虚函数
	*/
}
示例#15
0
DROPEFFECT COleDropTarget::OnDragScroll(CWnd* pWnd, DWORD dwKeyState,
	CPoint point)
{
	ASSERT_VALID(this);
	ASSERT_VALID(pWnd);

	// CWnds are allowed, but don't support autoscrolling
	if (!pWnd->IsKindOf(RUNTIME_CLASS(CView)))
		return DROPEFFECT_NONE;
	CView* pView = (CView*)pWnd;
	DROPEFFECT dropEffect = pView->OnDragScroll(dwKeyState, point);

	// DROPEFFECT_SCROLL means do the default
	if (dropEffect != DROPEFFECT_SCROLL)
		return dropEffect;

	// get client rectangle of destination window
	CRect rectClient;
	pWnd->GetClientRect(&rectClient);
	CRect rect = rectClient;

	// hit-test against inset region
	UINT nTimerID = 0xffff;
	rect.InflateRect(-nScrollInset, -nScrollInset);
	CSplitterWnd* pSplitter = NULL;
	if (rectClient.PtInRect(point) && !rect.PtInRect(point))
	{
		// determine which way to scroll along both X & Y axis
		if (point.x < rect.left)
			nTimerID = MAKEWORD(SB_LINEUP, HIBYTE(nTimerID));
		else if (point.x >= rect.right)
			nTimerID = MAKEWORD(SB_LINEDOWN, HIBYTE(nTimerID));
		if (point.y < rect.top)
			nTimerID = MAKEWORD(LOBYTE(nTimerID), SB_LINEUP);
		else if (point.y >= rect.bottom)
			nTimerID = MAKEWORD(LOBYTE(nTimerID), SB_LINEDOWN);
		ASSERT(nTimerID != 0xffff);

		// check for valid scroll first
		pSplitter = CView::GetParentSplitter(pView, FALSE);
		BOOL bEnableScroll = FALSE;
		if (pSplitter != NULL)
			bEnableScroll = pSplitter->DoScroll(pView, nTimerID, FALSE);
		else
			bEnableScroll = pView->OnScroll(nTimerID, 0, FALSE);
		if (!bEnableScroll)
			nTimerID = 0xffff;
	}

	if (nTimerID == 0xffff)
	{
		if (m_nTimerID != 0xffff)
		{
			// send fake OnDragEnter when transition from scroll->normal
			COleDataObject dataObject;
			dataObject.Attach(m_lpDataObject, FALSE);
			OnDragEnter(pWnd, &dataObject, dwKeyState, point);
			m_nTimerID = 0xffff;
		}
		return DROPEFFECT_NONE;
	}

	// save tick count when timer ID changes
	DWORD dwTick = GetTickCount();
	if (nTimerID != m_nTimerID)
	{
		m_dwLastTick = dwTick;
		m_nScrollDelay = nScrollDelay;
	}

	// scroll if necessary
	if (dwTick - m_dwLastTick > m_nScrollDelay)
	{
		if (pSplitter != NULL)
			pSplitter->DoScroll(pView, nTimerID, TRUE);
		else
			pView->OnScroll(nTimerID, 0, TRUE);
		m_dwLastTick = dwTick;
		m_nScrollDelay = nScrollInterval;
	}
	if (m_nTimerID == 0xffff)
	{
		// send fake OnDragLeave when transitioning from normal->scroll
		OnDragLeave(pWnd);
	}

	m_nTimerID = nTimerID;
	// check for force link
	if ((dwKeyState & (MK_CONTROL|MK_SHIFT)) == (MK_CONTROL|MK_SHIFT))
		dropEffect = DROPEFFECT_SCROLL|DROPEFFECT_LINK;
	// check for force copy
	else if ((dwKeyState & MK_CONTROL) == MK_CONTROL)
		dropEffect = DROPEFFECT_SCROLL|DROPEFFECT_COPY;
	// check for force move
	else if ((dwKeyState & MK_ALT) == MK_ALT ||
		(dwKeyState & MK_SHIFT) == MK_SHIFT)
		dropEffect = DROPEFFECT_SCROLL|DROPEFFECT_MOVE;
	// default -- recommended action is move
	else
		dropEffect = DROPEFFECT_SCROLL|DROPEFFECT_MOVE;
	return dropEffect;
}
示例#16
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;
}
示例#17
0
void CdIpmDoc::Serialize(CArchive& ar)
{
	CString caption;
	m_connectedInfo.Serialize(ar);

	if (ar.IsStoring())
	{
		ar << m_hNode;
		ar << m_hReplMonHandle;
		ar << m_nOIVers;

		// filter structure
		ar.Write(&m_sFilter, sizeof(m_sFilter));

		// splitbar
		if (m_bShowTree )
		{
			POSITION pos = GetFirstViewPosition();
			CView *pView = GetNextView(pos);
			ASSERT (pView);
			CSplitterWnd *pSplit = (CSplitterWnd *)pView->GetParent();
			ASSERT (pSplit);
			pSplit->GetColumnInfo(0, m_cxCur, m_cxMin);
		}
		ar << m_cxCur;
		ar << m_cxMin;

		ASSERT (m_pTabDialog);
		CuIpmPropertyData* pData = m_pTabDialog->GetDialogData();
		CuIpmProperty* pCurrentProperty = m_pTabDialog->GetCurrentProperty();
		if (pCurrentProperty) 
		{
			pCurrentProperty->SetPropertyData (pData);
			ar << pCurrentProperty;
		}

		ar << m_strSelectKey;
		ar << m_bShowTree;
	}
	else
	{
		m_bLoaded = TRUE;

		ar >> m_hNode; // Note : OpenNodeStruct() MUST NOT BE CALLED!
		ar >> m_hReplMonHandle;
		ar >> m_nOIVers;
		IPM_SetDbmsVersion(m_nOIVers);

		// filter structure
		ar.Read(&m_sFilter, sizeof(m_sFilter));

		// splitbar
		ar >> m_cxCur;
		ar >> m_cxMin;

		if (m_pCurrentProperty)
		{
			delete m_pCurrentProperty;
			m_pCurrentProperty = NULL;
		}
		ar >> m_pCurrentProperty;
		ar >> m_strSelectKey;
		ar >> m_bShowTree;
	}
	m_arrItemPath.Serialize(ar);
	IPM_SerializeChache(ar);

	// global data for the tree, including tree lines
	// ex - m_pTreeGD->Serialize(ar);
	if (ar.IsStoring())
	{
		ar << m_pTreeGD;
	}
	else
	{
		delete m_pTreeGD; // memory leak otherwise
		ar >> m_pTreeGD;
		m_pTreeGD->SetPSFilter(&m_sFilter);
		m_pTreeGD->SetDocument(this);
	}
}
示例#18
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;
	}
}
示例#19
0
void CView::OnUpdateSplitCmd(CCmdUI* pCmdUI)
{
	CSplitterWnd* pSplitter = GetParentSplitter(this, FALSE);
	pCmdUI->Enable(pSplitter != NULL && !pSplitter->IsTracking());
}
示例#20
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;
}
示例#21
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);
}
示例#22
0
/**
 * @brief Change active pane in diff pane
 */
void CMergeDiffDetailView::OnChangePane()
{
	CSplitterWnd *pSplitterWnd = GetParentSplitter(this, FALSE);
	pSplitterWnd->ActivateNext();
}