/** * 响应上工具条按钮;选择检波器Nb * @param void * @return void */ void CSensorGraphChildFrame::OnShowSensorNb(UINT nID) { CSensorGraphView* pView = (CSensorGraphView*)GetActiveView(); unsigned int uiIndex = 0; uiIndex = nID - ID_BUTTON_MATRIX_SENSOR_GRAPH_NBSTART; CToolbarGraphButton* pBNSensorNb = NULL; pBNSensorNb = (CToolbarGraphButton*)m_oGraphViewTopToolBar.GetButton(uiIndex); POSITION pos; CSensorData oSensorData; pos = m_pSiteData->m_oSensorList.m_olsSensor.FindIndex(uiIndex); oSensorData = m_pSiteData->m_oSensorList.m_olsSensor.GetAt(pos); if(1 == pBNSensorNb->m_iMode) { pBNSensorNb->m_iMode = 0; m_oSensorNbMap.RemoveKey(oSensorData.m_uiNb); } else { m_oSensorNbMap.SetAt(oSensorData.m_uiNb, oSensorData.m_uiNb); pBNSensorNb->m_iMode = 1; } m_oGraphViewTopToolBar.InvalidateButton(uiIndex); pView->RedrawWindow(); }
/** * 响应上工具条按钮;选择测试类型 * @param void * @return void */ void CSensorGraphChildFrame::OnSelectTestType() { CSensorGraphView* pView = (CSensorGraphView*)GetActiveView(); CBCGPToolbarComboBoxButton* pComboButton = NULL; pComboButton = (CBCGPToolbarComboBoxButton*)m_oGraphViewTopToolBar.GetButton(9 + m_uiSensorNbCount); m_strTestType = pComboButton->GetText(); m_uiTestType = m_pSiteData->GetTestTypeIDByString(m_strTestType); if(40 != m_uiTestType) { // 得到检波器TestType判据字符串 m_strTestType = m_pSiteData->GetSensorTestTypeLimitStringByID(m_uiTestType); } CToolbarGraph* pBNGraph = NULL; pBNGraph = (CToolbarGraph*)m_oGraphViewTopToolBar.GetButton(2 + m_uiSensorNbCount); pBNGraph->m_iMode = 1; if(15 == m_uiTestType) // 检波器电阻 { pBNGraph->m_iMode = 2; } pBNGraph->m_strLabel = m_strTestType; m_oGraphViewTopToolBar.InvalidateButton(2 + m_uiSensorNbCount); pView->RedrawWindow(); }
BOOL CMainFrame::OnQueryNewPalette() { CView* pView = GetActiveView(); if (pView != NULL) return (BOOL) pView->SendMessage(WM_QUERYNEWPALETTE); return FALSE; }
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { BOOL tHandled; CWnd* pView; // First, try the default routing scheme. tHandled = CFrameWnd::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ); if( tHandled ) { return( TRUE ); } // If nobody handled it, and the main view isn't active, try the main view. pView = m_wndSplitter.GetPane( 0, 1 ); if( pView != GetActiveView() ) { tHandled = pView->OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ); if( tHandled ) { return( TRUE ); } } return( FALSE ); }
// All child frame's will have exactly one CHexEditView (unless in print preview?). This returns it. CHexEditView *CChildFrame::GetHexEditView() const { CView *pv = GetActiveView(); if (pv != NULL) // May be NULL if print preview { if (pv->IsKindOf(RUNTIME_CLASS(CHexEditView))) return (CHexEditView *)pv; else if (pv->IsKindOf(RUNTIME_CLASS(CDataFormatView))) return ((CDataFormatView *)pv)->phev_; else if (pv->IsKindOf(RUNTIME_CLASS(CAerialView))) return ((CAerialView *)pv)->phev_; else if (pv->IsKindOf(RUNTIME_CLASS(CCompareView))) return ((CCompareView *)pv)->phev_; else if (pv->IsKindOf(RUNTIME_CLASS(CPrevwView))) return ((CPrevwView *)pv)->phev_; else if (pv->IsKindOf(RUNTIME_CLASS(CHexTabView))) { // Find the hex view (left-most tab) CHexTabView *ptv = (CHexTabView *)pv; ptv->SetActiveView(0); // hex view is always left-most (index 0) ASSERT_KINDOF(CHexEditView, ptv->GetActiveView()); return (CHexEditView *)ptv->GetActiveView(); } } return NULL; }
CXTPDockingPane* CMainFrame::CreatePane(int x, int y, CRuntimeClass* pNewViewClass, CString strFormat, XTPDockingPaneDirection direction, CXTPDockingPane* pNeighbour) { //做个标记 int nID = ++m_nCount; CXTPDockingPane* pwndPane = m_paneManager.CreatePane(nID, CRect(0, 0,x, y), direction, pNeighbour); CString strTitle; strTitle.Format(strFormat, nID); pwndPane->SetTitle(strTitle); pwndPane->SetIconID(nID % 6 + 1); CFrameWnd* pFrame = new CFrameWnd; CCreateContext context; context.m_pNewViewClass = pNewViewClass; context.m_pCurrentDoc = GetActiveView()->GetDocument(); pFrame->Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, CRect(0, 0, 0, 0), this, NULL, 0, &context); pFrame->ModifyStyleEx(WS_EX_CLIENTEDGE, 0); m_mapPanes.SetAt(nID, pFrame); return pwndPane; }
void CMainFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) { //DeadCode DAW 22Jun99 TRACE2("Activate %i ==> %08x\n",nState,::GetWindowThreadProcessId(pWndOther->m_hWnd, NULL) ); //DeadCode DAW 22Jun99 else //DeadCode DAW 22Jun99 { //DeadCode DAW 22Jun99 TRACE1("Activate %i xxx\n",nState); //If in the 3D && state==0 then discard DD here #ifdef NDEBUG if (!pWndOther) if (Inst3d::InThe3D()) { if (!nState) Inst3d::ReleaseDirectX(); else { Inst3d::RestoreDirectX(); CMIGView* view=(CMIGView*)GetActiveView(); RFullPanelDial* dial=GetFullPanel(view); dial->LaunchScreen(&RFullPanelDial::quickmissionflight); } } #endif //DeadCode DAW 22Jun99 } CFrameWnd::OnActivate(nState, pWndOther, bMinimized); // TODO: Add your message handler code here }
void CInPlaceFrame::RecalcLayout(BOOL bNotify) { if (m_wndResizeBar.m_hWnd != NULL) m_wndResizeBar.BringWindowToTop(); COleIPFrameWndEx::RecalcLayout(bNotify); CWnd* pWnd = GetActiveView(); if (pWnd != NULL) pWnd->BringWindowToTop(); if (m_wndRulerBar.m_hWnd != NULL) m_wndRulerBar.BringWindowToTop(); // at least 12 pt region plus ruler if it exists CDisplayIC dc; CSize size; size.cy = MulDiv(12, dc.GetDeviceCaps(LOGPIXELSY), 72)+1; size.cx = dc.GetDeviceCaps(LOGPIXELSX)/4; // 1/4" size.cx += HORZ_TEXTOFFSET; //adjust for offset size.cy += VERT_TEXTOFFSET; if (m_wndRulerBar.m_hWnd != NULL && m_wndRulerBar.IsVisible()) { CRect rect; m_wndRulerBar.GetWindowRect(&rect); size.cy += rect.Height(); } m_wndResizeBar.SetMinSize(size); }
void CChildFrame::OnEditPaste() { // TODO: Add your command handler code here CMTXCalcView* pView = (CMTXCalcView*)GetActiveView(); pView->pGridCtrl->OnEditPaste(); pView->updateDocFromGrid(); }
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); }
/** * 响应上工具条按钮;显示采集站 * @param void * @return void */ void CInstrumentGraphChildFrame::OnShowInstrumentCollect() { //是否显示采集站 m_bShowInstrumentCollect = !m_bShowInstrumentCollect; CInstrumentGraphView* pView = (CInstrumentGraphView*)GetActiveView(); pView->RedrawWindow(); }
/** * 响应上工具条按钮;显示交叉站 * @param void * @return void */ void CInstrumentGraphChildFrame::OnShowInstrumentCross() { //是否显示交叉站 m_bShowInstrumentCross = !m_bShowInstrumentCross; CInstrumentGraphView* pView = (CInstrumentGraphView*)GetActiveView(); pView->RedrawWindow(); }
/** * 响应上工具条按钮;显示电源站 * @param void * @return void */ void CInstrumentGraphChildFrame::OnShowInstrumentPower() { //是否显示电源站 m_bShowInstrumentPower = !m_bShowInstrumentPower; CInstrumentGraphView* pView = (CInstrumentGraphView*)GetActiveView(); pView->RedrawWindow(); }
BOOL CDrawItem::OnChangeItemPosition(const CRect& rectPos) { ASSERT_VALID(this); CDrawView* pView = GetActiveView(); ASSERT_VALID(pView); CRect rect = rectPos; pView->ClientToDoc(rect); if (rect != m_pDrawObj->m_position) { // invalidate old rectangle m_pDrawObj->Invalidate(); // update to new rectangle m_pDrawObj->m_position = rect; GetExtent(&m_pDrawObj->m_extent); // and invalidate new rectangle m_pDrawObj->Invalidate(); // mark document as dirty GetDocument()->SetModifiedFlag(); } return COleClientItem::OnChangeItemPosition(rectPos); }
/** * 响应上工具条按钮;显示连接线 * @param void * @return void */ void CInstrumentGraphChildFrame::OnShowLinkLine() { //是否显示连接线 m_bShowLinkLine = !m_bShowLinkLine; CInstrumentGraphView* pView = (CInstrumentGraphView*)GetActiveView(); pView->RedrawWindow(); }
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; }
void CChildFrame::OnEditCopy() { // TODO: Add your command handler code here CMTXCalcView* pView = (CMTXCalcView*)GetActiveView(); ((CMainFrame*)AfxGetApp()->m_pMainWnd)->pDoc = pView->GetDocument(); pView->pGridCtrl->OnEditCopy(); }
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(); }
void CMainFrame::OnSendFile() { // TODO: Add your command handler code here CMyCommDoc *Doc = (CMyCommDoc *)GetActiveDocument(); if (!Doc->m_ComAction) { AfxMessageBox(_T("串口没有打开!")); return; } CSendFileByXModem dlg; dlg.m_ModemType = 0; if (dlg.DoModal()==IDOK) { //发送文件 CFile fp; if(!(fp.Open((LPCTSTR)dlg.m_SendFileName ,CFile::modeRead))) { AfxMessageBox(_T("打开文件出错!")); return; } fp.SeekToEnd(); unsigned long fplength=fp.GetLength(); char* fpBuff; fpBuff=new char[fplength]; fp.SeekToBegin(); if(fp.Read(fpBuff,fplength)<1) { fp.Close(); return; } fp.Close(); //send CMyCommView * myview = (CMyCommView *)GetActiveView(); myview->m_EditLogger.AddText(_T("发送文件....\r\n")); BOOL mySendOk; switch(dlg.m_ModemType) { case 0: //xModem mySendOk = Doc->SendByXmodem(fpBuff,fplength,0); break; case 1: //yModem break; case 2: //zModem break; case 3: //1k xmodem break; default: return; } if(mySendOk) myview->m_EditLogger.AddText(_T("完成发送。\r\n")); else myview->m_EditLogger.AddText(_T("发送失败!!!\n\r")); } }
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { BOOL oldMin = m_isMinimum; //printf("CMainFrame::WindowProc() Msg: %x, WPARAM: %x, LPARAM: %x\n", message, wParam, lParam); switch(message) { case WM_CLOSE: printf("received WM_CLOSE!"); break; case WM_SIZE: switch ( wParam ) { case SIZE_MINIMIZED: m_isMinimum = TRUE; break; case SIZE_MAXIMIZED: case SIZE_RESTORED: m_isMinimum = FALSE; break; } break; case ID_OBTAIN_TGT_WITH_LPARAM: GetActiveView()->SendMessage(ID_OBTAIN_TGT_WITH_LPARAM, wParam, lParam); break; } if ( oldMin != m_isMinimum ) { if ( m_isMinimum ) { ShowTaskBarButton(FALSE); ShowWindow(SW_HIDE); } } return CLeashFrame::WindowProc(message, wParam, lParam); }
void CMainFrame::SetOfficeTheme(int nCalendarTheme) { // xtpThemeOffice2000, // Office 2000 theme. // xtpThemeOfficeXP, // Office XP theme. // xtpThemeOffice2003, // Office 2003 theme. // xtpThemeNativeWinXP, // Windows XP themes support. // xtpThemeWhidbey, // Visual Studio 2005 theme. // xtpThemeOffice2007, // Office 2007 theme. // xtpThemeRibbon, // Office 2007 style ribbon theme // xtpThemeVisualStudio2008, // Visual Studio 2008 theme // xtpThemeCustom // Custom theme. static int sarThemesMap[xtpCalendarThemeOffice2007+1] = {0}; if (sarThemesMap[xtpCalendarThemeOffice2000] == 0) { sarThemesMap[xtpCalendarThemeOffice2000] = xtpThemeOffice2000; sarThemesMap[xtpCalendarThemeOfficeXP] = xtpThemeOfficeXP; sarThemesMap[xtpCalendarThemeOffice2003] = xtpThemeOffice2003; sarThemesMap[xtpCalendarThemeOffice2007] = xtpThemeRibbon; } // 0 - Blue, 1 - Silver, 2 - Black int nTheme2007Style = 0; if (nCalendarTheme > xtpCalendarThemeOffice2007) { nTheme2007Style = nCalendarTheme - xtpCalendarThemeOffice2007 - 100; nCalendarTheme = xtpCalendarThemeOffice2007; } XTPPaintTheme nTheme2 = (XTPPaintTheme)sarThemesMap[nCalendarTheme]; //------------------------------------ CString strFilePath = _GetTheme2007Style_file(nTheme2007Style); XTPOffice2007Images()->SetHandle(strFilePath); //=============================================================== #ifdef _XTP_INCLUDE_RIBBON CXTPPaintManager::SetTheme(nTheme2); if (nTheme2 == xtpThemeRibbon) EnableOffice2007Frame(GetCommandBars()); else EnableOffice2007Frame(0); #else CXTPPaintManager::SetTheme((XTPPaintTheme)min(nTheme2, xtpThemeOffice2003)); #endif // _XTP_INCLUDE_RIBBON XTPColorManager()->SetLunaTheme((nTheme2 == xtpThemeOffice2000) ? xtpSystemThemeUnknown : xtpSystemThemeAuto); RecalcLayout(FALSE); GetCommandBars()->RedrawCommandBars(); RedrawWindow(); m_nOfficeTheme = nCalendarTheme; CCalendarDemoView *pView = DYNAMIC_DOWNCAST(CCalendarDemoView, GetActiveView()); if (pView) pView->OnOfficeThemeChanged(nCalendarTheme); }
/** * 响应上工具条按钮;显示线号桩号 * @param void * @return void */ void CInstrumentGraphChildFrame::OnShowLineNbPointNb() { //是否显示测区坐标 m_bShowLineNbPointNb = !m_bShowLineNbPointNb; CInstrumentGraphView* pView = (CInstrumentGraphView*)GetActiveView(); pView->RedrawWindow(); }
/// バージョンチェック void CMainFrame::OnCheckUpdate() { // メイン画面であれば利用可能 CView* pActiveView = GetActiveView(); if (pActiveView == theApp.m_pMainView) { theApp.m_pMainView->DoCheckSoftwareUpdate(); } }
void CMainFrame::OnClose() { CZimuView *view = (CZimuView*)GetActiveView(); if(!view->OnCloseWindow()) return; CFrameWnd::OnClose(); }
LPCTSTR CChildFrame::GetDocumentName(CObject** pObj) { if (DYNAMIC_DOWNCAST(CStartView, GetActiveView()) != NULL) { return g_strStartViewName; } return CMDIChildWndEx::GetDocumentName(pObj); }
void CGUIWindowPVR::GetContextButtons(int itemNumber, CContextButtons &buttons) { CGUIWindowPVRCommon *view = GetActiveView(); if (view) view->GetContextButtons(itemNumber, buttons); CGUIMediaWindow::GetContextButtons(itemNumber, buttons); }
void CMainFrame::OnUpdateBuildCompile(CCmdUI* pCmdUI) { CLuaView *pView = GetActiveView(); if ( pView ) pCmdUI->Enable(pView->GetDocument()->IsInProject()); else pCmdUI->Enable(FALSE); }
void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) { CMDIChildWndEx::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd); if (bActivate && pActivateWnd == this) { // UNDONE: 特殊代码,不好 GetActiveView()->SendMessage(LogCtrlController::WM_COMMIT); } }
void CMainFrame::OnUpdateRotZ(CCmdUI *pCmdUI) { CObjViewDoc *pDoc = static_cast<CObjViewDoc *> (GetActiveView()->GetDocument()); CString msg; msg.Format("%03g",pDoc->m_rotz); pCmdUI->Enable(); pCmdUI->SetText((LPCTSTR)msg); }
void CMainFrame::OnClose() { CView* pView = GetActiveView(); if(pView != nullptr){ pView->SendMessage(WM_CLOSE); } CFrameWnd::OnClose(); }