Example #1
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 = "";
}
Example #2
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);
		}
	}
}
Example #3
0
void DVControllerTests::UserCanSaveWDFTest()
{
	AFX_MANAGE_STATE(AfxGetAppModuleState());

	CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );
	assertTest( pFrame );

	Workshare::OptionApi::SetBool(L"EnableSaveWdfAsNewDocument", false);
	assertTest( ! GetApp()->GetDVController(pFrame)->GetComparisonDocController().UserCanSaveWDF(docNew)) ;
	Workshare::OptionApi::SetBool(L"EnableSaveWdfAsNewDocument", true);
	assertTest(GetApp()->GetDVController(pFrame)->GetComparisonDocController().UserCanSaveWDF(docNew)) ;

	Workshare::OptionApi::SetBool(L"EnableAttachWdfToOriginal", false);
	assertTest( ! GetApp()->GetDVController(pFrame)->GetComparisonDocController().UserCanSaveWDF(docAttachToOriginal)) ;
	Workshare::OptionApi::SetBool(L"EnableAttachWdfToOriginal", true);
	assertTest(GetApp()->GetDVController(pFrame)->GetComparisonDocController().UserCanSaveWDF(docAttachToOriginal)) ;

	Workshare::OptionApi::SetBool(L"EnableAttachWdfToModified", false);
	assertTest( ! GetApp()->GetDVController(pFrame)->GetComparisonDocController().UserCanSaveWDF(docAttachToModified)) ;
	Workshare::OptionApi::SetBool(L"EnableAttachWdfToModified", true);
	assertTest(GetApp()->GetDVController(pFrame)->GetComparisonDocController().UserCanSaveWDF(docAttachToModified)) ;

	Workshare::OptionApi::SetBool(L"EnableVersionWdfToOriginal", false);
	assertTest( ! GetApp()->GetDVController(pFrame)->GetComparisonDocController().UserCanSaveWDF(docVersionOfOriginal)) ;
	Workshare::OptionApi::SetBool(L"EnableVersionWdfToOriginal", true);
	assertTest(GetApp()->GetDVController(pFrame)->GetComparisonDocController().UserCanSaveWDF(docVersionOfOriginal)) ;

	Workshare::OptionApi::SetBool(L"EnableVersionWdfToModified", false);
	assertTest( ! GetApp()->GetDVController(pFrame)->GetComparisonDocController().UserCanSaveWDF(docVersionOfModified)) ;
	Workshare::OptionApi::SetBool(L"EnableVersionWdfToModified", true);
	assertTest(GetApp()->GetDVController(pFrame)->GetComparisonDocController().UserCanSaveWDF(docVersionOfModified)) ;
}
Example #4
0
void DVControllerTests::TestKillWordInstanceStartedBySaveComparison()
{
	AFX_MANAGE_STATE(AfxGetAppModuleState());
	CStdString sSaveFilters;
	int iFormatCount=0;

	CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );
	assertTest( pFrame );
	
	CUIntArray aFormats;
	LONG lFormatIndex	= 1;
	LONG lCurrentSaveFormatID = 0;
	LONG lSaveFormatIDDefault = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode();
//for rtf
	LONG lFlags = 6;  //rtf
	if (lSaveFormatIDDefault !=6)
	{
		lSaveFormatIDDefault=6; //for test rtf
	}
	bool bOriginalAllowFormatSetting = Workshare::OptionApi::GetBool(L"AllowFileFormatChange");
	Workshare::OptionApi::SetBool(L"AllowFileFormatChange", false);

	//This creates a WinWord
	sSaveFilters = GetApp()->GetDVController(pFrame)->GetComparisonDocController().InitialiseSaveAsDlgData(aFormats, lFormatIndex, lCurrentSaveFormatID, lSaveFormatIDDefault, lFlags, docNew);

	assertImplementation(TestWordConnection(),_T("Should have Created a Word Instance after InitialiseSaveAsDlgData"),__LINE__,_T(__FILE__));

	assertImplementation(GetApp()->GetDVController(pFrame)->GetComparisonDocController().KillWordInstanceStartedBySaveComparison(),_T("Should kill the word instance stated by SaveComparison"),__LINE__,_T(__FILE__));
}
Example #5
0
BOOL CGotoDlg::OnInitDialog() 
{
	CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );

	CWSDialog::OnInitDialog();
	
	CWSUIExtras::SetWSDialogWindowText(CWnd::GetSafeHwnd(), Workshare::Products::WS_PROD_COMPARE);

	m_btnGoto.SubclassDlgItem( IDGOTO, this );
	m_btnClose.SubclassDlgItem( IDCLOSE, this );

	if (pFrame && pFrame->GetCompositeView())
	{
		CRect rcView;
		pFrame->GetCompositeView()->GetWindowRect(rcView);
		SetWindowPos(&wndTop, rcView.left+10, rcView.top+10, 0, 0, SWP_NOSIZE);
	}
	
	// Setup the help link.
	m_StaticHyperLinkHelp.SubclassDlgItem(IDC_HELPLINK, this);
	m_StaticHyperLinkHelp.m_iHelpID = GetHelpID();

	SetDefID(IDGOTO);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Example #6
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();
}
Example #7
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);
	

}
Example #8
0
void CCoolMenuBarCtrl::UpdateWindowMenu(CMenu* pMenu)
{
	for ( UINT nItem = 0 ; nItem < pMenu->GetMenuItemCount() ; nItem++ )
	{
		UINT nID = pMenu->GetMenuItemID( nItem );
		
		if ( nID >= AFX_IDM_FIRST_MDICHILD )
		{
			for ( UINT nRemove = nItem ; nRemove < pMenu->GetMenuItemCount() ; )
				pMenu->RemoveMenu( nItem, MF_BYPOSITION );
			pMenu->RemoveMenu( nItem - 1, MF_BYPOSITION );
			break;
		}
	}
	
	CMDIFrameWnd* pFrame = (CMDIFrameWnd*)AfxGetMainWnd();
	if ( ! pFrame->IsKindOf( RUNTIME_CLASS(CMDIFrameWnd) ) ) return;
	
	for ( CWnd* pClient = pFrame->GetWindow( GW_CHILD ) ; pClient ; pClient = pClient->GetNextWindow() )
	{
		TCHAR szClass[64];
		GetClassName( pClient->GetSafeHwnd(), szClass, 64 );
		if ( _tcsicmp( szClass, _T("MDIClient") ) == 0 ) break;
	}
	
	if ( pClient == NULL ) return;
	
	CMDIChildWnd* pActive = pFrame->MDIGetActive();
	BOOL bSeparator = TRUE;
	
	for ( UINT nIndex = 1, nID = AFX_IDM_FIRST_MDICHILD ; nIndex <= 10 ; nIndex++, nID++ )
	{
		CWnd* pWnd = pClient->GetDlgItem( nID );
		if ( ! pWnd ) break;
		
#ifdef _SHAREAZA
		CChildWnd* pChildWnd = (CChildWnd*)pWnd;
		if ( pChildWnd->m_bTabMode )
		{
			nIndex--;
			continue;
		}
#endif
		
		if ( bSeparator )
		{
			pMenu->AppendMenu( MF_SEPARATOR, ID_SEPARATOR );
			bSeparator = FALSE;
		}
		
		CString strMenu, strWindow;
		pWnd->GetWindowText( strWindow );
		
		strMenu.Format( _T("&%i %s"), nIndex, (LPCTSTR)strWindow );
		
		pMenu->AppendMenu( MF_STRING | ( pWnd == pActive ? MF_CHECKED : 0 ),
			nID, strMenu );
	}
}
Example #9
0
void DVControllerTests::setUp()
{
	AFX_MANAGE_STATE(AfxGetAppModuleState());
	
	CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );
	if( !pFrame )
		GetApp()->RealFileNew();
}
Example #10
0
void CModalDisplayPropSheet::OnApplyNow()
{
	CMDIFrameWnd* pMDIFrameWnd = (CMDIFrameWnd*)AfxGetMainWnd();
	ASSERT(pMDIFrameWnd->IsKindOf(RUNTIME_CLASS(CMDIFrameWnd)));
	CView* pView = pMDIFrameWnd->MDIGetActive()->GetActiveView();
//	pView->SendMessage(WM_USER_CHANGE_OBJECT_PROPERTIES, 0, 0);
//	m_stylePage.SetModified(FALSE);
//	m_colorPage.SetModified(FALSE);
}
Example #11
0
void CGotoDlg::OnClose() 
{
	CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );

	EndDialog(0);	
	
	delete pFrame->m_pGotoDlg;
	pFrame->m_pGotoDlg = NULL;
}
Example #12
0
IComparison* Comparisons::NewEx(LPCTSTR originalDocId, LPCTSTR modifiedDocId, VARIANT &renderingSet, LONG comparisonMode, VARIANT_BOOL showSelectorDialog, BSTR originalDescription, BSTR modifiedDescription)
{
	AFX_MANAGE_STATE(AfxGetAppModuleState());
	AutomationInteractionSuppressor ais;

	CDeltaViewCommandLineInfo cmdInfo;
	cmdInfo.m_sOriginal = EnsureDocId(originalDocId);
	cmdInfo.m_sModified = EnsureDocId(modifiedDocId);
	cmdInfo.m_sOriginalDisplayName = originalDescription;
	cmdInfo.m_sModifiedDisplayName = modifiedDescription;
	cmdInfo.m_bShowSelector = showSelectorDialog != VARIANT_FALSE;
	CStdString selectedRenderingSet = RenderingSet::GetCurrentRenderingSet();
	_variant_t vrenderSet = renderingSet;
	if (vrenderSet.vt == VT_BSTR)
	{
		selectedRenderingSet = _bstr_t(vrenderSet);
	}
	RenderingSetOverride rso(selectedRenderingSet);

	cmdInfo.m_comparisonOption = comparisonMode;
	cmdInfo.m_bSilentMode = showSelectorDialog == VARIANT_FALSE;

	COptionsDlgSelector optSelector;
	if(optSelector.SetDlgInformation(cmdInfo) == S_FALSE)
		return FALSE;

	if( cmdInfo.ShouldShowDocumentSelectorDlg() )
	{		
		if( !optSelector.ShowDialog() )
		{
			// Dialog might have returned false because it was cancelled during a right-click op.
			// If so, don't display a 'unable to compare' error.  ST2085
			if( !optSelector.Cancelled() )
			{
				AfxThrowOleDispatchException(1105, L"Comparison failed.");
			}
			AfxThrowOleDispatchException(1106, L"Cancelled.");
		}
	}
	else
	{
		if (!optSelector.StartComparisons())
		{
			AfxThrowOleDispatchException(1105, L"Comparison failed.");
		}
	}

// TODO - can we get the frame in a better way
	CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );
	CDeltaVwDoc* pDoc = pFrame->GetDocument();
	UpdateOpenList();
	return FindComObject(pDoc);

}
Example #13
0
void CModuleWnd::OnAddForm() 
{
	CMDIFrameWnd* pParentFrame = (CMDIFrameWnd*)AfxGetMainWnd();
	CMDIChildWnd* pMDIActive = pParentFrame->MDIGetActive();
	if (pMDIActive != NULL)	
	{
		CFormDoc* pActiveDoc = (CFormDoc *)pMDIActive->GetActiveDocument();
		OnLibCopy();
		pActiveDoc->m_pDocument->DoPasteSubDocument(NULL);
	}
}
// 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;
}
Example #15
0
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
  BOOL bMaximized = FALSE;
  CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetApp()->m_pMainWnd;
  if( ((pFrame->MDIGetActive( &bMaximized) == NULL) || (bMaximized)) && 
      (theApp.m_Preferences.ap_AutoMaximizeWindow) )
  {
    cs.style |= WS_VISIBLE | WS_MAXIMIZE;
  }

	return CMDIChildWnd::PreCreateWindow(cs);
}
BOOL CMyPropertySheet::OnCommand(WPARAM wParam, LPARAM lParam)
{
   if (LOWORD(wParam) == IDOK)
   {
      CMDIFrameWnd* pframe = (CMDIFrameWnd*) AfxGetMainWnd();
      CMDIChildWnd* pchild = pframe->MDIGetActive();
      CPSheetDoc* doc = (CPSheetDoc*) pchild->GetActiveDocument();
      doc->m_LastActivePage = GetPageIndex(GetActivePage()); // or GetActiveIndex()
   }

   return CPropertySheet::OnCommand(wParam, lParam);
}
Example #17
0
CView* CMainFrame::getMDIChildActiveView() 
{
	CView *pView = NULL ;
	{
		CMDIFrameWnd *pFrame = this ;
		CMDIChildWnd *pChild = pFrame->MDIGetActive();
		if ( pChild != NULL ){
			pView = pChild->GetActiveView();
		}
	}
	return pView ;
}
//****************************************************************************************
void CBCGPToolbarSystemMenuButton::OnDblClick (CWnd* pWnd)
{
	if (CBCGPToolBar::IsCustomizeMode ())
	{
		return;
	}

	ASSERT (pWnd != NULL);

	//////////////////////////////////////////////
	// Make sure to close the popup menu and
	// find the MDI frame correctly.
	//--------------------------------------------
	OnCancelMode ();

	CFrameWnd* pParentFrame = BCGPGetParentFrame (pWnd);
	if(pParentFrame != NULL && pParentFrame->IsKindOf (RUNTIME_CLASS (CMiniDockFrameWnd)))
	{
		pParentFrame = (CFrameWnd*) pParentFrame->GetParent ();
	}

	CMDIFrameWnd* pMDIFrame = 
		DYNAMIC_DOWNCAST (CMDIFrameWnd, pParentFrame);

	if (pMDIFrame != NULL)
	{
		CMDIChildWnd* pChild = pMDIFrame->MDIGetActive ();
		ASSERT_VALID (pChild);

		BOOL bCloseIsDisabled = FALSE;

		CMenu* pSysMenu = pChild->GetSystemMenu (FALSE);
		if (pSysMenu != NULL)
		{
			MENUITEMINFO menuInfo;
			ZeroMemory(&menuInfo,sizeof(MENUITEMINFO));
			menuInfo.cbSize = sizeof(MENUITEMINFO);
			menuInfo.fMask = MIIM_STATE;

			pSysMenu->GetMenuItemInfo (SC_CLOSE, &menuInfo);
			bCloseIsDisabled =	((menuInfo.fState & MFS_GRAYED) || 
								(menuInfo.fState & MFS_DISABLED));
		}

		if (!bCloseIsDisabled)
		{
			pChild->SendMessage (WM_SYSCOMMAND, SC_CLOSE);
		}
	}
	//--------------------------------------------
	//////////////////////////////////////////////
}
Example #19
0
void DVControllerTests::TestGetOptionalFrameWindowHandle()
{
	AFX_MANAGE_STATE(AfxGetAppModuleState());

	CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );
	assertTest( pFrame );

	long lGotHandle = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetOptionalFrameWindowHandle( pFrame );
	assertTest(lGotHandle == (long)pFrame->GetSafeHwnd());

	lGotHandle = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetOptionalFrameWindowHandle(NULL);
	assertTest(lGotHandle == 0);
}
Example #20
0
void CChildFrame::OnNcPaint() 
{
	// OnWindowPosChanged() and OnNcPaint() methods
	// implemented to fix WinXP MDI interface flicker bug
CMDIFrameWnd * pMdiFrame =
		STATIC_DOWNCAST( CMDIFrameWnd, GetParentFrame() );
	ASSERT_VALID( pMdiFrame );
BOOL bMax = FALSE;
CMDIChildWnd * pActive = pMdiFrame->MDIGetActive( &bMax );
	pActive;
	if( bMax )
		return;
	CMDIChildWnd::OnNcPaint();
}
Example #21
0
int CMDIChildWnd::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
{
	int nResult = CFrameWnd::OnMouseActivate(pDesktopWnd, nHitTest, message);
	if (nResult == MA_NOACTIVATE || nResult == MA_NOACTIVATEANDEAT)
		return nResult;   // frame does not want to activate

	// activate this window if necessary
	CMDIFrameWnd* pFrameWnd = GetMDIFrame();
	ENSURE_VALID(pFrameWnd);
	CMDIChildWnd* pActive = pFrameWnd->MDIGetActive();
	if (pActive != this)
		MDIActivate();

	return nResult;
}
Example #22
0
void CGotoDlg::OnGoto() 
{
	CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );

	CString csBmkNumber;
	m_txtChangeNumber.GetWindowText(csBmkNumber);

	if (!pFrame->Navigate(NAV_GOTO, _ttoi(csBmkNumber)))
	{
		CStdString csMsg = /*TXTEX*/CStdString::LoadResource(IDS_TXTEX_theChangeNumberEnteredDoesNotExistInCurrentDocument5050,_T("The change number entered does not exist in the current document."));
		GetApp()->ShowMessageEx(this->m_hWnd, csMsg, WsOK, WsDefault, WsInfoIcon, L"", CDeltaVwApp::GetProductHelpID(HIDC_CHANGE_NOT_FOUND), LOG_LOCATION);
	}
	BringWindowToTop();
	m_txtChangeNumber.SetSel(0,-1);
}
Example #23
0
CView* CGeorgesEditDoc::switchToView(CView* pNewView)
{
	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 = pChild->GetActiveView();

	pChild->RecalcLayout();
	pNewView->UpdateWindow();
	pChild->SetActiveView(pNewView);

	return pOldActiveView;
}
Example #24
0
void CModuleWnd::OnAddSubmodule()
{
	CMDIFrameWnd* pParentFrame = (CMDIFrameWnd*)AfxGetMainWnd();
	CMDIChildWnd* pMDIActive = pParentFrame->MDIGetActive();
	if (pMDIActive != NULL)	
	{
		CFormDoc* pActiveDoc = (CFormDoc *)pMDIActive->GetActiveDocument();
		if (pActiveDoc == NULL)
			return;
		CLayoutView* pView = pActiveDoc->GetLayoutView();
		if (pView == NULL)
			return;
		OnLibCopy();
		pView->DoPasteSubmodule(NULL, NULL);
	}
}
Example #25
0
void CLuaEditCtrl::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CMDIFrameWnd *frameWnd = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	CLuaFrame *pFrame = DYNAMIC_DOWNCAST(CLuaFrame, frameWnd->MDIGetActive());

	if (m_bShowCalltips && pFrame != NULL && pFrame->IsDebugging())
	{
		char  linebuf[1000];
		int  pos  =  Sci(SCI_POSITIONFROMPOINT, point.x, point.y);
		int start = Sci(SCI_WORDSTARTPOSITION, pos, TRUE);
		int end = Sci(SCI_WORDENDPOSITION, pos, TRUE);
		TextRange tr;
		tr.chrg.cpMin = start;
		tr.chrg.cpMax = end;
		tr.lpstrText = linebuf;
		Sci(SCI_GETTEXTRANGE, 0, long(&tr));
		
		CString strCalltip;
		CDebugger *pDebugger = pFrame->GetDebugger();

		if ( pDebugger->GetCalltip(linebuf, strCalltip.GetBuffer(1000)) )
		{
			if  (Sci(SCI_CALLTIPACTIVE) && m_strCallTip!=strCalltip)
			{
				Sci(SCI_CALLTIPCANCEL);
			}

			if (!Sci(SCI_CALLTIPACTIVE))
			{
				Sci(SCI_CALLTIPSHOW,  start,  (int)strCalltip.GetBuffer(0));
				strCalltip.ReleaseBuffer();
				m_strCallTip = strCalltip;
			}
		}
		else if (Sci(SCI_CALLTIPACTIVE))
		{
			Sci(SCI_CALLTIPCANCEL);
		}
	}
	else if (Sci(SCI_CALLTIPACTIVE))
	{
		Sci(SCI_CALLTIPCANCEL);
	}

	CWnd::OnMouseMove(nFlags, point);
}
Example #26
0
BOOL CMDIChildWnd::UpdateClientEdge(LPRECT lpRect)
{
	// only adjust for active MDI child window
	CMDIFrameWnd* pFrameWnd = GetMDIFrame();
	CMDIChildWnd* pChild = pFrameWnd->MDIGetActive();

	// Only adjust for regular MDI child windows, not tabbed windows.  Attempting to set WS_EX_CLIENTEDGE on the tabbed
	// MDI client area window is subverted by CMDIClientAreaWnd::OnStyleChanging, so we always try to reset the style and
	// always repaint, none of which is necessary since the tabbed MDI children never change from maximized to restored.
	//CMDIChildWndEx* pChildEx = (pChild == NULL) ? NULL : DYNAMIC_DOWNCAST(CMDIChildWndEx, pChild);
	//BOOL bIsTabbedMDIChild = (pChildEx == NULL) ? FALSE : pChildEx->GetMDIFrameWndEx() != NULL && pChildEx->GetMDIFrameWndEx()->AreMDITabs();
	if ((pChild == NULL || pChild == this) /*&& !bIsTabbedMDIChild*/)
	{
		// need to adjust the client edge style as max/restore happens
		DWORD dwStyle = ::GetWindowLong(pFrameWnd->m_hWndMDIClient, GWL_EXSTYLE);
		DWORD dwNewStyle = dwStyle;
		if (pChild != NULL && !(GetExStyle() & WS_EX_CLIENTEDGE) && (GetStyle() & WS_MAXIMIZE))
		{
			dwNewStyle &= ~(WS_EX_CLIENTEDGE);
		}
		else
		{
			dwNewStyle |= WS_EX_CLIENTEDGE;
		}

		if (dwStyle != dwNewStyle)
		{
			// SetWindowPos will not move invalid bits
			::RedrawWindow(pFrameWnd->m_hWndMDIClient, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN);

			// remove/add WS_EX_CLIENTEDGE to MDI client area
			::SetWindowLong(pFrameWnd->m_hWndMDIClient, GWL_EXSTYLE, dwNewStyle);
			::SetWindowPos(pFrameWnd->m_hWndMDIClient, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOCOPYBITS);

			// return new client area
			if (lpRect != NULL)
			{
				::GetClientRect(pFrameWnd->m_hWndMDIClient, lpRect);
			}

			return TRUE;
		}
	}

	return FALSE;
}
Example #27
0
LRESULT KSwordTestView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	// TODO: Add your specialized code here and/or call the base class
	LRESULT hr = CView::WindowProc(message, wParam, lParam);

	switch(message)
	{
	case WM_LBUTTONDOWN:
	case WM_LBUTTONUP:
	case WM_RBUTTONDOWN:
	case WM_RBUTTONUP:
	case WM_MBUTTONDOWN:
	case WM_MBUTTONUP:
	case WM_MOUSEWHEEL:
	case WM_MOUSEMOVE:
	case WM_CHAR:
	case WM_KEYDOWN:
	case WM_KEYUP:

	case ID_EDIT_UNDO:
	case ID_EDIT_CUT:
	case ID_EDIT_COPY:
	case ID_EDIT_PASTE:
	case ID_EDIT_REDO:
		{

			CMDIFrameWnd *pMainFrame = (CMDIFrameWnd*)AfxGetMainWnd(); //by dengzhihui 2006年7月6日 14:48:48
			CMDIChildWnd* pWnd = pMainFrame->MDIGetActive();

			//if (pWnd==pChildFrame)
			//{
				//g_GraphiceEngine.SetCurCamera(&m_Camera);
				//g_cEngineManager.ProcessMessage(message,wParam,lParam);
				//m_Camera = *g_GraphiceEngine.GetCurCamera();
			//}
			break;
		}
	}

	return hr;
}
Example #28
0
void DVControllerTests::TestGetSaveFormatAsDVCode()
{
	AFX_MANAGE_STATE(AfxGetAppModuleState());

	short nStoreOption = Workshare::OptionApi::GetInt(L"DocFormat");

	CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );
	assertTest( pFrame );

	Workshare::OptionApi::SetInt(L"DocFormat", -1);
	long lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode();
	assertTest(lRetVal == WSCONVERTERLib::dvFormatWDF);

	Workshare::OptionApi::SetInt(L"DocFormat", 6);
	lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode();
	assertTest(lRetVal == WSCONVERTERLib::dvFormatRTF);

	Workshare::OptionApi::SetInt(L"DocFormat", 0);
	lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode();
	assertTest(lRetVal == WSCONVERTERLib::dvFormatDocument);

	Workshare::OptionApi::SetInt(L"DocFormat", 12);
	lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode();
	assertTest(lRetVal == WSCONVERTERLib::dvFormatXMLDocument);

	Workshare::OptionApi::SetInt(L"DocFormat", 2);
	lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode();
	assertTest(lRetVal == WSCONVERTERLib::dvFormatText);

	Workshare::OptionApi::SetInt(L"DocFormat", -7);
	lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode();
	assertTest(lRetVal == WSCONVERTERLib::dvFormatPDF);

	//check for default
	Workshare::OptionApi::SetInt(L"DocFormat", 50);
	lRetVal = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode();
	assertTest(lRetVal == WSCONVERTERLib::dvFormatWDF);

	Workshare::OptionApi::SetInt(L"DocFormat", nStoreOption);
}
Example #29
0
IComparison* Comparisons::Open(LPCTSTR wdfDocId)
{
	AFX_MANAGE_STATE(AfxGetAppModuleState());
	AutomationInteractionSuppressor ais;


	CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	GetApp()->RealFileNew();
// TODO - can we get the frame in a better way
	CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() );

	if (pFrame)
	{
	// TODO - do we need this
		GetDVController(pFrame)->CloseDocument(true);
		GetDVController(pFrame)->CloseDocument(false);

		GetDVController(pFrame)->CloseCompositeDocument();
		GetDVController(pFrame)->GetComparisonDocController().CloseComparisonDocument();

		if( pFrame->GetCompositeBar() )
			pFrame->GetCompositeBar()->OnInitialUpdate();

		pFrame->ShowWindow(SW_SHOW);
		pFrame->BringWindowToTop();

		if (!GetDVController(pFrame)->LoadWDF(wdfDocId))
		{
			AfxThrowOleDispatchException(1102, L"File not found : " + CString(wdfDocId));
		}


		pFrame->GetDocument()->UpdateAllViews(NULL);
		UpdateOpenList();
		return FindComObject(pFrame->GetDocument());
	}
	AfxThrowOleDispatchException(1101, L"Internal Error");
	return NULL;
}
Example #30
0
BOOL CMDIChildWnd::UpdateClientEdge(LPRECT lpRect)
{
	if (!afxData.bWin4)
		return FALSE;

	// only adjust for active MDI child window
	CMDIFrameWnd* pFrameWnd = GetMDIFrame();
	CMDIChildWnd* pChild = pFrameWnd->MDIGetActive();
	if (pChild == NULL || pChild == this)
	{
		// need to adjust the client edge style as max/restore happens
		DWORD dwStyle = ::GetWindowLong(pFrameWnd->m_hWndMDIClient, GWL_EXSTYLE);
		DWORD dwNewStyle = dwStyle;
		if (pChild != NULL && !(GetExStyle() & WS_EX_CLIENTEDGE) &&
		  (GetStyle() & WS_MAXIMIZE))
			dwNewStyle &= ~(WS_EX_CLIENTEDGE);
		else
			dwNewStyle |= WS_EX_CLIENTEDGE;

		if (dwStyle != dwNewStyle)
		{
			// SetWindowPos will not move invalid bits
			::RedrawWindow(pFrameWnd->m_hWndMDIClient, NULL, NULL,
				RDW_INVALIDATE | RDW_ALLCHILDREN);

			// remove/add WS_EX_CLIENTEDGE to MDI client area
			::SetWindowLong(pFrameWnd->m_hWndMDIClient, GWL_EXSTYLE, dwNewStyle);
			::SetWindowPos(pFrameWnd->m_hWndMDIClient, NULL, 0, 0, 0, 0,
				SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE |
				SWP_NOZORDER | SWP_NOCOPYBITS);

			// return new client area
			if (lpRect != NULL)
				::GetClientRect(pFrameWnd->m_hWndMDIClient, lpRect);
			return TRUE;
		}
	}
	return FALSE;
}