void CSurfaceDlg::UpdateSpinners(int nScrollCode, int nPos, CScrollBar* pBar) { return; UpdateData(TRUE); if ((nScrollCode != SB_LINEUP) && (nScrollCode != SB_LINEDOWN)) { return; } bool up = (nScrollCode == SB_LINEUP); // FIXME: bad resource define #define IDC_ROTATEA 0 #define IDC_HSCALEA 0 #define IDC_VSCALEA 0 #define IDC_HSHIFTA 0 #define IDC_VSHIFTA 0 if (pBar->GetSafeHwnd() == ::GetDlgItem(GetSafeHwnd(), IDC_ROTATEA)) { Select_RotateTexture((up) ? m_rotate : -m_rotate); } else if (pBar->GetSafeHwnd() == ::GetDlgItem(GetSafeHwnd(), IDC_HSCALEA)) { Select_ScaleTexture((up) ? -m_horzScale : m_horzScale, 0, true, ( m_absolute != FALSE ) ); } else if (pBar->GetSafeHwnd() == ::GetDlgItem(GetSafeHwnd(), IDC_VSCALEA)) { Select_ScaleTexture(0, (up) ? -m_vertScale : m_vertScale, true, ( m_absolute != FALSE ) ); } else if (pBar->GetSafeHwnd() == ::GetDlgItem(GetSafeHwnd(), IDC_HSHIFTA)) { Select_ShiftTexture((up) ? -m_horzShift : m_horzShift, 0); } else if (pBar->GetSafeHwnd() == ::GetDlgItem(GetSafeHwnd(), IDC_VSHIFTA)) { Select_ShiftTexture((up) ? -m_vertShift : m_vertShift, 0); } g_changed_surface = true; }
void CSurfaceDlg::UpdateSpinners(bool up, int nID) { UpdateData(TRUE); float hdiv = 0.0f; float vdiv = 0.0f; switch (nID) { case IDC_SPIN_ROTATE : Select_RotateTexture((up) ? m_rotate : -m_rotate); break; case IDC_SPIN_HSCALE : m_horzScale += (up) ? 0.1f : -0.1f; hdiv = (m_horzScale == 0.0f) ? 1.0f : m_horzScale; Select_ScaleTexture( 1.0f / hdiv, 0.0f, true, ( m_absolute != FALSE ) ); UpdateData(FALSE); break; case IDC_SPIN_VSCALE : m_vertScale += (up) ? 0.1f : -0.1f; vdiv = (m_vertScale == 0.0f) ? 1.0f : m_vertScale; Select_ScaleTexture( 0.0f, 1.0f / vdiv, true, ( m_absolute != FALSE ) ); UpdateData(FALSE); break; case IDC_SPIN_HSHIFT : Select_ShiftTexture((up) ? m_horzShift : -m_horzShift, 0); break; case IDC_SPIN_VSHIFT : Select_ShiftTexture(0, (up) ? m_vertShift : -m_vertShift); break; } g_changed_surface = true; }
void CTextureBar::OnDeltaposSpinVScale(NMHDR* pNMHDR, LRESULT* pResult) { NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; // TODO: Add your control notification handler code here *pResult = 0; if (pNMUpDown->iDelta < 0) Select_ScaleTexture(0, (float)abs(g_qeglobals.d_savedinfo.m_nTextureTweak)); else Select_ScaleTexture(0, (float)-abs(g_qeglobals.d_savedinfo.m_nTextureTweak)); GetSurfaceAttributes(); }
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 ); }
void CCamWnd::OnMouseMove(UINT nFlags, CPoint point) { CRect r; GetClientRect(r); if (GetCapture() == this && (GetKeyState(VK_MENU) & 0x8000) && !((GetKeyState(VK_SHIFT) & 0x8000) || (GetKeyState(VK_CONTROL) & 0x8000))) { if (GetKeyState(VK_CONTROL) & 0x8000) Select_RotateTexture(point.y - m_ptLastCursor.y); else if (GetKeyState(VK_SHIFT) & 0x8000) Select_ScaleTexture(point.x - m_ptLastCursor.x, m_ptLastCursor.y - point.y); else Select_ShiftTexture(point.x - m_ptLastCursor.x, m_ptLastCursor.y - point.y); } else { Cam_MouseMoved(point.x, r.bottom - 1 - point.y, nFlags); } m_ptLastCursor = point; }
/* ================= UpdateSpinners ================= */ void CSurfaceDlg::UpdateSpinners( bool up, int nID ) { UpdateData( TRUE ); float hdiv = 0.0f; float vdiv = 0.0f; // ---> sikk - Merged Patch Inspector into Surface Inspector texdef_t td; td.rotate = 0.0; td.scale[0] = td.scale[1] = 0.0; td.shift[0] = td.shift[1] = 0.0; td.value = 0; // <--- sikk - Merged Patch Inspector into Surface Inspector switch ( nID ) { case IDC_SPIN_ROTATE : Select_RotateTexture((up) ? m_rotate : -m_rotate); break; case IDC_SPIN_HSCALE : m_horzScale += (up) ? 0.1f : -0.1f; hdiv = (m_horzScale == 0.0f) ? 1.0f : m_horzScale; Select_ScaleTexture( 1.0f / hdiv, 0.0f, true, ( m_absolute != FALSE ) ); UpdateData(FALSE); break; case IDC_SPIN_VSCALE : m_vertScale += (up) ? 0.1f : -0.1f; vdiv = (m_vertScale == 0.0f) ? 1.0f : m_vertScale; Select_ScaleTexture( 0.0f, 1.0f / vdiv, true, ( m_absolute != FALSE ) ); UpdateData(FALSE); break; case IDC_SPIN_HSHIFT : Select_ShiftTexture((up) ? m_horzShift : -m_horzShift, 0); break; case IDC_SPIN_VSHIFT : Select_ShiftTexture(0, (up) ? m_vertShift : -m_vertShift); break; // ---> sikk - Merged Patch Inspector into Surface Inspector case IDC_SPIN_PATCH_ROTATE: td.rotate = up ? m_fPatchRotate : -m_fPatchRotate; Patch_SetTextureInfo( &td ); break; case IDC_SPIN_PATCH_HSCALE: td.scale[0] = up ? 1 - m_fPatchHScale : 1 + m_fPatchHScale; Patch_SetTextureInfo( &td ); break; case IDC_SPIN_PATCH_VSCALE: td.scale[1] = up ? 1 - m_fPatchVScale : 1 + m_fPatchVScale; Patch_SetTextureInfo( &td ); break; case IDC_SPIN_PATCH_HSHIFT: td.shift[0] = up ? m_fPatchHShift : -m_fPatchHShift; Patch_SetTextureInfo( &td ); break; case IDC_SPIN_PATCH_VSHIFT: td.shift[1] = up ? m_fPatchVShift : -m_fPatchVShift; Patch_SetTextureInfo( &td ); break; // <--- sikk - Merged Patch Inspector into Surface Inspector } g_changed_surface = true; Sys_UpdateWindows( W_CAMERA ); }