コード例 #1
0
ファイル: mainfrm.cpp プロジェクト: jetlive/skiaming
BOOL CMainFrame::OnQueryNewPalette()
{
	CView* pView = GetActiveView();
	if (pView != NULL)
		return (BOOL) pView->SendMessage(WM_QUERYNEWPALETTE);
	return FALSE;
}
コード例 #2
0
ファイル: CPluginApp.cpp プロジェクト: fre2003/l3220
// 在 Frame中发消息给View 
U32 CPluginApp_i::SendMessageToView(UINT ulMsg, WPARAM wParam, LPARAM lParam) 
{
  CWinApp* pWinApp = AfxGetApp();
  if(pWinApp)
  {
    POSITION DocTemplatePos = pWinApp->GetFirstDocTemplatePosition();
  
    //while(DocTemplatePos)
    {
	    CMultiDocTemplate* pDocTemp = (CMultiDocTemplate*)pWinApp->GetNextDocTemplate(DocTemplatePos);
    
      //  
 	    POSITION pos = pDocTemp->GetFirstDocPosition ();
  
      // Find the doc within the same doctemplate.
      while (pos)
      {
	      CDocument* pDoc     = pDocTemp->GetNextDoc (pos);
	      POSITION ViewPos    = pDoc->GetFirstViewPosition ();
	      CView* pView        = pDoc->GetNextView (ViewPos);
        if(pView)
        {
          CMDIChildWnd* pFrame = (CMDIChildWnd*)pView->GetParentFrame();
          if(pFrame == this)
          {
            //OutputDebugString("Find!\n");
            pView->SendMessage(ulMsg, wParam, lParam);
          } 
        }
      }
    }
  }
  
  return 0;
}
コード例 #3
0
void CResizableFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) 
{
	MinMaxInfo(lpMMI);

	CView* pView = GetActiveView();
	if (pView == NULL)
		return;

	// get the extra size from view to frame
	CRect rectClient, rectWnd;
	GetWindowRect(rectWnd);
	RepositionBars(0, 0xFFFF, AFX_IDW_PANE_FIRST, reposQuery, rectClient);
	CSize sizeExtra = rectWnd.Size() - rectClient.Size();

	// ask the view for track size
	MINMAXINFO mmiView = *lpMMI;
	pView->SendMessage(WM_GETMINMAXINFO, 0, (LPARAM)&mmiView);
	mmiView.ptMaxTrackSize = sizeExtra + mmiView.ptMaxTrackSize;
	mmiView.ptMinTrackSize = sizeExtra + mmiView.ptMinTrackSize;

	// min size is the largest
	lpMMI->ptMinTrackSize.x = __max(lpMMI->ptMinTrackSize.x,
		mmiView.ptMinTrackSize.x);
	lpMMI->ptMinTrackSize.y = __max(lpMMI->ptMinTrackSize.y,
		mmiView.ptMinTrackSize.y);

	// max size is the shortest
	lpMMI->ptMaxTrackSize.x = __min(lpMMI->ptMaxTrackSize.x,
		mmiView.ptMaxTrackSize.x);
	lpMMI->ptMaxTrackSize.y = __min(lpMMI->ptMaxTrackSize.y,
		mmiView.ptMaxTrackSize.y);
}
コード例 #4
0
ファイル: stylepge.cpp プロジェクト: jetlive/skiaming
void CStylePage::OnStyleClicked(UINT /*nCmdID*/)
{
	// The CStylePage property page is used for both the
	// CModalShapePropSheet and the CModelessShapePropSheet.
	// Both these versions of the property sheet share a common
	// feature that they immediately update a shape.  In the
	// case of CModalShapePropSheet, the shape is in the preview
	// window.  In the case of CModelessShapePropSheet, the shape
	// is the currently selected shape in the view.

	CPropertySheet* pSheet = STATIC_DOWNCAST(CPropertySheet, GetParent());

	CModalShapePropSheet* pModalSheet =
		DYNAMIC_DOWNCAST(CModalShapePropSheet, pSheet);
	if (pModalSheet != NULL)
	{
		UpdateData();
		pModalSheet->UpdateShapePreview();
		SetModified(); // enable Apply Now button
	}

	CModelessShapePropSheet* pModelessSheet =
		DYNAMIC_DOWNCAST(CModelessShapePropSheet, pSheet);
	if (pModelessSheet != NULL)
	{
		UpdateData();
		CFrameWnd* pFrameWnd = STATIC_DOWNCAST(CFrameWnd, AfxGetMainWnd());
		CView* pView = pFrameWnd->GetActiveFrame()->GetActiveView();
		pView->SendMessage(WM_USER_CHANGE_OBJECT_PROPERTIES, 0, 0);
	}
}
コード例 #5
0
ファイル: MainFrm.cpp プロジェクト: jhkoivis/lumikki
BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pData) {
    
	//TRACE("OnCopyData Accessed\n");
	//std::string *msg = (std::string*)pData->lpData;
	//TRACE("CMainframe     msg: %s\n",msg->c_str());

	//int msgId = pData->dwData;
	//int msgSize = pData->cbData;
	//std::string *filename = (std::string*)pData->lpData;

	COPYDATASTRUCT data;
	//data.dwData = msgId;
	//data.cbData = msgSize;
	//data.lpData = msg;
	data.dwData = pData->dwData;
	data.cbData = pData->cbData;
	data.lpData = pData->lpData;


		
	CView *pView = GetActiveView();
	if (pView == NULL){
		TRACE("pView == NULL\n");
	}
	else{
	    pView->SendMessage(WM_COPYDATA,0,(LPARAM)&data);
		//TRACE("CMainFrame::OnCopyData message sent\n");
	}
	

	return TRUE;
}
コード例 #6
0
void KCDialogSet::OnOk()
{
	// TODO: Add your control notification handler code here
	UINT nTemp = 0;
	m_pParHand = (CSprReaderView*)this->GetParent();
//	m_pParHand = (CSprReaderView*)AfxGetMainWnd();

	UpdateData(true);		// 更新窗体上的值到变量
	if(!m_Interval.IsEmpty())
		g_StructSet.interval = atoi(this->m_Interval.GetBuffer());

	if(!m_Zoom.IsEmpty())
		g_StructSet.zoom = atoi(this->m_Zoom.GetBuffer());

	//

	// 发送消息给主窗体
	CFrameWnd *pFrame;
	CMDIChildWnd *mWnd;
	pFrame = (CFrameWnd*)AfxGetApp()->m_pMainWnd;
	CView *pView = pFrame->GetActiveView();
	if(pView != NULL)
		pView->SendMessage(WM_MY_MESSAGE, 0, 0);
//	::SendMessage(GetParent()->GetSafeHwnd(), WM_MY_MESSAGE, 0, 0);
//	::SendMessage(AfxGetMainWnd()->m_hWnd, WM_MY_MESSAGE, 0, 0);

	CDialog::OnOK();
}
コード例 #7
0
ファイル: MainFrm.cpp プロジェクト: Taranyan/TTToe
void CMainFrame::OnClose()
{
	CView* pView = GetActiveView();
	if(pView != nullptr){
		pView->SendMessage(WM_CLOSE);
	}
	CFrameWnd::OnClose();
}
コード例 #8
0
void	CPackageToolDoc::UpdateClientResourToView()
{
	POSITION pos = GetFirstViewPosition();
	while (pos != NULL)
	{
		CView* pView = GetNextView(pos);
		if(pView) pView->SendMessage(OPEN_FOLDER);
	}
}
コード例 #9
0
ファイル: mainfrm.cpp プロジェクト: jetlive/skiaming
void CMainFrame::OnMove(int x, int y)
{
	CFrameWndEx::OnMove(x, y);
	WINDOWPLACEMENT wp;
	wp.length = sizeof(wp);
	GetWindowPlacement(&wp);
	theApp.m_rectInitialFrame = wp.rcNormalPosition;
	CView* pView = GetActiveView();
	if (pView != NULL)
		pView->SendMessage(WM_MOVE);
}
コード例 #10
0
ファイル: ChildFrm.cpp プロジェクト: darwinbeing/trade
void CChildFrame::OnClose()
{
	// TODO: Add your message handler code here and/or call default
	// Get View Title
	CView * pView = GetActiveView( );
	TCHAR szText[256+_MAX_PATH];
	memset( szText, 0, sizeof(szText) );

	if (pView == NULL)
		lstrcpyn(szText, m_strTitle, 256+MAX_PATH);
	else
	{
		BOOL	bCanClose	=	TRUE;
		if( 0 == pView->SendMessage( WM_USER_CANCLOSEVIEW, NULL, (LPARAM)(&bCanClose) )
			&& !bCanClose )
			return;
		pView->SendMessage( WM_USER_GETVIEWTITLE, 255+MAX_PATH, long(szText) );
	}

	// Set sel
	/* My Own Tab
	char	buffer[256+_MAX_PATH];
	memset( buffer, 0, sizeof(buffer) );
	for( int nItem=0; nItem<m_tabctrl.GetItemCount(); nItem++ )
	{
		TCITEM tci;
		tci.mask	=	TCIF_TEXT;
		tci.pszText	=	buffer;
		tci.cchTextMax	=	sizeof(buffer)-1;
		if( m_tabctrl.GetItem( nItem, &tci )
			&& 0 == strncmp( szText, buffer, min(sizeof(szText),sizeof(buffer))-1 ) )
		{
			m_tabctrl.DeleteItem( nItem );
			break;
		}
	}
	*/

	CMDIChildWnd::OnClose();
}
コード例 #11
0
BOOL CMainFrame::OnQueryNewPalette()
{
	// always realize the palette for the active view
	CMDIChildWnd* pMDIChildWnd = MDIGetActive();
	if (pMDIChildWnd == NULL)
		return FALSE; // no active MDI child frame (no new palette)
	CView* pView = pMDIChildWnd->GetActiveView();
	ASSERT(pView != NULL);

	// just notify the target view
	pView->SendMessage(WM_DOREALIZE, (WPARAM)pView->m_hWnd);
	return TRUE;
}
コード例 #12
0
ファイル: mainfrm.cpp プロジェクト: deepmatrix/blaxxun-cc3d
void CMainFrame::OnPaletteChanged(CWnd* pFocusWnd) 
{
//CFrameWnd::OnPaletteChanged(pFocusWnd);
// HG 10.08.95 from easygl MSDN 07/95	
    CView* pView = GetActiveView();
    if (pView) {
        // OnPaletteChanged is not public, so send a message.
        pView->SendMessage(WM_PALETTECHANGED,
                           (WPARAM)(pFocusWnd->GetSafeHwnd()),
                           (LPARAM)0);
    }

}
コード例 #13
0
ファイル: mainfrm.cpp プロジェクト: deepmatrix/blaxxun-cc3d
BOOL CMainFrame::OnQueryNewPalette() 
{
// HG 10.08.95 from easygl MSDN 07/95	
    CView* pView = GetActiveView();
    if (pView) {
        // OnQueryNewPalette is not public, so send a message.
        return pView->SendMessage(WM_QUERYNEWPALETTE,
                                  (WPARAM)0,
                                  (LPARAM)0);
    }
    return FALSE; 
	
//	return CFrameWnd::OnQueryNewPalette();
}
コード例 #14
0
ファイル: MainFrm.cpp プロジェクト: jhkoivis/lumikki
BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pData) {

	COPYDATASTRUCT data;
	data.dwData = pData->dwData;
	data.cbData = pData->cbData;
	data.lpData = pData->lpData;
		
	CView *pView = GetActiveView();
	if (pView == NULL){
		TRACE("pView == NULL\n");
	}
	else{
	    pView->SendMessage(WM_COPYDATA,0,(LPARAM)&data);
	}
	
	return TRUE;
}
コード例 #15
0
ファイル: Docroot.cpp プロジェクト: ChrisMoreton/Test3
void DocRoot::UpdateAllViewsByMsg(CView* pSender, LPARAM lHint, CObject* pHint, BOOL PostMsg/*=FALSE*/)
  {// walk through all views
  ASSERT(pSender == NULL || !m_viewList.IsEmpty());
  // must have views if sent by one of them

  POSITION pos = GetFirstViewPosition();
  while (pos != NULL)
    {
    CView* pView = GetNextView(pos);
    if (pView != pSender)
      {
      if (PostMsg)
        pView->PostMessage(WMU_ONUPDATE, lHint, (LPARAM)pHint);
      else
        pView->SendMessage(WMU_ONUPDATE, lHint, (LPARAM)pHint);
      }
    }
  }
コード例 #16
0
  // wys³anie komunikatu do wszystkich okien otwartych dokumentów
void CBroadcast::SendMessageToViews(UINT msg, WPARAM wParam/*= 0*/, LPARAM lParam/*= 0*/)
{
  CWinApp *app= AfxGetApp();
  POSITION posTempl= app->GetFirstDocTemplatePosition();
  while (posTempl != NULL)
  {
    CDocTemplate *templ= app->GetNextDocTemplate(posTempl);
    POSITION posDoc= templ->GetFirstDocPosition();
    while (posDoc != NULL)
    {
      CDocument *doc= templ->GetNextDoc(posDoc);
      POSITION posView = doc->GetFirstViewPosition();
      while (posView != NULL)
      {
	CView* view = doc->GetNextView(posView);
	view->SendMessage(msg,wParam,lParam);
      }
    }
  }   
}
コード例 #17
0
ファイル: DLgBarH.cpp プロジェクト: slawer/krs_kal
void CDLgBarH::OnRadioOtchet() 
{
	if(pFrm == NULL) return;

	if (m_type_view == t_archive)
	{
		CDBView* db_view = (CDBView*)pApp->GetView(t_archive);
		db_view->RemoveActivityDB();
	}
	else
	if (m_type_view == t_cement_rt)
	{
		CCementView* cement_view = (CCementView*)pApp->GetView(t_cement_rt);
		cement_view->RemoveActivityDB();
	}

	m_type_view = 4;
	pFrm->SendMessage(PM_CHANGE_TYPE_VIEW, 2, 0);

	CView* pView = pApp->GetActiveView();
	if(pView != NULL) pView->SendMessage(PM_CHANGE_TYPE_VIEW, 2, 0);
}
コード例 #18
0
ファイル: ChildFrm.cpp プロジェクト: darwinbeing/trade
void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
	GetMDIFrame()->OnUpdateFrameTitle(bAddToTitle);

	if ((GetStyle() & FWS_ADDTOTITLE) == 0)
		return;     // leave child window alone!

	CView * pView = GetActiveView( );
	if (bAddToTitle)
	{
		TCHAR szText[256+_MAX_PATH];
		memset( szText, 0, sizeof(szText) );

		if (pView == NULL)
			lstrcpyn(szText, m_strTitle, 256+MAX_PATH);
		else
			pView->SendMessage( WM_USER_GETVIEWTITLE, 255+MAX_PATH, long(szText) );

		// set title if changed, but don't remove completely
		AfxSetWindowText(m_hWnd, szText);
	}
}
コード例 #19
0
ファイル: mainfrm.cpp プロジェクト: jetlive/skiaming
void CMainFrame::OnPaletteChanged(CWnd* pFocusWnd)
{
	CView* pView = GetActiveView();
	if (pView != NULL)
		pView->SendMessage(WM_PALETTECHANGED, (WPARAM)pFocusWnd->GetSafeHwnd());
}
コード例 #20
0
//-----------------------------------------------------------------------------
// Purpose: Replaces the current active view with a given view type.
// Input  : *pViewClass - 
// Output : CView
//-----------------------------------------------------------------------------
CView *CChildFrame::ReplaceView(CRuntimeClass *pViewClass)
{
	//
	// Verify that there is an active view to replace.
	//
	CView *pCurrentView = GetActiveView();
	if (!pCurrentView)
	{
		return(NULL);
	}
	
	//
	// If we're already displaying this kind of view, no need to go
	// further.
	//
	if ((pCurrentView->IsKindOf(pViewClass)) == TRUE)
	{
		return(pCurrentView);
	}
 
	//
	// Get pointer to CDocument object so that it can be used in the
	// creation process of the new view. Set flag so that the document
	// will not be deleted when view is destroyed.
	//
	CMapDoc *pDoc = (CMapDoc *)pCurrentView->GetDocument();
    BOOL bAutoDelete = pDoc->m_bAutoDelete;
    pDoc->m_bAutoDelete=FALSE;

	int iRow = 0, iCol = 0;
	CRect rect;

	// Delete existing view
	if (bUsingSplitter)
	{
		pCurrentView->GetClientRect(rect);
		m_wndSplitter->GetActivePane(&iRow, &iCol);
		m_wndSplitter->DeleteView(iRow, iCol);
	}
	else
	{
		pCurrentView->DestroyWindow();
	}

    // Restore the autodelete flag.
    pDoc->m_bAutoDelete = bAutoDelete;
 
	// Create new view and redraw.
	CCreateContext context;

	context.m_pNewViewClass = pViewClass;
	context.m_pCurrentDoc = pDoc;
	context.m_pNewDocTemplate = NULL;
	context.m_pLastView = NULL;
	context.m_pCurrentFrame=this;
 
	CView *pNewView = NULL;

	if (bUsingSplitter)
	{
		if (m_wndSplitter->CreateView(iRow, iCol, pViewClass, rect.Size(), &context))
		{
			pNewView = (CView *)m_wndSplitter->GetPane(iRow, iCol);
		}
	}
	else
	{
		pNewView = (CView *)pViewClass->CreateObject();
		if (pNewView)
		{
			CRect r;
			GetClientRect(r);

			if (!pNewView->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, r, this, AFX_IDW_PANE_FIRST, &context))
			{
				pNewView = NULL;
			}
		}
 	}

	if (!pNewView) 
	{
		TRACE0("Warning: couldn't create view for frame\n");
		return(NULL);
	}
 
	pNewView->SendMessage(WM_INITIALUPDATE, 0, 0);

	if (bUsingSplitter)
	{
		m_wndSplitter->RecalcLayout();
	}
 
	return(pNewView);
}
コード例 #21
0
ファイル: BonfireDoc.cpp プロジェクト: Qeeet/nz-software
/////////////////////////////////////////////////////////////////////////////
// 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;
}