Example #1
0
static void OnBtnFaceFit( GtkWidget *widget, gpointer data ){
	g_dlgSurface.UpdateData( TRUE );
	if ( g_ptrSelectedFaces.GetSize() == 0 ) {
		brush_t *b;
		for ( b = selected_brushes.next ; b != &selected_brushes ; b = b->next )
		{
			for ( face_t* pFace = b->brush_faces; pFace; pFace = pFace->next )
			{
				g_ptrSelectedFaces.Add( pFace );
				g_ptrSelectedFaceBrushes.Add( b );
			}
		}
		Select_FitTexture( g_dlgSurface.m_nHeight, g_dlgSurface.m_nWidth );
		g_dlgSurface.SetTexMods();
		g_ptrSelectedFaces.RemoveAll();
	}
	else
	{
		Select_FitTexture( g_dlgSurface.m_nHeight, g_dlgSurface.m_nWidth );
		g_dlgSurface.SetTexMods();
	}
	Sys_UpdateWindows( W_ALL );
}
Example #2
0
void CSurfaceDlg::OnBtnFacefit() {
	UpdateData(TRUE);
/*
	brush_t *b;
	for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next) {
		if (!b->patchBrush) {
			for (face_t* pFace = b->brush_faces; pFace; pFace = pFace->next) {
				g_ptrSelectedFaces.Add(pFace);
				g_ptrSelectedFaceBrushes.Add(b);
			}
		}
	}
*/
	Select_FitTexture(m_fHeight, m_fWidth);
	g_pParentWnd->GetCamera()->MarkWorldDirty ();
	//SetTexMods();
	g_changed_surface = true;
	Sys_UpdateWindows(W_ALL);
}
BOOL CSurfaceDlg::PreTranslateMessage( MSG *pMsg ) {
	if( pMsg->message == WM_KEYDOWN ) {
		if( pMsg->wParam == VK_RETURN ) {
			if( focusControl ) {
				UpdateData( TRUE );
				if( focusControl == &m_wndHScale ) {
					Select_ScaleTexture( m_horzScale, 1.0f, true, ( m_absolute != FALSE ) );
				} else if( focusControl == &m_wndVScale ) {
					Select_ScaleTexture( 1.0f, m_vertScale, true, ( m_absolute != FALSE ) );
				} else if( focusControl == &m_wndRotateEdit ) {
					Select_RotateTexture( m_rotate, true );
				} else if( focusControl == &m_wndHeight || focusControl == &m_wndWidth ) {
					Select_FitTexture( m_fHeight, m_fWidth );
				}
			}
			return TRUE;
		}
	}
	return CDialog::PreTranslateMessage( pMsg );
}
Example #4
0
void CSurfaceDlg::OnBtnFacefit() 
{
  UpdateData(TRUE);
  if (g_ptrSelectedFaces.GetSize() == 0)
  {
    brush_t *b;
		for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
    {
      for (face_t* pFace = b->brush_faces; pFace; pFace = pFace->next)
      {
        g_ptrSelectedFaces.Add(pFace);
        g_ptrSelectedFaceBrushes.Add(b);
      }
    }
  }
  Select_FitTexture(m_nHeight, m_nWidth);
  SetTexMods();
	g_changed_surface = true;
  Sys_UpdateWindows(W_ALL);
}
Example #5
0
BOOL CALLBACK SurfaceDlgProc (
    HWND hwndDlg,	// handle to dialog box
    UINT uMsg,	// message
    WPARAM wParam,	// first message parameter
    LPARAM lParam 	// second message parameter
   )
{
	switch (uMsg)
    {
	case WM_INITDIALOG:
		g_surfwin = hwndDlg;
		SetTexMods ();
		return FALSE;

	case WM_COMMAND: 
		switch (LOWORD(wParam)) { 
		
		case IDOK:
			GetTexMods ();
			EndDialog(hwndDlg, 1);
		break;

		case IDAPPLY:
			GetTexMods ();
			InvalidateRect(g_qeglobals.d_hwndCamera, NULL, false);
			UpdateWindow (g_qeglobals.d_hwndCamera);
		break;
// FIT:
		case IDC_FIT:
		{
			char	sz[128];

			GetWindowText(GetDlgItem(g_surfwin, IDC_HFIT), sz, 127);
			m_nHeight = atof(sz);
			GetWindowText(GetDlgItem(g_surfwin, IDC_WFIT), sz, 127);
			m_nWidth = atof(sz);

			Select_FitTexture(m_nHeight, m_nWidth);

			sprintf(sz, "%d", (int)m_nHeight);
			SetWindowText(GetDlgItem(g_surfwin, IDC_HFIT), sz);
			sprintf(sz, "%d", (int)m_nWidth);
			SetWindowText(GetDlgItem(g_surfwin, IDC_WFIT), sz);

			InvalidateRect(g_qeglobals.d_hwndCamera, NULL, false);
			UpdateWindow (g_qeglobals.d_hwndCamera);
		}
		break;
//
		case IDCANCEL:
			g_qeglobals.d_texturewin.texdef = g_old_texdef;
			if (g_changed_surface)
				Select_SetTexture(&g_qeglobals.d_texturewin.texdef);
			EndDialog(hwndDlg, 0);
		break;
		}	
		break;

	case WM_HSCROLL:
	case WM_VSCROLL:
		UpdateSpinners(uMsg, wParam, lParam);
		InvalidateRect(g_qeglobals.d_hwndCamera, NULL, false);
		UpdateWindow (g_qeglobals.d_hwndCamera);
		return 0;

	default:
		return FALSE;
	}
	return FALSE; //eerie
}