Пример #1
0
void COCCDemoDoc::Fit()
{
	CMDIFrameWnd *pFrame =  (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	CMDIChildWnd *pChild =  (CMDIChildWnd *) pFrame->GetActiveFrame();
	COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
	pView->FitAll();
}
Пример #2
0
void CMDIFrameWnd::OnUpdateFrameTitle(BOOL bAddToTitle)
{
	if ((GetStyle() & FWS_ADDTOTITLE) == 0)
		return;     // leave it alone!

#ifndef _AFX_NO_OLE_SUPPORT
	// allow hook to set the title (used for OLE support)
	if (m_pNotifyHook != NULL && m_pNotifyHook->OnUpdateFrameTitle())
		return;
#endif

	CMDIChildWnd* pActiveChild = NULL;
	CDocument* pDocument = GetActiveDocument();
	if (bAddToTitle &&
	  (pActiveChild = MDIGetActive()) != NULL &&
	  (pActiveChild->GetStyle() & WS_MAXIMIZE) == 0 &&
	  (pDocument != NULL ||
	   (pDocument = pActiveChild->GetActiveDocument()) != NULL))
		UpdateFrameTitleForDocument(pDocument->GetTitle());
	else
	{
		LPCTSTR lpstrTitle = NULL;
		CString strTitle;

		if (pActiveChild != NULL &&
			(pActiveChild->GetStyle() & WS_MAXIMIZE) == 0)
		{
			strTitle = pActiveChild->GetTitle();
			if (!strTitle.IsEmpty())
				lpstrTitle = strTitle;
		}
		UpdateFrameTitleForDocument(lpstrTitle);
	}
}
Пример #3
0
void AppState::OpenMostRecentResourceAt(ResourceType type, uint16_t number, int index)
{
    OpenMostRecentResource(type, number);

    // Now it should be open...
    // MDI view implementation file
    CMDIChildWnd * pChild = ((CMDIFrameWnd*)(AfxGetApp()->m_pMainWnd))->MDIGetActive();
    if (pChild)
    {
        CView * pView = pChild->GetActiveView();
        if (pView)
        {
            if (pView->IsKindOf(RUNTIME_CLASS(CVocabView)))
            {
                ((CVocabView*)pView)->SelectGroup((Vocab000::WordGroup)index);
            }
            else if (pView->IsKindOf(RUNTIME_CLASS(CListView)))
            {
                CListView *pTextView = (CListView *)pView;
                pTextView->GetListCtrl().SetItemState(index, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
                pTextView->GetListCtrl().EnsureVisible(index, FALSE);
            }
        }
    }
}
Пример #4
0
void CMainFrame::OnClose() 
{
	if(AfxGetModuleManager())
		if(!AfxGetModuleManager()->IsCanDestroy())
			return;//программа не разрешила закрывать

	if(AfxGetMetadataTree())
		if(AfxGetMetadataTree()->GetParent())
		{
			afxExitMode=1;
			AfxGetMetadataTree()->SaveOpenModulesState();
			//AfxGetMetadataTree()->GetParent()->BringWindowToTop();
		}

	CMDIChildWnd* pChild;
	while(pChild=MDIGetActive())
	{
		pChild->SendMessage(WM_CLOSE);
		if(pChild==MDIGetActive())
			return;//была нажата кнопка ќтмена
	}


	afxExitMode=0;
	pMessageWindow=0;
	pStatusBar=0;

  //  m_MDIClient.SaveMainFrameState();

	CMDIFrameWnd::OnClose();
}
Пример #5
0
void CUndoBar::DoUndo ()
{
	CUndoButton* pUndoButton = GetParentButton ();
	ASSERT_VALID (pUndoButton);

	pUndoButton->m_nSelNum = m_wndList.GetSelCount () + 1;
	
	CMDIChildWnd* pChildFrame = ((CMDIFrameWnd*)GetTopLevelFrame())->MDIGetActive();

	if (pChildFrame)
	{
		CView* pView = pChildFrame->GetActiveView();

		if (pView &&
			pView->IsKindOf(RUNTIME_CLASS(CBCGPVisualStudioGUIDemoView)))
		{
			((CBCGPVisualStudioGUIDemoView*)pView)->DoUndo(pUndoButton);
		}
		else
		{
			ASSERT(FALSE);
		}
	}
	else
	{
		ASSERT(FALSE);
	}

	GetParent ()->PostMessage (WM_CLOSE);
}
Пример #6
0
void CMainFrame::OnUpdateImageInfo(CCmdUI *pCmdUI)
{
	// Get the active MDI child window.
	CMDIChildWnd *pChild = (CMDIChildWnd *)GetActiveFrame();
	if (pChild != NULL)
	{
		// Get the active view attached to the active MDI child window.
		CDtxViewView *pView = (CDtxViewView*)pChild->GetActiveView();
		CDtxViewDoc *pDoc = pView->GetDocument();

		CString strInfo;
		if (pDoc->GetImageInfoString(&strInfo))
		{
			pCmdUI->Enable();
			pCmdUI->SetText(strInfo);
		}
		else
		{
			pCmdUI->Enable(FALSE);
		}
	}
	else
	{
		pCmdUI->Enable(FALSE);
	}
}
void OCCDemo_Presentation::SetViewEye(V3d_Coordinate X, V3d_Coordinate Y, V3d_Coordinate Z)
{
	CMDIFrameWnd *pFrame =  (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	CMDIChildWnd *pChild =  (CMDIChildWnd *) pFrame->GetActiveFrame();
	COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
	pView->SetViewEye(X,Y,Z);
}
Пример #8
0
/******************************************************************************
  Function Name    :  vDisplayWarningLineNumber

  Input(s)         :  eMESSAGEFROM eMsgFrom, UINT unLineNo
  Output           :  -
  Functionality    :  Scrolls to the line number spaecified and
                      highlights the same.
  Member of        :  CFileView
  Friend of        :      -

  Author(s)        :
  Date Created     :
******************************************************************************/
void CFileView::vDisplayWarningLineNumber( eMESSAGEFROM eMsgFrom, UINT unLineNo)
{
    // Get document
    CFunctionEditorDoc*  pomSrcFileDoc = omGetDocument();

    // Doc is valid
    if(pomSrcFileDoc != nullptr)
    {

        // Main frame is valid and
        // function called from COutWnd class
        if (eMsgFrom == OUTWND)
        {
            // Get child window, active may be
            // "COutWnd"
            CFrameWnd* pMainFrame = (CFrameWnd*)CWnd::FromHandle(CGlobalObj::sm_hWndMDIParentFrame);
            CMDIChildWnd* pChild = ( CMDIChildWnd*) pMainFrame->GetActiveFrame();

            CString omStrText = "";
            BOOL bInLoop = TRUE;

            do
            {
                // Get next window
                pChild = (CEditFrameWnd*) pChild->GetWindow(GW_HWNDNEXT);
                if(pChild != nullptr )
                {
                    // Get Window caption
                    pChild->GetWindowText(omStrText);

                    // check the title of child window,
                    // if matches, activate my window it
                    if (omStrText == omGetDocument()->GetTitle())
                    {
                        bInLoop = FALSE;
                    }
                }
                else
                {
                    bInLoop = FALSE;
                }
            }
            while (bInLoop);

            if (pChild != nullptr)
            {
                pChild->MDIActivate();
            }
        }

        // Update document with the line no
        pomSrcFileDoc->m_lCurrentWarningLineNum = unLineNo;

        // Scroll to the line specified
        vGoToLine( unLineNo );

        // refresh the view
        Invalidate(TRUE);
    } // end of if(pomSrcFileDoc)
}
Пример #9
0
void CFileView::OnProperties()
{
    CMDIFrameWnd   *pMain  = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;      
	CMDIChildWnd   *pChild  = (CMDIChildWnd *)pMain->GetActiveFrame(); 
	CDocument* pDoc = NULL;
	pDoc = pChild->GetActiveDocument();
	//9-8添加判断,如果不判断,都关闭后再点击项目管理项,程序会崩溃
	if( pDoc!= NULL)
	{
		CString filePath=pDoc->GetPathName();
		filePath.Trim();
		filePath.MakeLower();
		CString fileEx=filePath.Right(2);
		if(fileEx==_T(".t"))
		{
			int iLength = lstrlen(filePath) ;
			int iIndex = filePath.ReverseFind(L'\\') ;
			CString fileName = filePath.Right(iLength - iIndex - 1); 
			((CMainFrame*)AfxGetApp()->m_pMainWnd)->SetProjProperty(fileName,filePath);
		}
		else
		{
			((CMainFrame*)AfxGetApp()->m_pMainWnd)->SetProjProperty(_T(""),_T(""));
		}
	}
}
Пример #10
0
void OCCDemo_Presentation::SetViewCenter(V3d_Coordinate Xc, V3d_Coordinate Yc)
{
	CMDIFrameWnd *pFrame =  (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	CMDIChildWnd *pChild =  (CMDIChildWnd *) pFrame->GetActiveFrame();
	COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
	pView->SetViewCenter(Xc,Yc);
}
Пример #11
0
void CSideBar::OnPopupSidebarAttrUpdate() 
{
   // NB!  This needs some work!

   CTreeCtrl& tree = GetTreeCtrl();
   // since this may happen at any time, should really check for anything going badly wrong,
   // e.g., no current graph document:
   CMDIFrameWnd *pFrame = (CMDIFrameWnd*) AfxGetApp()->m_pMainWnd;
   CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
   CDocument *pDoc = pChild->GetActiveDocument();
   if (pDoc != m_treeDoc) {
      return;
   }
   if (m_popup_attribute == -1) {
      AfxMessageBox(_T("Cannot replace values for the reference number column"));
      return;
   }

   MetaGraph *graph = m_treeDoc->m_meta_graph;

   PointMap *pointmap = NULL;
   ShapeMap *shapemap = NULL;
   // Need to check what this does
   GetItemMap(graph,pointmap,shapemap);

   if (m_treeDoc->ReplaceColumnContents(pointmap, shapemap, m_popup_attribute)) {
      graph->setDisplayedAttribute(m_popup_attribute);
      m_treeDoc->SetUpdateFlag(CGraphDoc::NEW_DATA);
      m_treeDoc->SetRedrawFlag(CGraphDoc::VIEW_ALL, CGraphDoc::REDRAW_GRAPH, CGraphDoc::NEW_DATA );
   }

   SwitchFocusBack();
}
Пример #12
0
void CGeorgesEditDoc::OnEditUndo() 
{
	if (!_UndoBuffer.empty ())
	{
		// Get an action
		IAction *action = _UndoBuffer.back ();
		_UndoBuffer.pop_back ();

		// Undo it
		bool modified;
		action->doAction (*this, false, modified, false);

		// Put in the redo list
		_RedoBuffer.push_back (action);

		CMDIFrameWnd* pMainWnd = (CMDIFrameWnd*)AfxGetMainWnd();

		// Get the active MDI child window.
		CMDIChildWnd* pChild = (CMDIChildWnd*)pMainWnd->MDIGetActive();
		pChild->RecalcLayout();
		pChild->UpdateWindow();

		_UndoModify--;
		if ( (_UndoModify == 0) && IsModified () )
		{
			setModifiedState (false);
		}
		else if ( (_UndoModify != 0) && !IsModified () )
		{
			setModifiedState (true);
		}
	}
}
Пример #13
0
void CMainFrame::setFrameCaption()
{
	CWnd * m_pMainWnd = AfxGetApp()->m_pMainWnd;
  
	CMDIFrameWnd* pMainWnd = (CMDIFrameWnd*)AfxGetMainWnd();
   // Get the active MDI child window
	CMDIChildWnd* pChild = (CMDIChildWnd*)pMainWnd->MDIGetActive();
   // Get the active view attached to the active MDI child window.
	CView* pOldActiveView = NULL;
	CDrawProgView* pView = NULL;
	if (pChild) {
		pOldActiveView = pChild->GetActiveView();
		pView = (CDrawProgView*)pOldActiveView;
	}

	if(pView) {
		INXString csProjectDir, csProjectName;
		pView->pProject->pProjMData->getProjectDir(csProjectDir);
		pView->pProject->pProjMData->getProjectName(csProjectName);	
		m_pMainWnd->SetWindowTextA(LAB_APP_NAME + csProjectDir + ":" + csProjectName);

	} else {
		m_pMainWnd->SetWindowTextA(LAB_APP_NAME + NO_PROJECT_WARNING);
	}

	//CDialog::OnOK();
}
Пример #14
0
void CLuaIDEInterfaceImpl::addFile(const char *filename)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    CProject *proj = theApp.GetMainFrame()->GetProject();
    if (proj->GetProjectFile(filename))
        return;

    theApp.GetMainFrame()->GetProject()->AddFile(filename);
    CDocument *doc = theApp.OpenDocumentFile(filename);
    if (doc)
    {
        POSITION p = doc->GetFirstViewPosition();
        for (;;)
        {
            CView *v = doc->GetNextView(p);
            if (!v) break;
            theApp.GetMainFrame()->MDIActivate(v);
            BOOL maximized;
            CMDIChildWnd* child = theApp.GetMainFrame()->MDIGetActive(&maximized);
            if (child && (!maximized))
            {
                child->MDIMaximize();
            }
        }
    }
}
Пример #15
0
Quantity_Factor OCCDemo_Presentation::GetViewScale()
{
	CMDIFrameWnd *pFrame =  (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	CMDIChildWnd *pChild =  (CMDIChildWnd *) pFrame->GetActiveFrame();
	COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
	return pView->GetViewScale();
}
Пример #16
0
CMDIChildWnd* CMDIFrameWnd::CreateNewChild(CRuntimeClass* pClass,
		UINT nResources, HMENU hMenu /* = NULL */, HACCEL hAccel /* = NULL */)
{
	ASSERT(pClass != NULL);
	CMDIChildWnd* pFrame = (CMDIChildWnd*) pClass->CreateObject();
	ASSERT_KINDOF(CMDIChildWnd, pFrame);

	// load the frame
	CCreateContext context;
	context.m_pCurrentFrame = this;

	pFrame->SetHandles(hMenu, hAccel);
	if (!pFrame->LoadFrame(nResources,
			WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, &context))
	{
		TRACE(traceAppMsg, 0, "Couldn't load frame window.\n");
		return NULL;
	}

	CString strFullString, strTitle;
	if (strFullString.LoadString(nResources))
		AfxExtractSubString(strTitle, strFullString, CDocTemplate::docName);

	// redraw the frame and parent
	pFrame->SetTitle(strTitle);
	pFrame->InitialUpdateFrame(NULL, TRUE);

	return pFrame;
}
Пример #17
0
void OCCDemo_Presentation::SetViewScale(Quantity_Factor Coef)
{
	CMDIFrameWnd *pFrame =  (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	CMDIChildWnd *pChild =  (CMDIChildWnd *) pFrame->GetActiveFrame();
	COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
	pView->SetViewScale(Coef);
}
Пример #18
0
void CAipi_Error::errorMark(unsigned int nLine)
{
	CMDIFrameWnd* pFrame = (CMDIFrameWnd*)::AfxGetApp()->m_pMainWnd;
	CMDIChildWnd* pChild = (CMDIChildWnd*) pFrame->MDIGetActive();	
	CScintillaView* pView = (CScintillaView*) pChild->GetActiveView();
	ASSERT(pView);
	
	//Find file path
	CAIPIEditorDoc* pDoc = (CAIPIEditorDoc*)pView->GetDocument();
	ASSERT_VALID(pDoc);
	CString strPath = pDoc->GetPathName();
	//AfxMessageBox(strPath);


	CScintillaCtrl& rCtrl = pView->GetCtrl();
	
	// Reset Scintilla Markers 
	rCtrl.MarkerDeleteAll(0);

	// Initilaize error markers
	rCtrl.MarkerDefine(0, SC_MARK_ARROW);
	rCtrl.MarkerSetFore(0, RGB( 80, 0, 0 ));
	rCtrl.MarkerSetBack(0, RGB( 255, 0, 0 ));
	
	// Set error marker to proper line
	rCtrl.MarkerAdd((nLine - 1), 0);
	rCtrl.GotoLine(nLine - 1);
	

}
Пример #19
0
void OCCDemo_Presentation::ResetView()
{
	CMDIFrameWnd *pFrame =  (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	CMDIChildWnd *pChild =  (CMDIChildWnd *) pFrame->GetActiveFrame();
	COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
	pView->Reset();
}
Пример #20
0
void 
CMainFrame::OnWindowNew3d() 
{
   CMDIChildWnd*  pActiveChild = MDIGetActive();
   CDocument* pDocument;
   
   if ( pActiveChild == NULL ||
      ( pDocument = pActiveChild->GetActiveDocument() ) == NULL ) 
   {
      TRACE("Warning:  No active document for WindowNew command\n");
      AfxMessageBox(AFX_IDP_COMMAND_FAILURE);
      return; // Command failed
   }
   
   // Otherwise, we have a new frame!
   CDocTemplate* pTemplate = ((CDemoApp*)AfxGetApp())->m_pTemplate3dView;
   ASSERT_VALID( pTemplate );
   
   CFrameWnd* pFrame =
      pTemplate->CreateNewFrame( pDocument, pActiveChild );
   
   if (pFrame == NULL) 
   {
      TRACE( "Warning:  failed to create new frame\n" );
      AfxMessageBox( AFX_IDP_COMMAND_FAILURE );
      return; // Command failed
   }
   
   pTemplate->InitialUpdateFrame( pFrame, pDocument );

   ((CDemoDoc*)pDocument)->turnOnComputePoints();
}
Пример #21
0
void CUndoBar::DoUndo()
{
	CUndoButton* pUndoButton = GetParentButton();
	ASSERT_VALID(pUndoButton);

	pUndoButton->m_nSelNum = m_wndList.GetSelCount() + 1;

	CMDIChildWnd* pChildFrame = ((CMDIFrameWndEx*)GetTopLevelFrame())->MDIGetActive();
	if (pChildFrame)
	{
		CEditView* pView = DYNAMIC_DOWNCAST(CEditView, pChildFrame->GetActiveView());
		if (pView != NULL)
		{
			//pView->OnEditUndo(); TODO
		}
		else
		{
			ASSERT(FALSE);
		}
	}
	else
	{
		ASSERT(FALSE);
	}

	GetParent()->PostMessage(WM_CLOSE);
}
Пример #22
0
void CReClass2015App::OnButtonReset()
{
	CMDIFrameWnd* pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;

	CMDIChildWnd* wnd = pFrame->MDIGetActive();
	while(wnd)
	{
		wnd->SendMessage(WM_CLOSE,0,0);
		wnd = pFrame->MDIGetActive();
	}

	Classes.clear();
	Header = "";
	Footer = "";
	Notes = "";

	tdHex = "char";
	tdInt32 = "__int32";
	tdInt16 = "__int16";
	tdInt8 = "__int8";
	tdDWORD = "DWORD";
	tdWORD = "WORD";
	tdBYTE = "BYTE";
	tdVec2 = "D3DVECTOR2";
	tdVec3 = "D3DVECTOR3";
	tdQuat = "D3DXQUATERNION";
	tdMatrix = "D3DMATRIX";

	CurrentFilePath = "";
}
void CStyleDlgFonts::OnButtonFont() 
{
	CFontDialog dlg (m_stcFont.GetLogfont (), CF_EFFECTS | CF_BOTH, NULL, this);
	dlg.m_cf.rgbColors = m_stcFont.GetColor ();

	if (dlg.DoModal () == IDOK)
	{
		m_stcFont.SetPreviewFont (&dlg.m_cf);

		memcpy (&m_pStyle->m_lfTitle[m_RenderType], dlg.m_cf.lpLogFont, sizeof (LOGFONT));
		if (dlg.m_cf.rgbColors)
			m_pStyle->m_crTitle[m_RenderType] = dlg.m_cf.rgbColors;

		CMDIChildWnd* pChild = ((CMDIFrameWnd*) AfxGetMainWnd ())->MDIGetActive ();
		if (pChild != NULL)
		{
			CCdCoverCreator2Doc* pDoc = (CCdCoverCreator2Doc*) pChild->GetActiveDocument ();
			if (pDoc != NULL)
			{
//				pDoc->m_pTracks->SetRTFTitle ("", m_RenderType);
				pDoc->ApplyStyleToRTFTitles (m_pStyle, m_RenderType);
				pDoc->UpdateAllViews (NULL);
				pDoc->CheckPoint ();
			}
		}
	}
}
Пример #24
0
CManageTagsDlg::CManageTagsDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CManageTagsDlg::IDD, pParent)
{
	CMDIChildWnd * pChild = ((CMDIFrameWnd*)(AfxGetApp()->m_pMainWnd))->MDIGetActive();
	CLibraryDoc* pDoc = DYNAMIC_DOWNCAST(CLibraryDoc, pChild->GetActiveDocument ());
	m_pParamCDB = pDoc->m_pParamCDB;
}
Пример #25
0
CMDIChildWnd* CMDIFrameWnd::MDIGetActive(BOOL* pbMaximized) const
{
	// check first for MDI client window not created
	if (m_hWndMDIClient == NULL)
	{
		if (pbMaximized != NULL)
			*pbMaximized = FALSE;
		return NULL;
	}

	// MDI client has been created, get active MDI child
	HWND hWnd = (HWND)::SendMessage(m_hWndMDIClient, WM_MDIGETACTIVE, 0,
		(LPARAM)pbMaximized);
	CMDIChildWnd* pWnd = (CMDIChildWnd*)CWnd::FromHandlePermanent(hWnd);
	ASSERT(pWnd == NULL || pWnd->IsKindOf(RUNTIME_CLASS(CMDIChildWnd)));

	// check for special pseudo-inactive state
	if (pWnd != NULL && pWnd->m_bPseudoInactive &&
		(pWnd->GetStyle() & WS_VISIBLE) == 0)
	{
		// Window is hidden, active, but m_bPseudoInactive -- return NULL
		pWnd = NULL;
		// Ignore maximized flag if pseudo-inactive and maximized
		if (pbMaximized != NULL)
			*pbMaximized = FALSE;
	}
	return pWnd;
}
//@doc SECEditView
//@mfunc Finds the active Document so we can decide whether or
//              not to draw the selection
//@rdesc CDocument* Pointer to CDocument if found, NULL if not.
CDocument* SECEditView::GetActiveDoc()
{
	CMDIChildWnd* pChild = ((CMDIFrameWnd*)AfxGetMainWnd())->MDIGetActive();
	if (!pChild)
	   return ((CFrameWnd*)AfxGetMainWnd())->GetActiveDocument();
	else
		return pChild->GetActiveDocument();
}
Пример #27
0
//颜色选择完成
LRESULT CMainFrame::OnSelEndOKColor(WPARAM wParam, LPARAM lParam)
{
	UINT uiCmd = ( UINT )lParam;
	
	CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
	CDrawView *pView = (CDrawView*)pChild->GetActiveView();	
	
	if(pView == NULL)
		return 0;
	
	if ( uiCmd == ID_FORMATTING_COLOR )
	{
		m_crCurrent = ( COLORREF )wParam;
		
		if(pView->m_selection.GetCount() >= 1)
		{
			
			POSITION pos = pView->m_selection.GetHeadPosition();
			while(pos != NULL)
			{
				CDrawObj * pObj = pView->m_selection.GetNext(pos);
				if(pObj->IsKindOf(RUNTIME_CLASS(CDrawButton)))
				{
					CDrawButton *pButton = (CDrawButton *)pObj;
					pButton->m_color = m_crCurrent;
					pButton->Invalidate();
				}
			}
		}
		pView->GetDocument()->SetModifiedFlag();
	}
	if( uiCmd == ID_FORMATTING_BACK_COLOR)
	{
		m_crFillColor = ( COLORREF )wParam;
		
		if(pView->m_selection.GetCount() >= 1)
		{
			
			POSITION pos = pView->m_selection.GetHeadPosition();
			while(pos != NULL)
			{
				CDrawObj * pObj = pView->m_selection.GetNext(pos);
				if(!pObj->IsKindOf(RUNTIME_CLASS(CDrawButton)))
				{
					pObj->m_clrFillColor = m_crFillColor;
					pObj->Invalidate();
				}
			}
		}
		pView->GetDocument()->SetModifiedFlag();

	}

	return 0;
}
Пример #28
0
CMixereView *CMultiMix::GetActiveMixer()
{
	// Get the active MDI child window.
	CMDIChildWnd *pChild = m_Frm->MDIGetActive();
	if (pChild == NULL)
		return(NULL);
	// Get the active view attached to the active MDI child window.
	CMixereView	*pView = (CMixereView *)pChild->GetActiveView();
	return(pView);
}
Пример #29
0
BOOL CModbusPollDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
	// TODO: Add your specialized code here and/or call the base class
	CMDIChildWnd * pChild =
		((CMDIFrameWnd*)(AfxGetApp()->m_pMainWnd))->MDIGetActive();

	if ( !pChild )
		return NULL;

	CModbusPollView * pView = (CModbusPollView *)pChild->GetActiveView();

	if ( !pView )
		return NULL;

	// Fail if view is of wrong kind
	if ( ! pView->IsKindOf( RUNTIME_CLASS(CModbusPollView) ) )
		return NULL;

	  m_Slave_ID=pView->m_Slave_ID;
	  m_Function=pView->m_Function;
	  m_address=pView->m_address;
	  m_Quantity=pView->m_Quantity;
	  m_Scan_Rate=pView->m_Scan_Rate;
	  m_Rows=pView->m_Rows;
	  m_Display=pView->m_Display;
	  m_Hide_Alias_Columns=pView->m_Hide_Alias_Columns;
	  m_Address_Cell=pView->m_Address_Cell;
	  m_PLC_Addresses=pView->m_PLC_Addresses;

	//////////////////////////////////////////////////////////////////////////
	  m_MBPoll_Function=pView->m_MBPoll_Function;
	//////////////////////////////////////////////////////////////////////////
	  m_data_rows=pView->m_data_rows;
	  m_data_cols=pView->m_data_cols;
	  m_grid_rows=pView->m_grid_rows;
	  m_grid_cols=pView->m_grid_cols;
	 
	  m_Current_Row=pView->m_Current_Row;
	  m_Current_Col=pView->m_Current_Col;

	//Single Write
	  m_close_dlg=pView->m_close_dlg;
	  m_function=pView->m_function;
	/////////////////////////DataBuffer/////////////////////////////////////////
	  for (int i=0;i<127;i++)
	  {
		  m_Alias[i]=pView->m_Alias[i];
		  m_DataBuffer[i]=pView->m_DataBuffer[i];
	  }
	 
	  


	return CDocument::OnSaveDocument(lpszPathName);
}
// The code fragment below sets the last active page (i.e. the 
// active page when the propertysheet was closed) to be the first 
// visible page when the propertysheet is shown. The last active 
// page was saved in m_LastActivePage, (a member variable of 
// CDocument-derived class) when OK was selected from the 
// propertysheet. CMyPropertySheet is a CPropertySheet-derived class.
BOOL CMyPropertySheet::OnInitDialog()
{
   BOOL bResult = CPropertySheet::OnInitDialog();

   CMDIFrameWnd* pframe = (CMDIFrameWnd*) AfxGetMainWnd();
   CMDIChildWnd* pchild = pframe->MDIGetActive();
   CPSheetDoc* doc = (CPSheetDoc*) pchild->GetActiveDocument();
   SetActivePage(doc->m_LastActivePage);

   return bResult;
}