Esempio n. 1
0
void CStackedView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
	if (pHint == NULL || pHint->IsKindOf(RUNTIME_CLASS(CNotifyContextSelectionViewChanged)) == FALSE)
	{
		return;
	}

	CNotifyContextSelectionViewChanged* pNotify = dynamic_cast<CNotifyContextSelectionViewChanged*>(pHint);
	if (pNotify == NULL)
	{
		return;
	}

	switch (pNotify->GetSelectedView())
	{
	case Sites:
		SetActiveView(m_pWebSiteContainerWnd);
		break;
	case Live:
		SetActiveView(m_pResponseHistoryView);
		break;
	default:
		SetActiveView(m_pBlankView);
		break;
	}
}
Esempio n. 2
0
void CFrameWnd::InitialUpdateFrame( CDocument *pDoc, BOOL bMakeVisible )
/**********************************************************************/
{
    UNUSED_ALWAYS( pDoc );

    if( GetActiveView() == NULL ) {
        CView *pView = (CView *)GetDescendantWindow( AFX_IDW_PANE_FIRST );
        if( pView != NULL ) {
            if( pView->IsKindOf( RUNTIME_CLASS( CView ) ) ) {
                SetActiveView( pView );
            } else if( pView->IsKindOf( RUNTIME_CLASS( CSplitterWnd ) ) ) {
                pView = (CView *)pView->GetDescendantWindow( AFX_IDW_PANE_FIRST );
                if( pView->IsKindOf( RUNTIME_CLASS( CView ) ) ) {
                    SetActiveView( pView );
                }
            }
        }
    }
    if( pDoc != NULL ) {
        pDoc->UpdateFrameCounts();
    }
    OnUpdateFrameTitle( TRUE );
    SendMessageToDescendants( WM_INITIALUPDATE );
    if( bMakeVisible ) {
        CWinApp *pApp = AfxGetApp();
        ASSERT( pApp != NULL );
        if( pApp->m_pMainWnd == this ) {
            ActivateFrame( pApp->m_nCmdShow );
            pApp->m_nCmdShow = -1;
        } else {
            ActivateFrame();
        }
    }
}
Esempio n. 3
0
void CMainFrame::SwapView(int nCmdID)
{
	CDocument *pDoc;

	pDoc = GetActiveDocument();
	if(nCmdID == ID_VIEW_SOURCE)
	{
		//swap the view IDs
		m_pWebView->SetDlgCtrlID(AFX_IDW_PANE_LAST);
		m_pSrcView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);

		// show/hide the right view
		m_pWebView->ShowWindow(SW_HIDE);
		m_pSrcView->ShowWindow(SW_SHOW);

		//update the document
		//pDoc->AddView(m_pSrcView);
		//pDoc->RemoveView(m_pWebView);

		//re-layout everything
		SetActiveView(m_pSrcView);
		RecalcLayout();

		m_dwCurrentView = ID_VIEW_SOURCE;

		m_wndStatusBar.SetPaneText(1, _T("SRC VIEW"), TRUE);

		return;
	}
	else if(nCmdID == ID_VIEW_WEB)
	{
		//swap the view IDs
		m_pWebView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
		m_pSrcView->SetDlgCtrlID(AFX_IDW_PANE_LAST);

		// show/hide the right view
		m_pWebView->ShowWindow(SW_SHOW);
		m_pSrcView->ShowWindow(SW_HIDE);

		//update the document
		//pDoc->AddView(m_pWebView);
		//pDoc->RemoveView(m_pSrcView);

		//re-layout everything
		SetActiveView(m_pWebView);
		RecalcLayout();

		m_dwCurrentView = ID_VIEW_WEB;
		m_wndStatusBar.SetPaneText(1, _T("WEB VIEW"), TRUE);
		return;
	}

}
Esempio n. 4
0
BOOL CMainFrame::OnCreateClient (LPCREATESTRUCT lpcs, CCreateContext * pContext)
{
	struct	CCreateContext context = *pContext;
	CRect		rc;

if (!m_splitter1.CreateStatic (this, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER))
	return FALSE;
GetClientRect (rc);
rc.InflateRect (-2, -2);
if (nLayout) {
	context.m_pNewViewClass = RUNTIME_CLASS (CToolView);
	m_splitter1.CreateView (0, 0, RUNTIME_CLASS (CToolView), CSize (CX_TOOLS, rc.Height ()), &context);
	m_splitter1.SetRowInfo (0, rc.Height (), 16);
	m_splitter1.SetColumnInfo (0, CX_TOOLS, 16);
	m_splitter1.SetColumnInfo (1, rc.Width () - CX_TOOLS, 16);
	m_splitter2.CreateStatic (&m_splitter1, 2, 1, WS_CHILD | WS_VISIBLE | WS_BORDER, m_splitter1.IdFromRowCol(0, 1));
	context.m_pNewViewClass = RUNTIME_CLASS (CMineView);
	m_splitter2.CreateView (0, 0, RUNTIME_CLASS (CMineView), CSize (rc.Width (), rc.Height ()), &context);
	context.m_pNewViewClass = RUNTIME_CLASS (CTextureView);
	m_splitter2.CreateView (1, 0, RUNTIME_CLASS (CTextureView), CSize (rc.Width (), 0), &context);
	m_splitter2.SetRowInfo (0, rc.Height () - CY_TEXTURES, 16);
	m_splitter2.SetRowInfo (1, CY_TEXTURES, 16);
	m_splitter2.SetColumnInfo (0, rc.Width (), 0);
	SetActiveView ((CView*) m_splitter2.GetPane (0,0)); 
	m_toolView = (CToolView *) m_splitter1.GetPane (0,0);
	m_mineView = (CMineView *) m_splitter2.GetPane (0,0);
	m_textureView = (CTextureView *) m_splitter2.GetPane (1,0);
	}
else {
	context.m_pNewViewClass = RUNTIME_CLASS (CTextureView);
	m_splitter1.CreateView (0, 0, RUNTIME_CLASS (CTextureView), CSize (CX_TEXTURES, rc.Height ()), &context);
	m_splitter1.SetRowInfo (0, rc.Height (), 16);
	m_splitter1.SetColumnInfo (0, CX_TEXTURES, 16);
	m_splitter1.SetColumnInfo (1, rc.Width () - CX_TEXTURES, 16);
	m_splitter2.CreateStatic (&m_splitter1, 2, 1, WS_CHILD | WS_VISIBLE | WS_BORDER, m_splitter1.IdFromRowCol(0, 1));
	context.m_pNewViewClass = RUNTIME_CLASS (CMineView);
	m_splitter2.CreateView (0, 0, RUNTIME_CLASS (CMineView), CSize (rc.Width (), rc.Height ()), &context);
	context.m_pNewViewClass = RUNTIME_CLASS (CToolView);
	m_splitter2.CreateView (1, 0, RUNTIME_CLASS (CToolView), CSize (rc.Width (), 0), &context);
	m_splitter2.SetRowInfo (0, rc.Height () - CY_TOOLS, 16);
	m_splitter2.SetRowInfo (1, CY_TOOLS, 0);
	m_splitter2.SetColumnInfo (0, rc.Width (), 16);
	SetActiveView ((CView*)m_splitter2.GetPane(0,0)); 
	m_textureView = (CTextureView *) m_splitter1.GetPane (0,0);
	m_mineView = (CMineView *) m_splitter2.GetPane (0,0);
	m_toolView = (CToolView *) m_splitter2.GetPane (1,0);
	}
return TRUE;
}
Esempio n. 5
0
void CMainFrame::SwitchToView(eView nView)
{
	CView* pOldActiveView = GetActiveView();
	CView* pNewActiveView = (CView*) GetDlgItem(nView);
	if (pNewActiveView == NULL) {
		switch (nView) {
		case STRING:
			pNewActiveView = (CView*) new CStringView;
			break;
		case HEX:
			pNewActiveView = (CView*) new CHexView;
			break;
		}
		CCreateContext context;
		context.m_pCurrentDoc = pOldActiveView->GetDocument();
		pNewActiveView->Create(NULL, NULL, WS_BORDER,
			CFrameWnd::rectDefault, this, nView, &context);
		pNewActiveView->OnInitialUpdate();
	}
	SetActiveView(pNewActiveView);
	pNewActiveView->ShowWindow(SW_SHOW);
	pOldActiveView->ShowWindow(SW_HIDE);
	pOldActiveView->SetDlgCtrlID(
		pOldActiveView->GetRuntimeClass() == 
		RUNTIME_CLASS(CStringView) ? STRING : HEX);
	pNewActiveView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
	RecalcLayout();
}
Esempio n. 6
0
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
	CCreateContext* pContext)
{
	// create a splitter with 1 row, 2 columns
	if (!m_wndSplitter.CreateStatic(this, 1, 2))
	{
		TRACE0("Failed to Splitter window\n");
		return FALSE;
	}

	// add the first splitter pane - the default view in column 0
	if (!m_wndSplitter.CreateView(0, 0,
		pContext->m_pNewViewClass, CSize(275, 150), pContext))
	{
		TRACE0("Failed to create first pane\n");
		return FALSE;
	}

	// add the second splitter pane - an input view in column 1
	if (!m_wndSplitter.CreateView(0, 1,
			RUNTIME_CLASS(CDynSplitView2), CSize(0, 0), pContext))
	{
		TRACE0("Failed to create second pane\n");
		return FALSE;
	}

	// activate the input view
	SetActiveView((CView*)m_wndSplitter.GetPane(0,1));

	return TRUE;
}
Esempio n. 7
0
int CPrintFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
	{
        return -1;
	}

    CCreateContext context;
    context.m_pNewViewClass = RUNTIME_CLASS(CPrintView);
    context.m_pCurrentFrame = this;
    context.m_pCurrentDoc = NULL;
    context.m_pLastView = NULL;
    m_pView = STATIC_DOWNCAST(CPrintView, CreateView(&context)); 
    if(m_pView != NULL)
    {
        m_pView->ShowWindow(SW_SHOW);
        SetActiveView(m_pView);
    }
    SetIcon(m_pOldWnd->GetIcon(FALSE),FALSE);
	SetIcon(m_pOldWnd->GetIcon(TRUE),TRUE);
	ShowWindow(SW_MAXIMIZE);
	CWinApp* pApp=AfxGetApp();
	m_pOldFram = pApp->m_pMainWnd;
	pApp->m_pMainWnd=this;
	m_pView->OnFilePrintPreview();
    //m_pView->SendMessage(WM_COMMAND, ID_FILE_PRINT);//直接打印
    m_pOldWnd->ShowWindow(SW_HIDE);
    return 0;
}
Esempio n. 8
0
//-----------------------------------------------------------------------------
// Purpose: Calls ReplaceView with the appropriate runtime class information to
//			switch the active view to given view type.
// Input  : eViewType - 2d xy, xz, 3d textured, flat, etc.
//-----------------------------------------------------------------------------
void CChildFrame::SetViewType(DrawType_t eViewType)
{
	CMapView *pNewView = NULL;

	switch (eViewType)
	{
		case VIEW2D_XY:
		case VIEW2D_XZ:
		case VIEW2D_YZ:
		{
			pNewView = (CMapView2D *)ReplaceView(RUNTIME_CLASS(CMapView2D));
			break;
		}

		case VIEW3D_WIREFRAME:
		case VIEW3D_POLYGON:
		case VIEW3D_TEXTURED:
		case VIEW3D_LIGHTMAP_GRID:
		case VIEW3D_LIGHTING_PREVIEW:
		case VIEW3D_SMOOTHING_GROUP:
		{
			pNewView = (CMapView *)ReplaceView(RUNTIME_CLASS(CMapView3D));
			break;
		}
	}

	if (pNewView != NULL)
	{
		SetActiveView(pNewView);
		pNewView->SetDrawType(eViewType);
		pNewView->UpdateWindow();
	}
}
Esempio n. 9
0
	bool CloseCanvas(ICmdParam& cmd,wxWindow* w=NULL)
	{
		wxWindow* pPage=w?w:m_pCurrentCanvas;
		if(!pPage) return false;

		int nSelection=this->GetPageIndex(pPage);
		if(nSelection<0) return false;

		LockGuard<WndUpdator> lock(wm.wup);

		MvcView* pView=MvcView::GetViewByCanvas(pPage);
		if(pView)
		{
			if(!pView->OnClose(wm))
			{
				return false;
			}
			wm.book.DetachView(pView);
		}

		if(m_pCurrentCanvas==pPage)
		{
			m_pCurrentCanvas.reset(NULL);
			SetActiveView(NULL);
		}

		DeletePage(nSelection);
		wm.wup.gp_add("CmdProc");

		return true;
	}
Esempio n. 10
0
	void OnCanvasClosing(wxAuiNotebookEvent& evt)
	{
		wm.wup.lock();

		wxWindow* pPage=GetPage(evt.GetSelection());
		EW_ASSERT(pPage!=NULL);

		MvcView* pView=MvcView::GetViewByCanvas(pPage);
		if(!pView)
		{
			return;
		}

		ICmdParam cmd(-1);
		if(!pView->OnClose(wm))
		{
			evt.Veto();
			wm.wup.unlock();
			return;
		}

		if(pPage==m_pCurrentCanvas)
		{
			m_pCurrentCanvas.reset(NULL);
			SetActiveView(NULL);
		}

		wm.book.DetachView(pView);

	}
Esempio n. 11
0
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
	//划分窗口
	if (!m_wndSplitter.CreateStatic(this, 2, 1))				//划分为2*1
	{
		m_wndOutput<<("FAILED to Create static spitter")<<m_EndOut;
		return FALSE;
	}
	CRect rct;
	this->GetClientRect(rct);
	ScreenToClient(rct);
	if (!m_wndSplitter.CreateView(0, 0,
		RUNTIME_CLASS(CCoreModelView), CSize(0, 550), pContext))		//显示应用视图
	{
		m_wndOutput<<("Failed to create first pane\n")<<m_EndOut;
		return FALSE;
	}
	if (!m_wndSplitter.CreateView(1, 0,
		RUNTIME_CLASS(CEEGView), CSize(0, 0), pContext))				//显示信号视图	
	{
		m_wndOutput<<("Failed to create second pane\n")<<m_EndOut;
		return FALSE;
	}
	SetActiveView((CView*)m_wndSplitter.GetPane(0, 0));
	CRect rect1, rect2;
	(m_wndSplitter.GetPane(0, 0))->GetClientRect(rect1);
	(m_wndSplitter.GetPane(1, 0))->GetClientRect(rect2);
	m_wndSplitter.SetHeight(rect1.Height() + rect2.Height());
	return CFrameWndEx::OnCreateClient(lpcs, pContext);
	//return TRUE;
}
Esempio n. 12
0
BOOL CStackedView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
			UINT nID, CCreateContext* pContext)
{
	BOOL bStatus = CView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
	if (bStatus == TRUE)
	{
		SetWindowText(_T("CStackedView"));

		int nViewOffset = 1;

		m_pBlankView = dynamic_cast<CBlankView*>(RUNTIME_CLASS(CBlankView)->CreateObject());
		m_pBlankView->Create(NULL, _T("BlankView"), 0, CFrameWnd::rectDefault, this, 100, pContext);		
		m_pBlankView->SetDlgCtrlID(AFX_IDW_PANE_FIRST + nViewOffset++);

		m_pWebSiteContainerWnd = dynamic_cast<CWebSiteContainerWnd*>(RUNTIME_CLASS(CWebSiteContainerWnd)->CreateObject());		
		m_pWebSiteContainerWnd->Create(NULL, _T("CWebSiteContainerWnd"), WS_CHILD | WS_VISIBLE, CFrameWnd::rectDefault, this, 101, pContext);
		m_pWebSiteContainerWnd->SetDlgCtrlID(AFX_IDW_PANE_FIRST + nViewOffset++);

		m_pResponseHistoryView = dynamic_cast<CResponseHistoryView*>(RUNTIME_CLASS(CResponseHistoryView)->CreateObject());
		m_pResponseHistoryView->Create(NULL, _T("CResponseHistoryView"), WS_CHILD | WS_VISIBLE, CFrameWnd::rectDefault, this, 102, pContext);
		m_pResponseHistoryView->SetDlgCtrlID(AFX_IDW_PANE_FIRST + nViewOffset++);

		SetActiveView(m_pBlankView);
	}

	return bStatus;
}
Esempio n. 13
0
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext )
{
	m_wndView = new CEditorView;
	if (!m_wndView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, lpcs->cx, lpcs->cy), this, AFX_IDW_PANE_FIRST, NULL))
		return FALSE;
	SetActiveView(m_wndView);

	return TRUE;
}
Esempio n. 14
0
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
	CRect rect;

	if (!m_wndSplitterV.CreateStatic(this, 2, 1))
	{
		TRACE0("Failed to CreateStaticSplitter\n");
		return FALSE;
	}

	if (!m_wndSplitterV.CreateView(1, 0, RUNTIME_CLASS(CMatView), CSize(0, 0), pContext))
	{
		TRACE0("Failed to create second pane\n");
		return FALSE;
	}

	GetClientRect(rect);

	// add the second splitter pane - which is a nested splitter with 2 rows
	if (!m_wndSplitterH.CreateStatic(
		&m_wndSplitterV,     // our parent window is the first splitter
		1, 2,               // the new splitter is 2 rows, 1 columns
		WS_CHILD | WS_VISIBLE | WS_BORDER,  // style, WS_BORDER is needed
		m_wndSplitterV.IdFromRowCol(0, 0)
			// new splitter is in the first row, 2nd column of first splitter
	   ))
	{
		TRACE0("Failed to create nested splitter\n");
		return FALSE;
	}

	// add the first splitter pane - the default view in column 0
	if (!m_wndSplitterH.CreateView(0, 0, RUNTIME_CLASS(CCamView), CSize(0, 0), pContext))
	{
		TRACE0("Failed to create first pane\n");
		return FALSE;
	}

	// now create the two views inside the nested splitter
	if (!m_wndSplitterH.CreateView(0, 1,
		RUNTIME_CLASS(CBrowserView), CSize(0, 0), pContext))
	{
		TRACE0("Failed to create third pane\n");
		return FALSE;
	}

	// activate the input view
	SetActiveView((CView*)m_wndSplitterH.GetPane(0, 0));

	((CCamView*)m_wndSplitterH.GetPane(0, 0))->pBrowserView = (CBrowserView*)m_wndSplitterH.GetPane(0, 1);
	((CBrowserView*)m_wndSplitterH.GetPane(0, 1))->pCamView = (CCamView*)m_wndSplitterH.GetPane(0, 0);
	((CCamView*)m_wndSplitterH.GetPane(0, 0))->pMatView = (CMatView*)m_wndSplitterV.GetPane(1, 0);

	((CMatView*)m_wndSplitterV.GetPane(1, 0))->m_pPalette = &m_cPalette;

	return TRUE;
}
Esempio n. 15
0
void CChildFrame::DeleteViewsExcept( CWnd *pwndViewToLeave)
{
  // delete all rows
  INDEX iRowToDelete = 0;
  while( iRowToDelete<GetVSplitters())
  {
    BOOL bCanDeleteRow = TRUE;
    // for all collumns
    for( INDEX iColumn=0; iColumn<GetHSplitters(); iColumn++)
    {
      if( m_wndSplitter.GetPane( iRowToDelete, iColumn) == pwndViewToLeave)
      {
        bCanDeleteRow = FALSE;
        break;
      }
    }
    if( bCanDeleteRow)
    {
      m_wndSplitter.DeleteRow( iRowToDelete);
    }
    else
    {
      iRowToDelete++;
    }
  }

  // delete all columns
  INDEX iColumnToDelete = 0;
  while( iColumnToDelete<GetHSplitters())
  {
    BOOL bCanDeleteColumn = TRUE;
    // for all collumns
    for( INDEX iRow=0; iRow<GetVSplitters(); iRow++)
    {
      if( m_wndSplitter.GetPane( iRow, iColumnToDelete) == pwndViewToLeave)
      {
        bCanDeleteColumn = FALSE;
        break;
      }
    }
    if( bCanDeleteColumn)
    {
      m_wndSplitter.DeleteColumn( iColumnToDelete);
    }
    else
    {
      iColumnToDelete++;
    }
  }

  // activate view that we want to leave
  SetActiveView( (CView*)pwndViewToLeave, FALSE);
}
Esempio n. 16
0
	void OnCanvasClosed(wxAuiNotebookEvent& evt)
	{
		(void)&evt;

		if(this->GetPageCount()==0)
		{
			m_pCurrentCanvas.reset(NULL);
			SetActiveView(NULL);
			wm.wup.gp_add("CmdProc");
		}

		wm.wup.unlock();
	}
Esempio n. 17
0
BOOL CProgPaneWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	// TODO: Add your specialized code here and/or call the base class
	m_pProgressView = new CProgressView;
	((CView *)m_pProgressView)->Create(NULL,NULL,0L,CFrameWnd::rectDefault,this, VIEW_PROGRESS,pContext);
	m_pProgressView->SetDlgCtrlID(VIEW_PROGRESS);
	m_pProgressView->ShowWindow(SW_SHOW);
	m_pProgressView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
	m_nCurrentViewID = VIEW_PROGRESS;
	SetActiveView(m_pProgressView);
	RecalcLayout();
	return TRUE;
	return CFrameWnd::OnCreateClient(lpcs, pContext);
}
Esempio n. 18
0
BOOL CChildFrame::OnCreateClient( LPCREATESTRUCT lpcs,
	CCreateContext* pContext)
{

   m_pDoc = (CMUSHclientDoc*) pContext->m_pCurrentDoc;
   ASSERT_VALID(m_pDoc);


  m_wndSplitter.m_pDoc = m_pDoc;

#ifdef USE_EXTRA_PANE
  if (m_wndSplitter.CreateStatic(this,3,1))
#else
  if (m_wndSplitter.CreateStatic(this,2,1))
#endif

	  {
		CRect rect;
		GetOwner ()->GetClientRect(&rect);
		CSize size = rect.Size();
		size.cy-=150;
		if (!m_wndSplitter.CreateView(OUTPUT_PANE,0,RUNTIME_CLASS(CMUSHView),size,pContext))
      return FALSE;
		if (!m_wndSplitter.CreateView(COMMAND_PANE,0,RUNTIME_CLASS(CSendView),CSize(0,0),pContext))
      return FALSE;

    CMUSHView * topview     = (CMUSHView *) m_wndSplitter.GetPane(OUTPUT_PANE,0);
    CSendView * bottomview  = (CSendView *) m_wndSplitter.GetPane(COMMAND_PANE,0);
    m_topview = topview;    // for idle processing
    bottomview->m_topview = topview;
    topview->m_owner_frame = this;
    topview->m_bottomview = bottomview;
    bottomview->m_owner_frame = this;
		SetActiveView((CView*) bottomview);

#ifdef USE_EXTRA_PANE

		if (!m_wndSplitter.CreateView(EXTRA_PANE,0,RUNTIME_CLASS(CPaneView),CSize(20,0),pContext))
      return FALSE;

#endif

    return TRUE;
		}

	return FALSE;
}
Esempio n. 19
0
BOOL CPGPFoneFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	//Set up the status bar:
	mStatusBar.Create(this);
	mStatusBar.setPhoneIconID(0);
	mStatusBar.setSecureIconID(0);

	CCreateContext cc;
	
	cc.m_pNewViewClass = RUNTIME_CLASS(CPFWindow);

	mCallView = (CPFWindow *)CreateView(&cc);
	
	SetActiveView((CView*)mCallView);
	
	return CFrameWnd::OnCreateClient(lpcs, pContext);
}
Esempio n. 20
0
BOOL CWinnerView::OpenLayout(CString strTarget,CString strLayoutName,CString strOwner,IHSParam *pParam /*== NULL*/)
{
	AFX_MANAGE_STATE(AfxGetAppModuleState());

	CLogTimeSapn lts(_T("CWinnerView::OpenLayout: strTarget=") + strTarget
		+ _T(" strLayoutName=") + strLayoutName);

	if(strTarget == CURRENT_LAYOUT_TARGET)
	{
		CString strRealLayoutName = strLayoutName;
		CLayoutView* pView = CreateLayoutView(strLayoutName,strOwner);
		SetActiveView(pView);//设置活动视图
		AdjustLayout();
// 		pView->ShowWindow(SW_HIDE);
// 		pView->ShowWindow(SW_SHOW);
		CLayoutEntity* pLayoutEntity = GetLayoutEntity(strLayoutName,strOwner);
		if( pLayoutEntity != NULL)
		{
			pLayoutEntity->GetLayoutContext()->NotifyToBizWindows(WM_BIZWINDOW_NOTIFY,BWN_WINDOW_SHOW,0,TRUE);
			if(pParam)
			{
				pLayoutEntity->GetLayoutContext()->NotifyFocusWindow(TRUE);
				pLayoutEntity->GetLayoutContext()->NotifyToBizWindows(WM_BIZWINDOW_NOTIFY,BWN_PARAM_CHANGED,LPARAM(pParam),FALSE);
			}
			else
				pLayoutEntity->GetLayoutContext()->NotifyFocusWindow(TRUE);
		}
	}
	else //在活动布局中打开子布局
	{
		if(m_pActiveLayoutEntity == NULL)
			return FALSE;
		ILayoutWindow *pLayoutWnd =	m_pActiveLayoutEntity->GetLayoutContext()->GetLayoutWindow(strTarget);
		if(pLayoutWnd != NULL)
			pLayoutWnd->OpenLayout(CURRENT_LAYOUT_TARGET,strLayoutName,strOwner,pParam);
		else
		{
			CString strError;
			strError.Format(_T("打开子布局[%s]失败.\ntarget=%s"),strLayoutName,strTarget);
			CMessagePromptDialog dlg;
			dlg.ShowMsg(CMessagePromptDialog::mtError,strError);
			return FALSE;
		}
	}
	return TRUE;
}
Esempio n. 21
0
void CMainFrame::OnOutlookBarShortcut(UINT id)
{
	const int nIndex = id - ID_SHORTCUT_1;

	ASSERT( nIndex >=0 && nIndex < NUMVIEWS );
	if ( nIndex < 0 || nIndex >= NUMVIEWS )
		return;

	if (!m_pViews)
		return;

	CView* pNewView = m_pViews[nIndex];
	if (!pNewView)
		return;

	CView* pActiveView =GetActiveView();

	if ( !pActiveView )    // No currently active view
		return;

	if ( pNewView == pActiveView )    // Already there
		return;

	m_nCurView = nIndex;    // Store the new current view's index

	// exchange view window ID's so RecalcLayout() works
	UINT temp = ::GetWindowLong(pActiveView->m_hWnd, GWL_ID);
	::SetWindowLong(pActiveView->m_hWnd, GWL_ID,
		::GetWindowLong(pNewView->m_hWnd, GWL_ID));
	::SetWindowLong(pNewView->m_hWnd, GWL_ID, temp);

	// Display and update the new current view - hide the old one    
	pActiveView->ShowWindow(SW_HIDE);
	pNewView->ShowWindow(SW_SHOW);
	SetActiveView(pNewView);
	RecalcLayout();
	pNewView->Invalidate();

	CString strCaption;
	strCaption.Format (_T("View %d"), nIndex + 1);

	m_wndCaptionBar.SetText (strCaption);
	m_wndCaptionBar.RedrawWindow ();
}
Esempio n. 22
0
void CMainFrame::SwitchView(ViewType nType)
{
	CView* pOldView = GetActiveView();
	CView* pNewView = (CView*)GetDlgItem(nType);

	if(pNewView == NULL)
	{
		switch(nType)
		{
		case FORMVIEW:
			pNewView = (CView*)new CMultiLookView;
			break;
		case FONTVIEW:
			pNewView = (CView*)new CFontView;
			break;
		case PAINTVIEW:
			pNewView = (CView*)new CPaintView;
			break;
		}

		CCreateContext context;
		context.m_pCurrentDoc = pOldView->GetDocument();
		pNewView->Create(NULL, NULL, WS_BORDER, 
			CFrameWnd::rectDefault, this, nType, &context);
		pNewView->OnInitialUpdate();
	}

	SetActiveView(pNewView);
	pNewView->ShowWindow(SW_SHOW);
	pOldView->ShowWindow(SW_HIDE);
	if(pOldView->GetRuntimeClass() == RUNTIME_CLASS(CMultiLookView))
		pOldView->SetDlgCtrlID(FORMVIEW);
	if(pOldView->GetRuntimeClass() == RUNTIME_CLASS(CFontView))
		pOldView->SetDlgCtrlID(FONTVIEW);
	if(pOldView->GetRuntimeClass() == RUNTIME_CLASS(CPaintView))
		pOldView->SetDlgCtrlID(PAINTVIEW);

	pNewView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
	RecalcLayout();
	
}
Esempio n. 23
0
	bool SetCurrentCanvas(wxWindow* w)
	{
		if(m_pCurrentCanvas.get()==w) return true;

		EW_ASSERT(MvcView::GetViewByCanvas(m_pCurrentCanvas)==m_pActiveView);

		if(m_pActiveView && !m_pActiveView->OnActivate(wm,-1))
		{
			return false;
		}

		m_pCurrentCanvas.reset(w);

		SetActiveView(MvcView::GetViewByCanvas(w));

		if(m_pActiveView)
		{
			m_pActiveView->OnActivate(wm,+2);
		}

		return true;
	}
Esempio n. 24
0
void CMainFrame::OnViewPrediction()
{
	// TODO: Add your command handler code here
	CDocument* pDoc;
	CView* pView;
	CCreateContext context;
	CRect rect;
	pView=(CView*)m_splitter.GetPane(0,0);
	pView->GetWindowRect(rect);
	if(!pView)
	{
		AfxMessageBox("Unexpected error occurs");
		return;
	}
	pDoc=pView->GetDocument();
	CString title=pDoc->GetTitle();
	if(!pDoc)
	{
		AfxMessageBox("Unexpected error occurs");
		return;
	}
	pDoc->m_bAutoDelete=false;
	m_splitter.GetPane(0,0)->DestroyWindow();
	pDoc->m_bAutoDelete=true;
	context.m_pNewViewClass=RUNTIME_CLASS(CPredView);
	context.m_pCurrentDoc=pDoc;
	context.m_pLastView=NULL;
	context.m_pNewDocTemplate=NULL;
	context.m_pCurrentFrame=NULL;
	m_splitter.CreateView(0,0,RUNTIME_CLASS(CPredView),CSize(rect.Width(),rect.Height()),&context);
	((CView*)m_splitter.GetPane(0,0))->OnInitialUpdate();// it is important to call initial update before create a view expecially a CScrollView
	m_splitter.RecalcLayout();
	m_splitter.GetPane(0,0)->SendMessage(WM_PAINT);
	SetActiveView((CScrollView*)m_splitter.GetPane(0,0));
	pDoc->SetTitle(title);
	((CFCCDoc*)pDoc)->MessageCenter(IDS_MESSAGE_MAKEPREDICTION);
	

}
Esempio n. 25
0
void Window::MouseEvent( int what, int x, int y, unsigned int buttons )
{

    // Backwards, as added.
    lock();
    for ( int i = CountChildren() - 1; i >= 0; i-- )
    {
        View *view = ChildAt(i);

        if ( view->Frame().Contains( x,y ) )
        {
            int nx = x - view->Frame().left;
            int ny = y - view->Frame().top;

            SetActiveView( view );
            view->MouseEvent( what, nx, ny, buttons );
            break;
        }
    }
    unlock();

}
Esempio n. 26
0
//-----------------------------------------------------------------------------
// Purpose: Calls ReplaceView with the appropriate runtime class information to
//			switch the active view to given view type.
// Input  : eViewType - 2d xy, xz, 3d textured, flat, etc.
//-----------------------------------------------------------------------------
void CChildFrame::SetViewType(DrawType_t eViewType)
{
	CMapView *pNewView = NULL;
	
	switch (eViewType)
	{
		case VIEW2D_XY:
		case VIEW2D_XZ:
		case VIEW2D_YZ:
			pNewView = (CMapView2D *)ReplaceView(RUNTIME_CLASS(CMapView2D));
			break;

		case VIEW_LOGICAL:
			pNewView = (CMapViewLogical *)ReplaceView(RUNTIME_CLASS(CMapViewLogical));
			break;

		default:
		case VIEW3D_WIREFRAME:
		case VIEW3D_POLYGON:
		case VIEW3D_TEXTURED:
		case VIEW3D_TEXTURED_SHADED:
		case VIEW3D_LIGHTMAP_GRID:
		case VIEW3D_LIGHTING_PREVIEW2:
		case VIEW3D_LIGHTING_PREVIEW_RAYTRACED:
		case VIEW3D_SMOOTHING_GROUP:
		//case VIEW3D_ENGINE:
			pNewView = (CMapView3D *)ReplaceView(RUNTIME_CLASS(CMapView3D));
			break;
	}

	if (pNewView != NULL)
	{
		SetActiveView( dynamic_cast<CView*>(pNewView->GetViewWnd()) );
		pNewView->SetDrawType(eViewType);
		pNewView->UpdateView( MAPVIEW_UPDATE_OBJECTS );
	}
}
Esempio n. 27
0
BOOL CfEventSetting::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	//
	//          Nest Splitter ->*
	// ------------------------ * -----------------------
	// |                       |*                        |
	// |                       |*                        |
	// | CvEventSettingLeft    |* CvEventSettingRight    |
	// |                       |*                        |
	// ------------------------ *------------------------ 
	// *************************************************** <-- Main Splitter
	//
	// List of Event category View (CvEventSettingBottom)
	//

	ASSERT (m_pEventSettingDoc);
	if (!m_pEventSettingDoc)
	{
		TRACE0 ("Main document is NULL while creating CfEventSetting\n");
		return FALSE;
	}
	CCreateContext context1, context2, context3;
	CRuntimeClass* pView1 = RUNTIME_CLASS(CvEventSettingLeft);
	CRuntimeClass* pView2 = RUNTIME_CLASS(CvEventSettingRight);
	CRuntimeClass* pView3 = RUNTIME_CLASS(CvEventSettingBottom);
	
	context1.m_pNewViewClass = pView1;
	context1.m_pCurrentDoc   = m_pEventSettingDoc;
	context2.m_pNewViewClass = pView2;
	context2.m_pCurrentDoc   = context1.m_pCurrentDoc;
	context3.m_pNewViewClass = pView3;
	context3.m_pCurrentDoc   = context1.m_pCurrentDoc;
	CRect r;
	GetClientRect (r);
	CSize v1Size ((int)(r.Width()/2), (int)(r.Height()*0.6));
	CSize v2Size ((int)(r.Width()/2), (int)(r.Height()*0.6));
	CSize v3Size (r.Width(), (int)(r.Height()*0.4));
	//
	// Create a main splitter of 2 rows and 1 column.
	//
	if (!m_MainSplitterWnd.CreateStatic (this, 2, 1))
	{
		TRACE0 ("CfEventSetting::OnCreateClient: Failed to create Splitter\n");
		return FALSE;
	}
	//
	// Create a nested splitter which has 1 row and 2 columns.
	// It is child of the second pane of the main splitter.
	BOOL b = m_NestSplitterWnd.CreateStatic (
		&m_MainSplitterWnd, // Parent is the main splitter.
		1,                  // 1 row.
		2,                  // 2 columns.
		WS_CHILD|WS_VISIBLE|WS_BORDER,  m_MainSplitterWnd.IdFromRowCol (0, 0));
	if (!b)
	{
		TRACE0 ("CfEventSetting::OnCreateClient: Failed to create Nested Splitter\n");
		return FALSE;
	}
	//
	// Add the first splitter pane of a nested splitter - the view (CvEventSettingLeft) in row 0 column 0
	// of the main splitter.
	//
	if (!m_NestSplitterWnd.CreateView (0, 0, pView1, v1Size, &context1))
	{
		TRACE0 ("CfEventSetting::OnCreateClient: Failed to create first pane\n");
		return FALSE;
	}
	//
	// Add the first splitter pane of the Nested Splitter -
	// the View (CvEventSettingLeft) in Row 0 col 1
	if (!m_NestSplitterWnd.CreateView (0, 1, pView2, v2Size, &context2))
	{
		TRACE0 ("CfEventSetting::OnCreateClient: Failed to create second pane\n");
		return FALSE;
	}
	//
	// Add the second splitter pane of the main Splitter - 
	// the View (CvEventSettingBottom) in  row 1 column 0
	if (!m_MainSplitterWnd.CreateView (1, 0, pView3, v3Size, &context3))
	{
		TRACE0 ("CfEventSetting::OnCreateClient: Failed to create first pane\n");
		return FALSE;
	}


	m_MainSplitterWnd.SetRowInfo    (0, v1Size.cy, 10);
	m_MainSplitterWnd.SetRowInfo    (1, v3Size.cy, 10);
	m_MainSplitterWnd.RecalcLayout();
	m_NestSplitterWnd.RecalcLayout();
	m_bAllViewCreated = TRUE;
	SetActiveView ((CView*)m_NestSplitterWnd.GetPane(0, 0));
	return TRUE;

	return TRUE;
}
Esempio n. 28
0
void CSizingTabCtrlBar::OnTabSelChange(NMHDR* pNMHDR, LRESULT* pResult)
{
	SetActiveView(m_tabctrl.GetCurSel());
}
Esempio n. 29
0
void CMainFrame::OnViewChange(UINT nCmdID)
// There is an ON_COMMAND_RANGE message map entry associated with
// OnViewChange:
// ON_COMMAND_RANGE(ID_VIEW_CHANGE1, ID_VIEW_CHANGE2, &OnViewChange)
{
   CView* pViewAdd;
   CView* pViewRemove;
   CDocument* pDoc = GetActiveDocument();

   // cvView1 and cvView2 are enum members defined in my CMainFrame class
   if((nCmdID == ID_VIEW_CHANGE1) && (m_currentView == cvView1))
      return;
   if((nCmdID == ID_VIEW_CHANGE2) && (m_currentView == cvView2))
      return;

   if (nCmdID == ID_VIEW_CHANGE2)
   {
      if (m_pView2 == NULL)
      {
         m_pView1 = GetActiveView();
         m_pView2 = new CMyView2;

         //Note that if OnSize has been overridden in CMyView2 
         //and GetDocument() is used in this override it can 
         //cause assertions and, if the assertions are ignored,
         //cause access violation.

         m_pView2->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, rectDefault, this, 
            AFX_IDW_PANE_FIRST + 1, NULL);
      }
      pViewAdd = m_pView2;
      pViewRemove = m_pView1;
      m_currentView = cvView2;
   }
   else
   {
      pViewAdd = m_pView1;
      pViewRemove = m_pView2;
      m_currentView = cvView1;
   }

   // Set the child i.d. of the active view to AFX_IDW_PANE_FIRST,
   // so that CFrameWnd::RecalcLayout will allocate to this 
   // "first pane" that portion of   the frame window's client area 
   // not allocated to control   bars.  Set the child i.d. of the 
   // other view to anything other than AFX_IDW_PANE_FIRST; this
   // examples switches the child id's of the two views.

   int nSwitchChildID = pViewAdd->GetDlgCtrlID();
   pViewAdd->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
   pViewRemove->SetDlgCtrlID(nSwitchChildID);

   // Show the newly active view and hide the inactive view.

   pViewAdd->ShowWindow(SW_SHOW);
   pViewRemove->ShowWindow(SW_HIDE);

   // Connect the newly active view to the document, and
   // disconnect the inactive view.
   pDoc->AddView(pViewAdd);
   pDoc->RemoveView(pViewRemove);

   SetActiveView(pViewAdd);
   RecalcLayout();
}
Esempio n. 30
0
void CCoolFormat3View::SaveEditFile( CString lpszPathName )
{
	SetActiveView(0);
	CSynBCGPEditView *pEditView = (CSynBCGPEditView *)GetActiveView();
	pEditView->GetEditCtrl()->SaveFileEx(lpszPathName);
}