Esempio n. 1
0
void CMainFrame::OnPaletteChanged(CWnd* pFocusWnd) 
{
	CFrameWnd::OnPaletteChanged(pFocusWnd);
	
	// TODO: Add your message handler code here
	
    ///////////////////////////////////////
    ///////////////////////////////////////
    // START CUSTOM CODE
    ///////////////////////////////////////
    ///////////////////////////////////////

    // Get a pointer to the view window.
    CView* pView = GetActiveView();

    // If it isn't the view window changing the palette,
    // redraw the view window with the newly mapped palette.
    if (pFocusWnd != pView)
        pView->Invalidate();

    ///////////////////////////////////////
    ///////////////////////////////////////
    // END CUSTOM CODE
    ///////////////////////////////////////
    ///////////////////////////////////////
}
Esempio n. 2
0
BOOL CRVTrackerTextureWrap::OnUpdate(const CUIEvent &cEvent)
{
	// Don't update if it hasn't moved
	if (m_cCurPt == m_cLastPt)
		return TRUE;

	// Get the new ending position
	CEditRay cEndRay = m_pView->ViewDef()->MakeRayFromScreenPoint(m_cCurPt);
	CEditPlane *pPlane = &(m_rBasePoly()->m_Plane);
	CReal fPlaneDist = pPlane->DistTo(cEndRay.m_Pos) / -pPlane->m_Normal.Dot(cEndRay.m_Dir);

	LTVector vPos = cEndRay.m_Dir * fPlaneDist + cEndRay.m_Pos;
	CEditVert vEndPos(vPos);

	// Update the drawing brush
	m_pView->DrawingBrush().m_Points.Last() = vEndPos;

	// Redraw the views
	POSITION pos = m_pView->GetDocument()->GetFirstViewPosition();
	while (pos)
	{
		CView *pView = m_pView->GetDocument()->GetNextView(pos);
		pView->Invalidate(FALSE);
	}

	// Update the last position...
	m_cLastPt = m_cCurPt;

	return TRUE;
}
Esempio n. 3
0
BOOL CWavProgressDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	static_cast<CProgressCtrl*>(GetDlgItem(IDC_PROGRESS_BAR))->SetRange(0, 100);
	CView *pView = static_cast<CFrameWnd*>(AfxGetMainWnd())->GetActiveView();		// // //
	CSoundGen *pSoundGen = theApp.GetSoundGenerator();

	pView->Invalidate();
	pView->RedrawWindow();

	// Start rendering
	CString FileStr;
	AfxFormatString1(FileStr, IDS_WAVE_PROGRESS_FILE_FORMAT, m_sFile);
	SetDlgItemText(IDC_PROGRESS_FILE, FileStr);

	if (!pSoundGen->RenderToFile(m_sFile.GetBuffer(), m_iSongEndType, m_iSongEndParam, m_iTrack))
		EndDialog(0);

	m_dwStartTime = GetTickCount();
	SetTimer(0, 200, NULL);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 4
0
void CMainFrame::OnOutlookBarShortcut(UINT id)
{
	const int nIndex = id - ID_SHORTCUT_1;

	ASSERT( nIndex >=0 && nIndex < NUMVIEWS );
	if ( nIndex < 0 || nIndex >= NUMVIEWS )
		return;

	if (!m_pViews)
		return;

	CView* pNewView = m_pViews[nIndex];
	if (!pNewView)
		return;

	CView* pActiveView =GetActiveView();

	if ( !pActiveView )    // No currently active view
		return;

	if ( pNewView == pActiveView )    // Already there
		return;

	m_nCurView = nIndex;    // Store the new current view's index

	// exchange view window ID's so RecalcLayout() works
	UINT temp = ::GetWindowLong(pActiveView->m_hWnd, GWL_ID);
	::SetWindowLong(pActiveView->m_hWnd, GWL_ID,
		::GetWindowLong(pNewView->m_hWnd, GWL_ID));
	::SetWindowLong(pNewView->m_hWnd, GWL_ID, temp);

	// Display and update the new current view - hide the old one    
	pActiveView->ShowWindow(SW_HIDE);
	pNewView->ShowWindow(SW_SHOW);
	SetActiveView(pNewView);
	RecalcLayout();
	pNewView->Invalidate();

	CString strCaption;
	strCaption.Format (_T("View %d"), nIndex + 1);

	m_wndCaptionBar.SetText (strCaption);
	m_wndCaptionBar.RedrawWindow ();
}
Esempio n. 5
0
BOOL CMainFrame::OnQueryNewPalette() 
{
	// TODO: Add your message handler code here and/or call default
	
    ///////////////////////////////////////
    ///////////////////////////////////////
    // START CUSTOM CODE
    ///////////////////////////////////////
    ///////////////////////////////////////

    // Get a pointer to the view window.
    CView* pView = GetActiveView();

    // Redraw the view window with its own colors.
    pView->Invalidate();

    ///////////////////////////////////////
    ///////////////////////////////////////
    // END CUSTOM CODE
    ///////////////////////////////////////
    ///////////////////////////////////////

	return CFrameWnd::OnQueryNewPalette();
}
Esempio n. 6
0
BOOL CRVTrackerTextureWrap::OnEnd()
{
	// If we're getting OnEnd because the dialog got displayed, skip out
	if (m_bShowingDialog)
		return TRUE;

	// Show the options dialog
	m_bShowingDialog = TRUE;
	CAutoTextureOptionsDlg cDlg;
	// Load the options from the registry
	cDlg.LoadOptionsFromReg();

	//if the skip tracker is active, just avoid the dialog
	int nModalResult;
	if(m_pSkipTracker && m_pSkipTracker->GetActive())
		nModalResult = IDOK;
	else
		nModalResult = cDlg.DoModal();

	m_bShowingDialog = FALSE;

	// Get the wrapping direction
	CVector vWrapDir = m_pView->DrawingBrush().m_Points[1] - m_pView->DrawingBrush().m_Points[0];
	// Clear the drawing brush (so it doesn't hang around if they cancel)
	m_pView->DrawingBrush().Term();

	// Jump out if they cancelled
	if (nModalResult != IDOK)
		return TRUE;
	// Get the style..
	m_nWrapStyle = cDlg.m_nStyle;
	if (m_nWrapStyle >= k_WrapInvalid)
		return TRUE;
	// Save the options to the registry
	cDlg.SaveOptionsToReg();
	// Get the options
	m_bScaleToFit = cDlg.m_bScale;
	m_bAdjustOffset = cDlg.m_bOffset;
	m_bRestrictWalkDir = cDlg.m_bRestrictDir;

	// This might take a while...
	m_pView->BeginWaitCursor();

	// Select the brushes with selected faces in geometry mode so this can be undone
	if (m_pView->GetEditMode() == GEOMETRY_EDITMODE)
	{
		CPolyRefArray &rTaggedPolies = m_pView->TaggedPolies();
		for (uint32 nFindBaseLoop = 0; nFindBaseLoop < rTaggedPolies.GetSize(); ++nFindBaseLoop)
		{
			if (!rTaggedPolies[nFindBaseLoop].IsValid())
				continue;
			m_pView->GetRegion()->SelectNode(rTaggedPolies[nFindBaseLoop]()->m_pBrush->AsNode());
		}
		m_pView->GetRegionDoc()->NotifySelectionChange();
	}

	// They'll probably want to be able to undo this...
	m_pView->GetRegionDoc()->SetupUndoForSelections();

	// If we didn't move, try and figure out a wrap direction
	if (vWrapDir.MagSqr() <= 0.01f)
	{
		// Try going to the right
		vWrapDir = m_pView->Nav().Right();
		// Make sure we're actually still on the poly...
		CEditPlane *pPlane = &(m_rBasePoly()->m_Plane);
		vWrapDir -= pPlane->m_Normal * vWrapDir.Dot(pPlane->m_Normal);
		// If that doesn't work..
		if (vWrapDir.MagSqr() <= 0.01f)
		{
			// Try going forward
			vWrapDir = m_pView->Nav().Forward();
			vWrapDir -= pPlane->m_Normal * vWrapDir.Dot(pPlane->m_Normal);
		}
	}
	vWrapDir.Norm();

	// Build the polygon set
	CTWPolyList aPolyList;
	BuildPolyList(aPolyList);

	// Find our base poly
	uint32 nBasePolyIndex = FindPolyIndex(aPolyList, m_rBasePoly());

	// Wrap the textures, starting at the base poly index
	CTextExtents cExtents;
	WrapTexture(aPolyList[nBasePolyIndex], vWrapDir, cExtents);

	// Scale the textures to an even multiple
	if (m_bScaleToFit)
		ScaleToMultiple(aPolyList, cExtents);

	// Offset the textures to fit at the top/left
	if (m_bAdjustOffset)
		AlignToTopLeft(aPolyList, cExtents);

	// Clear the polygon set
	ClearPolyList(aPolyList);

	// Redraw the views
	POSITION pos = m_pView->GetDocument()->GetFirstViewPosition();
	while (pos)
	{
		CView *pView = m_pView->GetDocument()->GetNextView(pos);
		pView->Invalidate(FALSE);
	}

	// This might take a while...
	m_pView->EndWaitCursor();

	return TRUE;
}