void CMainWindow::OnUpdateFileOpen( CCmdUI* pCmdUI ) { pCmdUI->Enable( MDIGetActive() && MDIGetActive()->IsKindOf( RUNTIME_CLASS( CStudentChooserWnd ) ) && chooser->IsWindowVisible() ); }
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(); }
void CMainWindow::OnUpdateFileSave( CCmdUI* pCmdUI ) { pCmdUI->Enable( user.CanWrite() && MDIGetActive() && MDIGetActive()->IsKindOf( RUNTIME_CLASS( CStudentEditWnd ) ) && ((CStudentEditWnd*)MDIGetActive())->IsModified() ); }
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(); }
void CMainFrame::ApplyNodesChange(LGeometryData::NodesConstIterator it, double x, double y, LGeometryData::EBoundaryType bnd, bool delete_all_containing ) { CGeometry2dView* pView = NULL; CGeometry2dDoc* pDoc = NULL; POSITION pos; CChildFrame* pChild = static_cast<CChildFrame*>(MDIGetActive()); if ( pChild ) { pDoc = static_cast<CGeometry2dDoc*>(pChild->GetActiveDocument()); if ( pDoc ) { pos = pDoc->GetFirstViewPosition(); if ( pos ) { pView = static_cast<CGeometry2dView*>(pDoc->GetNextView(pos)); if ( pView ) { pDoc->PrepareUndo(); pDoc->GetData().SetCoordinates(it,x,y); pDoc->GetData().SetBoundary(it,bnd); if ( delete_all_containing ) pDoc->GetData().RemoveAllContainingNode(it); pView->PrepareBuffer(); pView->RedrawWindow(); return; } } } } UnsetNodeForProperties(); }
void CMainFrame::ChangeProperties(short scale, CGeometry2dView::ENodeDrawingMode mode, LGeometryData::EBoundaryCondition cond) { CGeometry2dView* pView = NULL; CGeometry2dDoc* pDoc = NULL; POSITION pos; CChildFrame* pChild = static_cast<CChildFrame*>(MDIGetActive()); if ( pChild ) { pDoc = static_cast<CGeometry2dDoc*>(pChild->GetActiveDocument()); if ( pDoc ) { pos = pDoc->GetFirstViewPosition(); if ( pos ) { pView = static_cast<CGeometry2dView*>(pDoc->GetNextView(pos)); if ( pView ) { m_wndInBarProperties.SetScale(scale); m_wndInBarProperties.SetNodeDrawingMode(mode); m_wndInBarProperties.SetBoundaryConditions(cond); pView->GeometryProperties(scale,mode,cond); } } } } }
LRESULT CMDIFrameWnd::OnCommandHelp(WPARAM wParam, LPARAM lParam) { if (lParam == 0 && IsTracking()) lParam = HID_BASE_COMMAND+m_nIDTracking; CMDIChildWnd* pActiveChild = MDIGetActive(); if (pActiveChild != NULL && AfxCallWndProc(pActiveChild, pActiveChild->m_hWnd, WM_COMMANDHELP, wParam, lParam) != 0) { // handled by child return TRUE; } if (CFrameWnd::OnCommandHelp(wParam, lParam)) { // handled by our base return TRUE; } if (lParam != 0) { CWinApp* pApp = AfxGetApp(); if (pApp != NULL) { AfxGetApp()->WinHelpInternal(lParam); return TRUE; } } return FALSE; }
CFrameWnd* CMDIFrameWnd::GetActiveFrame() { CMDIChildWnd* pActiveChild = MDIGetActive(); if (pActiveChild == NULL) return this; return pActiveChild; }
BOOL CMainFrame::PreTranslateMessage( MSG* pMsg ) { if( pMsg->message == 0x4d ) //0x4d = button F1 { AnalyticsHelper::SendDeltaViewStatistics(_T("DeltaView Event: F1 key pressed raising help button click")); OnHelp(); return TRUE; } if( pMsg->message == WM_KEYUP ) { switch (pMsg->wParam) { case VK_F3: CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, MDIGetActive() ); if (pFrame && pFrame->GetSummaryWnd()->IsVisible() ) { pFrame->GetSummaryWnd()->NavigateSearch(1); // 1 for forward -> allowed -1 for back (not implelented) return TRUE; } break; } } return CMDIFrameWndEx::PreTranslateMessage( pMsg ); }
BOOL CMainFrame::CloseAll(UINT iDontPrompt) { AnalyticsHelper::SendDeltaViewStatistics(_T("DeltaView Event: Close All")); CMDIChildWnd* pLastChild = NULL; CloseOption closeOption = kUserSpecified; int nSiblingCount = GetCountMDIChildWnds(); while( CMDIChildWnd* const pChild = MDIGetActive() ) { if( pLastChild == pChild ) return TRUE; pLastChild = pChild; if (iDontPrompt) { CDVController* pController = GetDVController(DYNAMIC_DOWNCAST(CChildFrame, pChild)); pController->SetModifiedFlag(false); } closeOption = static_cast<CloseOption>( pChild->SendMessage( WM_CLOSE_MUPLITPLE, --nSiblingCount, closeOption ) ); if (closeOption == kCancel) return FALSE; } return TRUE; }
void CMainFrame::OnComparisonModeSelected(WSCONVERTERLib::dvComparisonOption dvOption) { switch (dvOption) { case WSCONVERTERLib::dvCompareFast: AnalyticsHelper::SendDeltaViewStatistics(_T("DeltaView Event: Fast Comparison Mode Selected")); break; case WSCONVERTERLib::dvCompareStandard: AnalyticsHelper::SendDeltaViewStatistics(_T("DeltaView Event: Standart Comparison Mode Selected")); break; case WSCONVERTERLib::dvCompareTextOnly: AnalyticsHelper::SendDeltaViewStatistics(_T("DeltaView Event: Text Only Comparison Mode Selected")); break; case WSCONVERTERLib::dvCompareWithoutOcr: AnalyticsHelper::SendDeltaViewStatistics(_T("DeltaView Event: Without OCR Comparison Mode Selected")); break; case WSCONVERTERLib::dvCompareUnknown: default: AnalyticsHelper::SendDeltaViewStatistics(_T("DeltaView Event: Unknown Comparison Mode Selected")); break; } if (GetApp()->RevertToClassicUI()) return; if (GetSelectedComparisonOption() != dvOption) { // rerun comparison -> active child CChildFrame* const pFrame = DYNAMIC_DOWNCAST( CChildFrame, MDIGetActive() ); if (pFrame) { SetCurrentComparisonOption(dvOption); pFrame->ReCompare(dvOption); } } }
HWND CMDIFrameWnd::GetActiveFrame() { HWND hActiveChild=MDIGetActive(); if (hActiveChild==NULL) return m_hWnd; return hActiveChild; }
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); } }
void CMainFrame::OnRenderingSet(UINT nID) { CStdString selectedRenderingSet = Ribbon::GetRenderingSetNameByID(nID); if (!selectedRenderingSet.IsEmpty() && selectedRenderingSet.CompareNoCase(CStdString::LoadResource(IDS_TXTEX_customRenderingSet6129,_T("Custom rendering set"))) != 0) { if (!RenderingSet::LoadRenderingSetIfRequired(selectedRenderingSet)) { GetApp()->ShowMessageEx(this->m_hWnd, CStdStringW::LoadResource(IDS_TXTEX_theOptionsFileSpecifiedDoesNotHaveCorrectInformationPleaseMakeSureThisIsaValidOptionsFileCurrentSettingsWillBeApplied5086,_T("The options file specified does not have the correct information - please make sure this is a valid options file.\n\nCurrent settings will be applied.")), WsOK, WsDefault, WsErrorIcon, L"", CDeltaVwApp::GetProductHelpID(HIDC_INVALID_OPTIONS_FILE), LOG_LOCATION); return; } } Workshare::OptionApi::SetString(L"CurrentRenderingSet", selectedRenderingSet.c_str()); CChildFrame* const pFrame = DYNAMIC_DOWNCAST( CChildFrame, MDIGetActive() ); if( pFrame ) { CStdString str; str.Format(_T("DeltaView Event: Change rendering set to %s"),selectedRenderingSet.c_str()); AnalyticsHelper::SendDeltaViewStatistics(str.c_str()); pFrame->ReCompare(m_dvComparisonOption, true); } }
int CMainFrame::DoCloseWnd(CExtControlBar &Box)//заданное ќкно, которое требуетс¤ закрыть { CWnd *pWnd=GetFocus(); if(pWnd) { CWnd *pParent=pWnd->GetParent(); if(pParent==&Box)//если текущее окно - заданное ќкно, то не закрываем { CMDIChildWnd* pView=MDIGetActive(); if(pView) { MDIActivate(pView); pView->SetFocus(); return 0; } } //иначе, если открыто заданное ќкно - закрываем if(Box.IsVisible()) { ShowControlBar(&Box,0,1); return 1; } } return -1; }
void CMainFrame::OnUpdateMailTo(CCmdUI *pCmdUI) { CChildFrame* const pFrame = DYNAMIC_DOWNCAST( CChildFrame, MDIGetActive() ); if( pFrame ) pFrame->OnUpdateMailTo( pCmdUI ); else pCmdUI->Enable( FALSE ); }
CUIDesignerView* CMainFrame::GetActiveUIView() const { CMDIChildWnd* pFrame=MDIGetActive(); if(!pFrame) return NULL; return DYNAMIC_DOWNCAST(CUIDesignerView,pFrame->GetActiveView()); }
void CMainFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) { CMDIFrameWndEx::OnActivate(nState, pWndOther, bMinimized); CChildFrame* const pFrame = DYNAMIC_DOWNCAST( CChildFrame, MDIGetActive() ); if( pFrame ) { pFrame->OnActivate(nState, pWndOther, bMinimized); } }
LRESULT CMDIFrameWnd::WindowProc(UINT msg,WPARAM wParam,LPARAM lParam) { if (msg==WM_NCACTIVATE) { HWND hActiveWnd=MDIGetActive(); if (hActiveWnd!=NULL) ::SendMessage(hActiveWnd,WM_NCACTIVATE,wParam,lParam); } return CFrameWnd::WindowProc(msg,wParam,lParam); }
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) { if(CMDIFrameWindowImpl<CMainFrame>::PreTranslateMessage(pMsg)) return TRUE; HWND hWnd = MDIGetActive(); if(hWnd != NULL) return (BOOL)::SendMessage(hWnd, WM_FORWARDMSG, 0, (LPARAM)pMsg); return FALSE; }
BOOL MainFrameBase::PreTranslateMessage(MSG* pMsg) { if (pMsg == NULL) return FALSE; bool bCalledBaseClass = false; if (pMsg->hwnd == m_hWnd || pMsg->hwnd == m_hWndMDIClient) { // Message is sent directly to main frame or // to the MDIClient window if (baseClass::PreTranslateMessage(pMsg)) return TRUE; bCalledBaseClass = true; } HWND hWndFocus = ::GetFocus(); HWND hWndMDIActive = MDIGetActive(); if ((hWndMDIActive == hWndFocus) || (::IsChild(hWndMDIActive, hWndFocus))) { // Message is sent to Active MDI child frame // or a descendant // NOTE: IsChild checks if the window is a direct child or a descendant if (baseClass::PreTranslateMessage(pMsg)) return TRUE; bCalledBaseClass = true; if (hWndMDIActive != NULL) { return (BOOL)::SendMessage(hWndMDIActive, WM_FORWARDMSG, 0, (LPARAM)pMsg); } } if (!bCalledBaseClass) { // If the base class hasn't already had a shot at doing // PreTranslateMessage (because the main frame or an // MDI child didn't have focus), call it now if (baseClass::PreTranslateMessage(pMsg)) return TRUE; // Give active MDI child a chance. if (hWndMDIActive != NULL) { return (BOOL)::SendMessage(hWndMDIActive, WM_FORWARDMSG, 0, (LPARAM)pMsg); } } return FALSE; }
void CMainFrame::OnUpdateEditRepeatUp(CCmdUI *pCmdUI) { if (MDIGetActive()) { pCmdUI->Enable(TRUE); } else { pCmdUI->Enable(FALSE); } }
void CMainFrame::OnUpdateOpenFileClipboard(CCmdUI *pCmdUI) { if (MDIGetActive()) { pCmdUI->Enable(TRUE); } else { pCmdUI->Enable(FALSE); } }
void CMainFrame::OnUpdateFileCapture(CCmdUI *pCmdUI) { if (MDIGetActive()) { pCmdUI->Enable(TRUE); } else { pCmdUI->Enable(FALSE); } }
CHtmlView* CMainFrame::GetActiveHTML() const { CHtmlView* pView = NULL; CMDIChildWnd* pFrame = MDIGetActive (); if (pFrame != NULL) { pView = DYNAMIC_DOWNCAST (CHtmlView, pFrame->GetActiveView ()); } return pView; }
void CMainFrame::EditOptionsPage(int iPage) const { CWnd* pChild = MDIGetActive(); HWND hWnd = (pChild != NULL) ? pChild->GetSafeHwnd() : m_hWnd; CStdString csCurrent = RenderingSet::GetCurrentRenderingSet(); if (iPage > 0) // match code with P:\Pro\Trunk\WSDeltaView\SourceCode\WSShared\OptionsRendering.cpp { csCurrent += "|"; csCurrent += ('0' + iPage); } DoShowNewRenderingSetDialog(csCurrent.c_str(), hWnd, true); }
void CResizableMDIFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { // MDI should call default implementation CMDIFrameWnd::OnGetMinMaxInfo(lpMMI); MinMaxInfo(lpMMI); BOOL bMaximized = FALSE; CMDIChildWnd* pChild = MDIGetActive(&bMaximized); if (pChild != NULL && bMaximized) ChainMinMaxInfo(lpMMI, this, pChild); }
void CMainFrame::OnWebHomePage() { CChildFrame* const pFrame = DYNAMIC_DOWNCAST( CChildFrame, MDIGetActive() ); if( pFrame ) { pFrame->OnWebHomePage(); } else { GoToUrl(L"http://www.workshare.com"); } }
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; }
void CMainFrame::SyncAllRedlines( const CStdString& sDocID, const long lRow ) const { for( CWnd* pChildWnd = MDIGetActive(); pChildWnd; pChildWnd = pChildWnd->GetWindow( GW_HWNDNEXT ) ) { CChildFrame* const pChildFrame = DYNAMIC_DOWNCAST( CChildFrame, pChildWnd ); if( !pChildFrame ) continue; if( SyncMatchingOriginal( sDocID, lRow, pChildFrame ) ) continue; if( SyncMatchingModified( sDocID, lRow, pChildFrame ) ) continue; } }