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);
}
int CObjectFrm::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    CMDIFrameWnd *mainWnd;
    RECT rectMain;

    // Register the doc templates we provide to the app
    CWinApp* pApp = AfxGetApp();
    ASSERT(pApp != NULL);
    mainWnd = DYNAMIC_DOWNCAST(CMDIFrameWnd, pApp->m_pMainWnd);

    // get the apps instance handle for loading resources
    m_AppInst = AfxGetResourceHandle();
    // now tell the application to look in dll for resources
    AfxSetResourceHandle(ObjectEditorDLL.hModule);

    mainWnd->GetClientRect(&rectMain);

    if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
        return -1;


    AfxSetResourceHandle(m_AppInst);

    return 0;
}
void OCCDemo_Presentation::ResetView()
{
	CMDIFrameWnd *pFrame =  (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	CMDIChildWnd *pChild =  (CMDIChildWnd *) pFrame->GetActiveFrame();
	COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
	pView->Reset();
}
Exemple #4
0
LRESULT CDocSelector::OnSelChange(WPARAM wParam, LPARAM)
{
	// Killing the timer, because timer can change the
	// selection in between the procedure...
	KillTimer( DS_TIMER_ID ); // Yogesh Jagota

	// sent when a button gets clicked
	CSwitcherButton* newsel = (CSwitcherButton*)wParam;

	// Yogesh Jagota
	CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetMainWnd();
	CWnd* Window = (CWnd*)newsel->m_FrameWnd;

	WINDOWPLACEMENT	wndpl;

	Window->GetWindowPlacement( &wndpl);

	if(wndpl.showCmd == SW_SHOWMINIMIZED) Window->ShowWindow(SW_RESTORE);
	
	pFrame->MDIActivate( Window );
	// End Yogesh Jagota

	if (m_iSelectedButton > -1)
		GetButtonFromID(m_iSelectedButton)->Unselect();

	m_iSelectedButton = newsel->m_iID;

	// Reactivate the timer...
	SetTimer( DS_TIMER_ID, 10, NULL ); // Yogesh Jagota

	return 1;
}
Exemple #5
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();
}
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);
		}
	}
}
Exemple #7
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();
}
Exemple #8
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
}
Exemple #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(""));
		}
	}
}
Quantity_Factor OCCDemo_Presentation::GetViewScale()
{
	CMDIFrameWnd *pFrame =  (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	CMDIChildWnd *pChild =  (CMDIChildWnd *) pFrame->GetActiveFrame();
	COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
	return pView->GetViewScale();
}
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__));
}
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 = "";
}
Exemple #13
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);
	

}
Exemple #14
0
	// ----- zhfzhftool._dttk command (do not rename)
	static void zhfzhftool_dttk(void)
	{
		// Add your code for command zhfzhftool._dttk here
		if (g_bIsTukuFirst)
		{
			InitApplication() ;
		}
		else
		{
			CMDIFrameWnd* pAcadFrame  = acedGetAcadFrame();

			if (g_pArrayZhfPaletteSet.GetCount()>1)
			{
				CZhfPaletteSet* pSet = g_pArrayZhfPaletteSet.GetAt(1) ;
				if (pSet->IsWindowVisible())
				{
					pAcadFrame->ShowControlBar(pSet, FALSE, FALSE);
				}
				else
				{
					pAcadFrame->ShowControlBar(pSet, TRUE, FALSE);
				}	
			}
			else
			{
				acutPrintf(_T("\n图库面板没有创建或创建失败,无法显示!")) ;
			}
		}
	}
void COCCDemoDoc::Fit()
{
	CMDIFrameWnd *pFrame =  (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
	CMDIChildWnd *pChild =  (CMDIChildWnd *) pFrame->GetActiveFrame();
	COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
	pView->FitAll();
}
Exemple #16
0
LRESULT CDocSelector::OnSelChange(WPARAM wParam, LPARAM)
{
	// Killing the timer, because timer can change the
	// selection in between the procedure...
	KillTimer( DS_TIMER_ID ); // Yogesh Jagota

	// sent when a button gets clicked
	CSwitcherButton* newsel = (CSwitcherButton*)wParam;

	// Yogesh Jagota
	CMDIFrameWnd *pFrame = (CMDIFrameWnd *)AfxGetMainWnd();
	//CWnd* Window = (CWnd*)newsel->m_FrameWnd;//Y.Ivanov
	CWnd* Window = (CWnd*)newsel->m_AttachedView->GetParentFrame();//Yuriy Ivanov
	pFrame->MDIActivate( Window );
	if(Window->IsIconic())
		Window->ShowWindow(SW_SHOWNORMAL);
	pFrame->Invalidate();

	// End Yogesh Jagota

	if (m_iSelectedButton > -1)
		GetButtonFromID(m_iSelectedButton)->Unselect();

	m_iSelectedButton = newsel->m_iID;

	// Reactivate the timer...
	SetTimer( DS_TIMER_ID, 10, NULL ); // Yogesh Jagota


	return 1;
}
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)) ;
}
bool CParticleEditor::ShowGraph()
{
	CMDIFrameWnd *pMainWnd = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd());
	ASSERT(pMainWnd != NULL);

	// do not create toolbar second time
	if (IsWindow(m_ParticleGraph))
	{
		//BOOL bShown = m_ParticleGraph.ShowWindow(SW_SHOW);
		//if (!bShown)
		//	pMainWnd->DockControlBar(&m_ParticleGraph, AFX_IDW_DOCKBAR_BOTTOM, NULL);
		return false;
	}

	if (!m_ParticleGraph.Create(_T("Particle Graph"), WS_CHILD | WS_VISIBLE, pMainWnd, ID_VIEW_GRAPH))
	{
		m_ToolBox->Log(LOGERROR, _T("Failed to create m_ParticleGraph window bar\n"));
		return false;
	}
	m_ParticleGraph.EnableDocking(CBRS_ALIGN_ANY);
	const DWORD dwBarStyle = CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC;
	m_ParticleGraph.SetBarStyle(m_ParticleGraph.GetBarStyle() | dwBarStyle);
	pMainWnd->DockControlBar(&m_ParticleGraph, AFX_IDW_DOCKBAR_BOTTOM, NULL);
	return true;
}
Exemple #19
0
CWnd *CMDIChildWnd::GetMessageBar()
/*********************************/
{
    CMDIFrameWnd *pFrame = GetMDIFrame();
    ASSERT( pFrame != NULL );
    return( pFrame->GetMessageBar() );
}
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);
}
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);
}
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 );
	}
}
int CRenderFrm::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	CMDIFrameWnd *mainWnd;
	RECT rectMain;
		
	// Register the doc templates we provide to the app
	CWinApp* pApp = AfxGetApp();
	ASSERT(pApp != NULL);
	mainWnd = DYNAMIC_DOWNCAST(CMDIFrameWnd, pApp->m_pMainWnd);

	// get the apps instance handle for loading resources
	m_AppInst = AfxGetResourceHandle();
	// now tell the application to look in dll for resources
	AfxSetResourceHandle(RenderViewerDLL.hModule);

	mainWnd->GetClientRect(&rectMain);

	if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
/*	if (!m_ExampleToolPal.CreateEx(mainWnd, TBSTYLE_FLAT | TBSTYLE_WRAPABLE , WS_CHILD | WS_VISIBLE | CBRS_RIGHT
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_FIXED, CRect(0, 2, 2, 4)) ||
		!m_ExampleToolPal.LoadToolBar(IDR_EXAMPLE_TOOL_PALETTE))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	m_ExampleToolPal.SetBorders(2, 2, 2, 2);

	m_ExampleToolPal.EnableDocking(CBRS_ORIENT_ANY);
	// make control bar notify us.

	mainWnd->DockControlBar(&m_ExampleToolPal);

	CRect tcRect;
	m_ExampleToolPal.GetToolBarCtrl().SetRows(1, FALSE, tcRect);
	int iconWidth;
	int iconHeight;
	int nRows;

	iconWidth = tcRect.Width()/NUMICONS;
	iconHeight = tcRect.Height();
	nRows = (NUMICONS / NICONSWIDE) + (((NUMICONS % NICONSWIDE) == 0) ? 0 : 1);

	tcRect.SetRect(0, 0, iconWidth * NICONSWIDE, (iconHeight * nRows));

	// Set the window size
	m_ExampleToolPal.SetWindowPos(NULL, 0, 0, tcRect.Width(), tcRect.Height(),
		SWP_NOACTIVATE  | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOREDRAW);

	
	mainWnd->ShowControlBar(&m_ExampleToolPal, FALSE, FALSE);
*/	
	AfxSetResourceHandle(m_AppInst);
	
	return 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();
}
Exemple #25
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);
}
Exemple #26
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;
}
BOOL CLayerManager::ShowDockPane(BOOL bShow /*= TRUE*/)
{
	CMDIFrameWnd *pAcadFrame = acedGetAcadFrame();
	if (pAcadFrame)
	{
		pAcadFrame->ShowControlBar(this, bShow, FALSE);
		return TRUE;
	}
	return FALSE;
}
Exemple #28
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;
}
Exemple #29
0
static void
mfc_show()
{
  if (!(mfc_showing&1)) {
    CMDIFrameWnd *fw = (CMDIFrameWnd *)(the_boss.m_pMainWnd);
    fw->ShowWindow(the_boss.m_nCmdShow);
    fw->UpdateWindow();
    mfc_showing |= 1;
  }
}
Exemple #30
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);

}