CRect CPropPageFrame::CalcCaptionArea() { ASSERT(IsWindow(GetWnd()->GetSafeHwnd())); CRect rectCaption; GetWnd()->GetClientRect(rectCaption); if (!GetShowCaption()) rectCaption.bottom = rectCaption.top; else rectCaption.bottom = rectCaption.top+GetCaptionHeight(); return rectCaption; }
void MatSysWindow::redraw() { BaseClass::redraw(); return; if ( IsLocked() ) { RECT bounds; GetClientRect( (HWND)getHandle(), &bounds ); bounds.bottom = bounds.top + GetCaptionHeight(); CChoreoWidgetDrawHelper helper( this, bounds ); HandleToolRedraw( helper ); } }
CRect CPropPageFrameDefault::CalcCaptionArea() { CRect rect; GetClientRect(rect); HTHEME hTheme = NULL; if (g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive()) { hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab"); } if (hTheme) { CRect rectContent; CDC *pDc = GetDC(); g_ThemeLib.GetThemeBackgroundContentRect(hTheme, pDc->m_hDC, TABP_PANE, 0, rect, rectContent); ReleaseDC(pDc); g_ThemeLib.CloseThemeData(hTheme); if (GetShowCaption()) rectContent.bottom = rect.top+GetCaptionHeight(); else rectContent.bottom = rectContent.top; rect = rectContent; } else { if (GetShowCaption()) rect.bottom = rect.top+GetCaptionHeight(); else rect.bottom = rect.top; } return rect; }
//----------------------------------------------------------------------------- // Purpose: // Input : *event - // Output : int //----------------------------------------------------------------------------- int mxStatusWindow::handleEvent( mxEvent *event ) { int iret = 0; if ( HandleToolEvent( event ) ) { return iret; } switch ( event->event ) { default: break; case mxEvent::Size: { m_pScrollbar->setBounds( w2() - STATUS_SCROLLBAR_SIZE, GetCaptionHeight(), STATUS_SCROLLBAR_SIZE, h2()-GetCaptionHeight() ); PositionSliders( 0 ); m_pScrollbar->setValue( m_pScrollbar->getMaxValue() ); iret = 1; } break; case mxEvent::Action: { iret = 1; switch ( event->action ) { default: iret = 0; break; case IDC_STATUS_SCROLL: { if ( event->event == mxEvent::Action && event->modifiers == SB_THUMBTRACK) { int offset = event->height; m_pScrollbar->setValue( offset ); PositionSliders( offset ); DrawActiveTool(); } } break; } } break; } return iret; }
BOOL CKofDlgImpl::OnNcCalcSize( BOOL /*bCalcValidRects*/, NCCALCSIZE_PARAMS FAR* lpncsp ) { ASSERT (lpncsp != NULL); if ((m_Dlg.GetStyle () & WS_CAPTION) == 0) { m_bVisualManagerNCArea = FALSE; } if (IsOwnerDrawCaption ()) { lpncsp->rgrc[0].top += GetCaptionHeight (); } return (m_Dlg.GetStyle () & WS_MAXIMIZE) == WS_MAXIMIZE && IsOwnerDrawCaption (); }
//----------------------------------------------------------------------------- // Purpose: // Input : sboffset - //----------------------------------------------------------------------------- void mxStatusWindow::PositionSliders( int sboffset ) { int lineheight = ( STATUS_FONT_SIZE + 2 ); int linesused = min( MAX_TEXT_LINES, m_nCurrentLine ); linesused = max( linesused, 1 ); int trueh = h2() - GetCaptionHeight(); int vpixelsneeded = max( linesused * lineheight, trueh ); m_pScrollbar->setVisible( linesused * lineheight > trueh ); m_pScrollbar->setPagesize( trueh ); m_pScrollbar->setRange( 0, vpixelsneeded ); redraw(); }
//----------------------------------------------------------------------------- // Purpose: // Output : int //----------------------------------------------------------------------------- int mxExpressionTray::ComputePixelsNeeded( void ) { CExpClass *active = expressions->GetActiveClass(); if ( !active ) return 100; // Remove scroll bar int w = this->w2() - 16; int colsperrow; colsperrow = ( w - m_nGap ) / ( m_nSnapshotWidth + m_nGap ); // At least one colsperrow = max( 1, colsperrow ); int rowsneeded = ( ( active->GetNumExpressions() + colsperrow - 1 ) / colsperrow ); return rowsneeded * ( m_nSnapshotHeight + m_nGap ) + m_nGap + TOP_GAP + GetCaptionHeight(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void mxStatusWindow::DrawActiveTool() { RECT rcTool; rcTool.left = 0; rcTool.top = GetCaptionHeight() + 2; rcTool.bottom = h2(); rcTool.right = w2() - 16; rcTool.bottom = rcTool.top + 10; rcTool.left = rcTool.right - 500; char sz[ 256 ]; IFacePoserToolWindow *activeTool = IFacePoserToolWindow::GetActiveTool(); static float lastrealtime = 0.0f; float dt = (float)realtime - lastrealtime; dt = clamp( dt, 0.0f, 1.0f ); float fps = 0.0f; if ( dt > 0.0001f ) { fps = 1.0f / dt; } sprintf( sz, "%s (%i) at %.3f (%.2f fps) (soundcount %i)", activeTool ? activeTool->GetToolName() : "None", g_MDLViewer->GetCurrentFrame(), (float)realtime, fps, models->CountActiveSources() ); lastrealtime = realtime; int len = CChoreoWidgetDrawHelper::CalcTextWidth( "Courier New", 10, FW_NORMAL, sz ); CChoreoWidgetDrawHelper helper( this, rcTool, RGB( 32, 0, 0 ) ); rcTool.left = rcTool.right - len - 15; helper.DrawColoredText( "Courier New", 10, FW_NORMAL, RGB( 255, 255, 200 ), rcTool, sz ); }
CSize CBCGPMSMCaptionBar::CalcFixedLayout (BOOL, BOOL) { ASSERT_VALID(this); // recalculate based on font height + icon height + borders TEXTMETRIC tm; { CClientDC dcScreen(NULL); HFONT hFont = GetCaptionFont (); HGDIOBJ hOldFont = dcScreen.SelectObject(hFont); VERIFY(dcScreen.GetTextMetrics(&tm)); dcScreen.SelectObject(hOldFont); } int nHeight = max ( max (tm.tmHeight, m_szIcon.cy), GetCaptionHeight ()); return CSize (32767, nHeight);// + CY_BORDER * 4 - rectSize.Height()); }
bool mxExpressionTray::ComputeRect( int cell, int& rcx, int& rcy, int& rcw, int& rch ) { // Remove scroll bar int w = this->w2() - 16; int colsperrow; colsperrow = ( w - m_nGap ) / ( m_nSnapshotWidth + m_nGap ); // At least one colsperrow = max( 1, colsperrow ); int row, col; row = cell / colsperrow; col = cell % colsperrow; // don't allow partial columns rcx = m_nGap + col * ( m_nSnapshotWidth + m_nGap ); rcy = GetCaptionHeight() + TOP_GAP + ( -m_nTopOffset * m_nGranularity ) + m_nGap + row * ( m_nSnapshotHeight + m_nGap ); // Starts off screen if ( rcx < 0 ) return false; // Ends off screen if ( rcx + m_nSnapshotWidth + m_nGap > this->w2() ) return false; // Allow partial in y direction if ( rcy > this->h2() ) return false; if ( rcy + m_nSnapshotHeight + m_nGap < 0 ) return false; // Some portion is onscreen rcw = m_nSnapshotWidth; rch = m_nSnapshotHeight; return true; }
LRESULT CFrameHolder::OnNcCalcSize(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { RecalculateFrameSizes(); LRESULT lRc = 0, lRcDef = 0; // В Aero (Glass) важно, чтобы клиенская область начиналась с верхнего края окна, // иначе не получится "рисовать по стеклу" FrameDrawStyle fdt = gpConEmu->DrawType(); // Если nCaption == 0, то при fdt_Aero текст в заголовке окна не отрисовывается DEBUGTEST(int nCaption = GetCaptionHeight()); bool bCallDefProc = true; #if defined(CONEMU_TABBAR_EX) // В режиме Aero/Glass (хоть он и почти выпилен в Win8) // мы расширяем клиентскую область на заголовок if (gpSet->isTabsInCaption && (fdt == fdt_Aero || fdt == fdt_Win8)) { nCaption = 0; bCallDefProc = false; // Must be "glassed" or "themed", otherwise system will not draw window caption _ASSERTE(gpConEmu->IsGlass() || gpConEmu->IsThemed()); } #endif if (wParam) { // lParam points to an NCCALCSIZE_PARAMS structure that contains information // an application can use to calculate the new size and position of the client rectangle. // The application should indicate which part of the client area contains valid information! NCCALCSIZE_PARAMS* pParm = wParam ? ((NCCALCSIZE_PARAMS*)lParam) : NULL; // r[0] contains the new coordinates of a window that has been moved or resized, // that is, it is the proposed new window coordinates // r[1] contains the coordinates of the window before it was moved or resized // r[2] contains the coordinates of the window's client area before the window was moved or resized RECT r[3] = {pParm->rgrc[0], pParm->rgrc[1], pParm->rgrc[2]}; bool bAllowPreserveClient = mb_AllowPreserveClient && (memcmp(r, r+1, sizeof(*r)) == 0); // We need to call this, otherwise some parts of window may be broken // If don't - system will not draw window caption when theming is off if (bCallDefProc) { lRcDef = ::DefWindowProc(hWnd, uMsg, wParam, lParam); } //RECT rcWnd = {0,0, r[0].right-r[0].left, r[0].bottom-r[0].top}; RECT rcClient; // = gpConEmu->CalcRect(CER_MAINCLIENT, rcWnd, CER_MAIN); //_ASSERTE(rcClient.left==0 && rcClient.top==0); RECT rcMargins = gpConEmu->CalcMargins(CEM_FRAMECAPTION); #if defined(CONEMU_TABBAR_EX) if (gpSet->isTabsInCaption) { _ASSERTE(nCaption==0); rcClient = MakeRect(r[0].left+rcMargins.left, r[0].top, r[0].right-rcMargins.right, r[0].bottom-rcMargins.bottom); } else #endif { // Need screen coordinates! rcClient = MakeRect(r[0].left+rcMargins.left, r[0].top+rcMargins.top, r[0].right-rcMargins.right, r[0].bottom-rcMargins.bottom); //int nDX = ((rcWnd.right - rcClient.right) >> 1); //int nDY = ((rcWnd.bottom - rcClient.bottom - nCaption) >> 1); //// Need screen coordinates! //OffsetRect(&rcClient, r[0].left + nDX, r[0].top + nDY + nCaption); } // pParm->rgrc[0] contains the coordinates of the new client rectangle resulting from the move or resize // pParm->rgrc[1] rectangle contains the valid destination rectangle // pParm->rgrc[2] rectangle contains the valid source rectangle pParm->rgrc[0] = rcClient; //TODO: #if 0 if (!bAllowPreserveClient) { pParm->rgrc[1] = MakeRect(rcClient.left, rcClient.top, rcClient.left, rcClient.top); pParm->rgrc[2] = MakeRect(r[2].left, r[2].top, r[2].left, r[2].top); } else #endif { pParm->rgrc[1] = rcClient; // Mark as valid - only client area. Let system to redraw the frame and caption. pParm->rgrc[2] = r[2]; } if (bAllowPreserveClient) { lRc = WVR_VALIDRECTS; } // При смене режимов (особенно при смене HideCaption/NotHideCaption) // требовать полную перерисовку клиентской области else if (mb_DontPreserveClient || (gpConEmu->GetChangeFromWindowMode() != wmNotChanging)) { lRc = WVR_REDRAW; } } else { // lParam points to a RECT structure. On entry, the structure contains the proposed window // rectangle for the window. On exit, the structure should contain the screen coordinates // of the corresponding window client area. LPRECT nccr = (LPRECT)lParam; RECT rc = *nccr; //RECT rcWnd = {0,0, rc.right-rc.left, rc.bottom-rc.top}; RECT rcClient; // = gpConEmu->CalcRect(CER_MAINCLIENT, rcWnd, CER_MAIN); //_ASSERTE(rcClient.left==0 && rcClient.top==0); RECT rcMargins = gpConEmu->CalcMargins(CEM_FRAMECAPTION); if (bCallDefProc) { // Call default function JIC lRcDef = ::DefWindowProc(hWnd, uMsg, wParam, lParam); } #if defined(CONEMU_TABBAR_EX) if (gpSet->isTabsInCaption) { _ASSERTE(nCaption==0); rcClient = MakeRect(rc.left+rcMargins.left, rc.top, rc.right-rcMargins.right, rc.bottom-rcMargins.bottom); //int nDX = ((rcWnd.right - rcClient.right) >> 1); //int nDY = ((rcWnd.bottom - rcClient.bottom /*- nCaption*/) >> 1); //*nccr = MakeRect(rc.left+nDX, rc.top+nDY, rc.right-nDX, rc.bottom-nDY); } else #endif { // Need screen coordinates! rcClient = MakeRect(rc.left+rcMargins.left, rc.top+rcMargins.top, rc.right-rcMargins.right, rc.bottom-rcMargins.bottom); //int nDX = ((rcWnd.right - rcClient.right) >> 1); //int nDY = ((rcWnd.bottom - rcClient.bottom - nCaption) >> 1); //OffsetRect(&rcClient, rc.left + nDX, rc.top + nDY + nCaption); } *nccr = rcClient; } //if (!gpSet->isTabsInCaption) //{ // lRc = DefWindowProc(hWnd, uMsg, wParam, lParam); //} //else //{ // if (!gpSet->isTabs || !gpSet->isTabsInCaption) // { // lRc = DefWindowProc(hWnd, uMsg, wParam, lParam); // } // else // { // RECT r[3]; // r[0] = *nccr; // if (wParam) // { // r[1] = pParm->rgrc[1]; // r[2] = pParm->rgrc[2]; // } // // if (fdt == fdt_Aero) // { // // В Aero (Glass) важно, чтобы клиенская область начиналась с верхнего края окна, // // иначе не получится "рисовать по стеклу" // nccr->top = r->top; // нада !!! // nccr->left = r->left + GetFrameWidth(); // nccr->right = r->right - GetFrameWidth(); // nccr->bottom = r->bottom - GetFrameHeight(); // } // else // { // //TODO: Темы!!! В XP ширина/высота рамки может быть больше // nccr->top = r->top + GetFrameHeight() + GetCaptionHeight(); // nccr->left = r->left + GetFrameWidth(); // nccr->right = r->right - GetFrameWidth(); // nccr->bottom = r->bottom - GetFrameHeight(); // } // } // // Наверное имеет смысл сбрасывать всегда, чтобы Win не пыталась // // отрисовать невалидное содержимое консоли (она же размер меняет) // if (wParam) // { // //pParm->rgrc[1] = *nccr; // //pParm->rgrc[2] = r[2]; // memset(pParm->rgrc+1, 0, sizeof(RECT)*2); // } //} UNREFERENCED_PARAMETER(lRcDef); UNREFERENCED_PARAMETER(fdt); return lRc; }
void mxExpressionTray::redraw() { if ( !ToolCanDraw() ) return; bool updateSelection = false; CExpClass *active = expressions->GetActiveClass(); if ( active && active->GetNumExpressions() != m_nPreviousExpressionCount ) { m_nTopOffset = 0; RepositionSlider(); m_nPreviousExpressionCount = active->GetNumExpressions(); } CChoreoWidgetDrawHelper helper( this, GetSysColor( COLOR_BTNFACE ) ); HandleToolRedraw( helper ); int w, h; w = w2(); h = h2(); if ( active ) { RECT clipRect; helper.GetClientRect( clipRect ); clipRect.top += TOP_GAP + GetCaptionHeight(); helper.StartClipping( clipRect ); if ( m_nLastNumExpressions != active->GetNumExpressions() ) { m_nTopOffset = 0; m_nLastNumExpressions = active->GetNumExpressions(); RepositionSlider(); updateSelection = true; } int selected = active->GetSelectedExpression(); int rcx, rcy, rcw, rch; int c = 0; while ( c < active->GetNumExpressions() ) { if ( !ComputeRect( c, rcx, rcy, rcw, rch ) ) { c++; continue; } CExpression *current = active->GetExpression( c ); if ( !current ) break; DrawThumbNail( active, current, helper, rcx, rcy, rcw, rch, c, selected, updateSelection ); c++; } helper.StopClipping(); } else { RECT rc; helper.GetClientRect( rc ); // Arial 36 normal char sz[ 256 ]; sprintf( sz, "No expression file loaded" ); int pointsize = 18; int textlen = helper.CalcTextWidth( "Arial", pointsize, FW_NORMAL, sz ); RECT rcText; rcText.top = ( rc.bottom - rc.top ) / 2 - pointsize / 2; rcText.bottom = rcText.top + pointsize + 10; int fullw = rc.right - rc.left; rcText.left = rc.left + ( fullw - textlen ) / 2; rcText.right = rcText.left + textlen; helper.DrawColoredText( "Arial", pointsize, FW_NORMAL, RGB( 80, 80, 80 ), rcText, sz ); } // ValidateRect( (HWND)getHandle(), &rc ); }
UINT CKofDlgImpl::OnNcHitTest( CPoint point ) { m_Dlg.ScreenToClient (&point); if (!m_rectResizeBox.IsRectEmpty ()) { if (m_rectResizeBox.PtInRect(point)) { BOOL bRTL = m_Dlg.GetExStyle() & WS_EX_LAYOUTRTL; return bRTL ? HTBOTTOMLEFT : HTBOTTOMRIGHT; } } if (!IsOwnerDrawCaption ()) { return HTNOWHERE; } const CSize szSystemBorder(::GetSystemMetrics (SM_CXSIZEFRAME), ::GetSystemMetrics (SM_CYSIZEFRAME)); int cxOffset = szSystemBorder.cx; int cyOffset = szSystemBorder.cy; if (!m_Dlg.IsIconic ()) { cyOffset += GetCaptionHeight (); } if (m_Dlg.IsZoomed ()) { cxOffset -= szSystemBorder.cx; cyOffset -= szSystemBorder.cy; } point.Offset (cxOffset, cyOffset); for (POSITION pos = m_lstCaptionSysButtons.GetHeadPosition (); pos != NULL;) { CMFCCaptionButtonEx* pButton = (CMFCCaptionButtonEx*) m_lstCaptionSysButtons.GetNext (pos); ASSERT_VALID (pButton); if (pButton->GetRect ().PtInRect (point)) { return pButton->m_nHit; } } CRect rectCaption = GetCaptionRect (); if (rectCaption.PtInRect (point)) { if ((m_Dlg.GetExStyle () & WS_EX_TOOLWINDOW) == 0) { CRect rectSysMenu = rectCaption; rectSysMenu.right = rectSysMenu.left + ::GetSystemMetrics (SM_CXSMICON) + 2 + (m_Dlg.IsZoomed () ? szSystemBorder.cx : 0); return rectSysMenu.PtInRect (point) ? HTSYSMENU : HTCAPTION; } return HTCAPTION; } return HTNOWHERE; }
void CKofDlgImpl::OnChangeVisualManager() { if (m_Dlg.GetSafeHwnd () == NULL) { return; } CRect rectWindow; m_Dlg.GetWindowRect (rectWindow); BOOL bZoomed = m_Dlg.IsZoomed (); if (IsOwnerDrawCaption ()) { BOOL bChangeBorder = FALSE; if ((m_Dlg.GetStyle () & WS_BORDER) == WS_BORDER && m_bHasBorder) { bChangeBorder = TRUE; m_bWindowPosChanging = TRUE; m_Dlg.ModifyStyle (WS_BORDER, 0, SWP_FRAMECHANGED); m_bWindowPosChanging = FALSE; } m_bIsWindowRgn = CKofStyleHelper::GetInstance()->OnSetWindowRegion ( &m_Dlg, rectWindow.Size ()); if (bZoomed && bChangeBorder) { m_Dlg.ShowWindow (SW_MINIMIZE); m_Dlg.ShowWindow (SW_MAXIMIZE); } } else { BOOL bChangeBorder = FALSE; if ((m_Dlg.GetStyle () & WS_BORDER) == 0 && m_bHasBorder) { bChangeBorder = TRUE; m_bWindowPosChanging = TRUE; m_Dlg.ModifyStyle (0, WS_BORDER, SWP_FRAMECHANGED); m_bWindowPosChanging = FALSE; } if (m_bIsWindowRgn) { m_bIsWindowRgn = FALSE; m_Dlg.SetWindowRgn (NULL, TRUE); } if (bZoomed && bChangeBorder) { NCCALCSIZE_PARAMS params; ZeroMemory(¶ms, sizeof (NCCALCSIZE_PARAMS)); params.rgrc[0].left = rectWindow.left; params.rgrc[0].top = rectWindow.top; params.rgrc[0].right = rectWindow.right; params.rgrc[0].bottom = rectWindow.bottom; m_Dlg.CalcWindowRect (¶ms.rgrc[0], CFrameWnd::adjustBorder); if ((m_Dlg.GetStyle () & WS_CAPTION) == WS_CAPTION) { params.rgrc[0].top += GetCaptionHeight (); } m_Dlg.SetWindowPos (NULL, params.rgrc[0].left, params.rgrc[0].top, params.rgrc[0].right - params.rgrc[0].left, params.rgrc[0].bottom - params.rgrc[0].top, SWP_NOACTIVATE | SWP_NOZORDER); } else { m_Dlg.SetWindowPos (NULL, -1, -1, rectWindow.Width () + 1, rectWindow.Height () + 1, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER); m_Dlg.SetWindowPos (NULL, -1, -1, rectWindow.Width (), rectWindow.Height (), SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER); } } UpdateCaption (); UpdateCaptionButtons(); }
int mxExpressionTray::handleEvent (mxEvent *event) { MDLCACHE_CRITICAL_SECTION_( g_pMDLCache ); int iret = 0; if ( HandleToolEvent( event ) ) { return iret; } switch ( event->event ) { case mxEvent::Action: { iret = 1; switch ( event->action ) { default: iret = 0; break; case IDC_EXPRESSIONCLASS: { int index = g_pExpressionClass->getSelectedIndex(); if ( index >= 0 ) { CExpClass *current = expressions->GetClass( index ); if ( current ) { // Switch classname expressions->ActivateExpressionClass( current ); current->SelectExpression( 0 ); } } } break; case IDC_CONTEXT_NEWEXP: g_pFlexPanel->NewExpression(); break; case IDC_CONTEXT_EDITEXP: if ( m_nClickedCell != -1 ) { g_pFlexPanel->EditExpression(); } break; case IDC_CONTEXT_REVERT: if ( m_nClickedCell != -1 ) { g_pFlexPanel->RevertExpression( m_nClickedCell ); } break; case IDC_CONTEXT_SAVEEXP: if ( m_nClickedCell != -1 ) { g_pFlexPanel->SaveExpression( m_nClickedCell ); } break; case IDC_CONTEXT_DELETEXP: if ( m_nClickedCell != -1 ) { g_pControlPanel->DeleteExpression( m_nClickedCell ); } break; case IDC_TRAYSCROLL: { if (event->modifiers == SB_THUMBTRACK) { int offset = event->height; slScrollbar->setValue( offset ); m_nTopOffset = offset; redraw(); } else if ( event->modifiers == SB_PAGEUP ) { int offset = slScrollbar->getValue(); offset -= m_nGranularity; offset = max( offset, slScrollbar->getMinValue() ); slScrollbar->setValue( offset ); InvalidateRect( (HWND)slScrollbar->getHandle(), NULL, TRUE ); m_nTopOffset = offset; redraw(); } else if ( event->modifiers == SB_PAGEDOWN ) { int offset = slScrollbar->getValue(); offset += m_nGranularity; offset = min( offset, slScrollbar->getMaxValue() ); slScrollbar->setValue( offset ); InvalidateRect( (HWND)slScrollbar->getHandle(), NULL, TRUE ); m_nTopOffset = offset; redraw(); } } break; case IDC_AB: { AB(); } break; case IDC_THUMBNAIL_INCREASE: { ThumbnailIncrease(); } break; case IDC_THUMBNAIL_DECREASE: { ThumbnailDecrease(); } break; case IDC_CONTEXT_CREATEBITMAP: { if ( m_nClickedCell >= 0 ) { CExpClass *active = expressions->GetActiveClass(); if ( active ) { CExpression *exp = active->GetExpression( m_nClickedCell ); if ( exp ) { active->SelectExpression( m_nClickedCell ); exp->CreateNewBitmap( models->GetActiveModelIndex() ); redraw(); } } } } break; } break; } case mxEvent::MouseDown: { if ( !( event->buttons & mxEvent::MouseRightButton ) ) { // Figure out cell # int cell = GetCellUnderPosition( event->x, event->y ); CExpClass *active = expressions->GetActiveClass(); if ( active ) { if ( cell == m_nCurCell && cell >= 0 && cell < active->GetNumExpressions() ) { mxETButton *btn = GetItemUnderCursor( event->x, event->y ); if ( btn && btn->m_fnCallback ) { (this->*(btn->m_fnCallback))( cell ); return iret; } } if ( cell >= 0 && cell < active->GetNumExpressions() ) { active->SelectExpression( cell, event->modifiers & mxEvent::KeyShift ? false : true ); int cx, cy, cw, ch; if ( ComputeRect( cell, cx, cy, cw, ch ) ) { m_bDragging = true; m_nDragCell = cell; m_nXStart = (short)event->x; m_nYStart = (short)event->y; m_rcFocus.left = cx; m_rcFocus.top = cy; m_rcFocus.right = cx + cw; m_rcFocus.bottom = cy + ch - m_nDescriptionHeight; POINT pt; pt.x = pt.y = 0; ClientToScreen( (HWND)getHandle(), &pt ); OffsetRect( &m_rcFocus, pt.x, pt.y ); m_rcOrig = m_rcFocus; DrawFocusRect(); } } else { Deselect(); active->DeselectExpression(); redraw(); } } } iret = 1; } break; case mxEvent::MouseDrag: { if ( m_bDragging ) { // Draw drag line of some kind DrawFocusRect(); // update pos m_rcFocus = m_rcOrig; OffsetRect( &m_rcFocus, ( (short)event->x - m_nXStart ), ( (short)event->y - m_nYStart ) ); DrawFocusRect(); } iret = 1; } break; case mxEvent::MouseUp: { iret = 1; if ( event->buttons & mxEvent::MouseRightButton ) { SetClickedCell( GetCellUnderPosition( (short)event->x, (short)event->y ) ); ShowRightClickMenu( (short)event->x, (short)event->y ); return iret; } int cell = GetCellUnderPosition( event->x, event->y ); CExpClass *active = expressions->GetActiveClass(); if ( m_bDragging ) { DrawFocusRect(); m_bDragging = false; // See if we let go on top of the choreo view if ( active ) { // Convert x, y to screen space POINT pt; pt.x = (short)event->x; pt.y = (short)event->y; ClientToScreen( (HWND)getHandle(), &pt ); HWND maybeTool = WindowFromPoint( pt ); // Now tell choreo view CExpression *exp = active->GetExpression( m_nDragCell ); if ( exp && maybeTool ) { if ( IsWindowOrChild( g_pChoreoView, maybeTool ) ) { if ( g_pChoreoView->CreateExpressionEvent( pt.x, pt.y, active, exp ) ) { return iret; } } if ( IsWindowOrChild( g_pExpressionTool, maybeTool ) ) { if ( g_pExpressionTool->SetFlexAnimationTrackFromExpression( pt.x, pt.y, active, exp ) ) { return iret; } } } } } if ( active ) { // Over a new cell if ( cell >= 0 && cell < active->GetNumExpressions() && cell != m_nCurCell && m_nCurCell != -1 ) { // Swap cells CExpression *exp = active->GetExpression( m_nCurCell ); if ( exp ) { active->SwapExpressionOrder( m_nCurCell, cell ); active->SetDirty( true ); active->SelectExpression( cell ); } } } } break; case mxEvent::Size: { int width = w2(); int ch = GetCaptionHeight(); g_pExpressionClass->setBounds( 5, 5 + ch, width - 120, 20 ); m_pABButton->setBounds( width - 60, 4 + ch, 60, 16 ); m_pThumbnailIncreaseButton->setBounds( width - 60 - 40, 4 + ch, 16, 16 ); m_pThumbnailDecreaseButton->setBounds( width - 60 - 20, 4 + ch, 16, 16 ); m_nTopOffset = 0; RepositionSlider(); redraw(); iret = 1; } break; case mxEvent::MouseWheeled: { // Figure out cell # POINT pt; pt.x = event->x; pt.y = event->y; ScreenToClient( (HWND)getHandle(), &pt ); if ( event->height < 0 ) { m_nTopOffset = min( m_nTopOffset + 10, slScrollbar->getMaxValue() ); } else { m_nTopOffset = max( m_nTopOffset - 10, 0 ); } RepositionSlider(); redraw(); iret = 1; } break; }; if ( iret ) { SetActiveTool( this ); } return iret; }
int CModuleControl::GetHeight() { return std::max(GetCaptionHeight(), GetChildHeight()); }
void MatSysWindow::draw () { int i; g_pMaterialSystem->BeginFrame(); CUtlVector< StudioModel * > modellist; modellist.AddToTail( models->GetActiveStudioModel() ); if ( models->CountVisibleModels() > 0 ) { modellist.RemoveAll(); for ( i = 0; i < models->Count(); i++ ) { if ( models->IsModelShownIn3DView( i ) ) { modellist.AddToTail( models->GetStudioModel( i ) ); } } } g_pMaterialSystem->ClearBuffers(true, true); int captiony = GetCaptionHeight(); int viewh = h2() - captiony; g_pMaterialSystem->Viewport( 0, captiony, w2(), viewh ); g_pMaterialSystem->MatrixMode( MATERIAL_PROJECTION ); g_pMaterialSystem->LoadIdentity( ); g_pMaterialSystem->PerspectiveX(20.0f, (float)w2() / (float)viewh, 1.0f, 20000.0f); g_pMaterialSystem->MatrixMode( MATERIAL_VIEW ); g_pMaterialSystem->LoadIdentity( ); // FIXME: why is this needed? Doesn't SetView() override this? g_pMaterialSystem->Rotate( -90, 1, 0, 0 ); // put Z going up g_pMaterialSystem->Rotate( -90, 0, 0, 1 ); ViewerSettings oldsettings = g_viewerSettings; int modelcount = modellist.Count(); int countover2 = modelcount / 2; int ydelta = g_pControlPanel->GetModelGap(); int yoffset = -countover2 * ydelta; for ( i = 0 ; i < modelcount; i++ ) { g_viewerSettings.trans[ 1 ] = oldsettings.trans[ 1 ] + yoffset; yoffset += ydelta; modellist[ i ]->GetStudioRender()->BeginFrame(); modellist[ i ]->DrawModel(); modellist[ i ]->GetStudioRender()->EndFrame(); } g_viewerSettings = oldsettings; // // draw ground // if (g_viewerSettings.showGround) { drawFloor (); } if (!m_bSuppressSwap) { g_pMaterialSystem->SwapBuffers(); } g_pMaterialSystem->EndFrame(); }
LRESULT CFrameHolder::OnNcCalcSize(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { RecalculateFrameSizes(); LRESULT lRc = 0; FrameDrawStyle fdt = gpConEmu->DrawType(); NCCALCSIZE_PARAMS* pParm = wParam ? ((NCCALCSIZE_PARAMS*)lParam) : NULL; LPRECT nccr = wParam ? pParm->rgrc : (RECT*)lParam; if (!gpSet->isTabsInCaption) { lRc = DefWindowProc(hWnd, uMsg, wParam, lParam); } else { if (!gpSet->isTabs || !gpSet->isTabsInCaption) { lRc = DefWindowProc(hWnd, uMsg, wParam, lParam); } else { RECT r[3]; r[0] = *nccr; if (wParam) { r[1] = pParm->rgrc[1]; r[2] = pParm->rgrc[2]; } if (fdt == fdt_Aero) { // В Aero (Glass) важно, чтобы клиенская область начиналась с верхнего края окна, // иначе не получится "рисовать по стеклу" nccr->top = r->top; // нада !!! nccr->left = r->left + GetFrameWidth(); nccr->right = r->right - GetFrameWidth(); nccr->bottom = r->bottom - GetFrameHeight(); } else { //TODO: Темы!!! В XP ширина/высота рамки может быть больше nccr->top = r->top + GetFrameHeight() + GetCaptionHeight(); nccr->left = r->left + GetFrameWidth(); nccr->right = r->right - GetFrameWidth(); nccr->bottom = r->bottom - GetFrameHeight(); } } // Наверное имеет смысл сбрасывать всегда, чтобы Win не пыталась // отрисовать невалидное содержимое консоли (она же размер меняет) if (wParam) { //pParm->rgrc[1] = *nccr; //pParm->rgrc[2] = r[2]; memset(pParm->rgrc+1, 0, sizeof(RECT)*2); } } return lRc; }