void CFrameHolder::CalculateCaptionPosition(const RECT &rcWindow, RECT* rcCaption) { //_ASSERTE(FALSE && "CFrameHolder::CalculateCaptionPosition MUST be refactored!"); FrameDrawStyle dt = gpConEmu->DrawType(); if (dt == fdt_Aero || dt == fdt_Win8) { // Почему тут не SM_CXFRAME не помню rcCaption->left = 0; //2; //GetSystemMetrics(SM_CXFRAME); rcCaption->right = (rcWindow.right - rcWindow.left); // - 4; //GetSystemMetrics(SM_CXFRAME); rcCaption->top = GetFrameHeight(); //6; //GetSystemMetrics(SM_CYFRAME); if (gpSet->isTabsInCaption) rcCaption->bottom = rcCaption->top + GetCaptionHeight()/*это наш*/; // (gpSet->isTabs ? (GetCaptionDragHeight()+GetTabsHeight()) : GetWinCaptionHeight()); //gpConEmu->GetDwmClientRectTopOffset() - 1; else rcCaption->bottom = rcCaption->top + GetCaptionHeight()/*это наш*/; // (gpSet->isTabs ? (GetCaptionDragHeight()+GetTabsHeight()) : GetWinCaptionHeight()); //gpConEmu->GetDwmClientRectTopOffset() - 1; } else if (dt == fdt_Themed) { rcCaption->left = GetFrameWidth(); rcCaption->right = (rcWindow.right - rcWindow.left) - GetFrameWidth() - 1; rcCaption->top = GetFrameHeight(); //rcCaption->bottom = rcCaption->top + GetSystemMetrics(SM_CYCAPTION) + (gSet.isTabs ? (GetSystemMetrics(SM_CYCAPTION)/2) : 0); rcCaption->bottom = rcCaption->top + GetCaptionHeight()/*это наш*/; // (gpSet->isTabs ? (GetCaptionDragHeight()+GetTabsHeight()) : GetWinCaptionHeight()); } else { rcCaption->left = GetFrameWidth(); rcCaption->right = (rcWindow.right - rcWindow.left) - GetFrameWidth() - 1; rcCaption->top = GetFrameHeight(); //rcCaption->bottom = rcCaption->top + GetSystemMetrics(SM_CYCAPTION) - 1 + (gpSet->isTabs ? (GetSystemMetrics(SM_CYCAPTION)/2) : 0); rcCaption->bottom = rcCaption->top + GetCaptionHeight()/*это наш*/; // (gpSet->isTabs ? (GetCaptionDragHeight()+GetTabsHeight()) : GetWinCaptionHeight()); } }
//////////////////////////////////////// // PUBLIC UTILITY FUNCTIONS //////////////////////////////////////// // Gets the current frame in the animation // and moves to the next one in order. RECT CAnimation::GetFrame() { SetTimeWaited(GetTimeWaited() + GAME->GetTimer().GetDeltaTime()); RECT tRect; tRect.left = GetCurrentFrame() * GetFrameWidth(); tRect.top = 0; tRect.right = tRect.left + GetFrameWidth(); tRect.bottom = tRect.top + GetFrameHeight(); if(GetTimeWaited() > GetTimePerFrame() && !GetStatic()) { SetTimeWaited(0.0f); SetCurrentFrame(GetCurrentFrame() + 1); if(GetCurrentFrame() > GetFrameCount()) { if(GetLooping()) ResetAnimation(); else { SetCurrentFrame(GetFrameCount()); SetStatic(true); } } } return tRect; }
void Table::FrameTab(int zoom, Draw& w, bool was, int x, int y, int yp, int cx) const { if(!was) return; DrawFatFrame(w, x + DocZoom(zoom, GetLm()), yp, cx - DocZoom(zoom, GetLm()) - DocZoom(zoom, GetRm()) - (zoom < 1024) * DocZoom(zoom, GetFrameWidth()), y - yp + (zoom >= 1024) * DocZoom(zoom, GetFrameWidth()), GetFrameColor(), DocZoomLn(zoom, GetFrameWidth())); }
void MpVerticalScrollbar::AdaptSlider (int shp) { // adapt to new slider height sh = MpMax(shp,2*GetFrameWidth()); // set a minimum slider height sh = MpMin(sh,Height()-2*GetFrameWidth()); // set a maximum slider height set_vars(); bar->Resize(sw,sh); SetSlider(0); }
void MpVerticalScrollbar::set_vars() { sx = sy = GetFrameWidth(); sw = Width() - 2*sx; // slider width yspan = Height() - 2*sy - sh; // is height - 2 * frame_depth - shifter_height yact = 0; }
static BOOLEAN GetFrameValidRect (PRECT pValidRect, HOT_SPOT *pOldHot) { COORD hx, hy; HOT_SPOT OldHot; OldHot = _CurFramePtr->HotSpot; hx = OldHot.x; hy = OldHot.y; pValidRect->corner.x = hx; pValidRect->corner.y = hy; pValidRect->extent.width = GetFrameWidth (_CurFramePtr); pValidRect->extent.height = GetFrameHeight (_CurFramePtr); if (_pCurContext->ClipRect.extent.width) { if (!BoxIntersect (&_pCurContext->ClipRect, pValidRect, pValidRect)) return (FALSE); hx -= _pCurContext->ClipRect.corner.x; hy -= _pCurContext->ClipRect.corner.y; pValidRect->corner.x += hx; pValidRect->corner.y += hy; _CurFramePtr->HotSpot = MAKE_HOT_SPOT (hx, hy); } *pOldHot = OldHot; return (TRUE); }
int Table::GetWidth(int zoom) const { int cx = 0; for(int i = 0; i < GetRows(); i++) { const Array<TableCell>& row = cell[i]; int x = 0; for(int j = 0; j < row.GetCount(); j++) x = max(x, row[j].GetWidth(zoom) / row[j].GetRatio()); cx = max(cx, x * GetTotalRatio(row)); } return cx + 2 * GetFrameWidth(); }
int Table::GetHeight(int zoom, int cx) const { int cy = 0; int ln = 0; cx -= DocZoomLn(zoom, GetFrameWidth()) + DocZoomLn(zoom, GetFrameWidth()) + DocZoom(zoom, GetLm()) + DocZoom(zoom, GetRm()); cy += 2 * DocZoomLn(zoom, GetFrameWidth()); while(ln < GetRows()) { Vector<Line> line; int span = 0; for(;;) { int k = ln + line.GetCount(); if(ln + line.GetCount() >= GetRows() || line.GetCount() && !KeepLine(k) && span <= 0) break; span = max((line.Add() = GetLine(zoom, k, cx, NULL)).span, span); span--; } cy += Span(line); ln += line.GetCount(); } return cy; }
void arith_frame_blit (FRAME srcFrame, const RECT *rsrc, FRAME dstFrame, const RECT *rdst, int num, int denom) { TFB_Image *srcImg, *dstImg; SDL_Surface *src, *dst; SDL_Rect srcRect, dstRect, *srp = NULL, *drp = NULL; srcImg = srcFrame->image; dstImg = dstFrame->image; LockMutex (srcImg->mutex); LockMutex (dstImg->mutex); src = (SDL_Surface *)srcImg->NormalImg; dst = (SDL_Surface *)dstImg->NormalImg; if (rdst) { dstRect.x = rdst->corner.x; dstRect.y = rdst->corner.y; dstRect.w = rdst->extent.width; dstRect.h = rdst->extent.height; drp = &dstRect; } if (rsrc) { srcRect.x = rsrc->corner.x; srcRect.y = rsrc->corner.y; srcRect.w = rsrc->extent.width; srcRect.h = rsrc->extent.height; srp = &srcRect; } else if (srcFrame->HotSpot.x || srcFrame->HotSpot.y) { if (rdst) { dstRect.x -= srcFrame->HotSpot.x; dstRect.y -= srcFrame->HotSpot.y; } else { dstRect.x = -srcFrame->HotSpot.x; dstRect.y = -srcFrame->HotSpot.y; dstRect.w = GetFrameWidth (srcFrame); dstRect.h = GetFrameHeight (srcFrame); drp = &dstRect; } } TFB_BlitSurface (src, srp, dst, drp, num, denom); UnlockMutex (srcImg->mutex); UnlockMutex (dstImg->mutex); }
void Table::RectLine(int zoom, Draw& w, int x, int y, int i, const Line& ln, Vector<ValueRect>& vr) const { const Array<TableCell>& row = cell[i]; x += DocZoom(zoom, GetLm()) + DocZoomLn(zoom, GetFrameWidth()); for(int j = 0; j < row.GetCount(); j++) { const TableCell& cell = row[j]; const Cell& cl = ln.cell[j]; Size sz = cl.size; if(cl.paint) { int h = cl.span ? cl.spanh : ln.height; cell.GetValueRects(zoom, w, x, y, sz.cx, h, sz.cy, vr); } x += sz.cx; } }
FReply SFlipbookKeyframeWidget::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { if (MouseEvent.IsMouseButtonDown(EKeys::LeftMouseButton)) { UPaperFlipbook* Flipbook = FlipbookBeingEdited.Get(); if ((Flipbook != nullptr) && Flipbook->IsValidKeyFrameIndex(FrameIndex)) { TSharedRef<FFlipbookKeyFrameDragDropOp> Operation = FFlipbookKeyFrameDragDropOp::New( GetFrameWidth().Get(), Flipbook, FrameIndex); return FReply::Handled().BeginDragDrop(Operation); } } return FReply::Unhandled(); }
bool PS3EyeCapture::Init(const int deviceNum){ //printf("PS3 Eye cameras connected: %i\n", PS3EyeDriver::GetInstance().GetNumCameras()); SetDeviceIndex(deviceNum); //The requested FPS will be changed to the next-lowest valid framerate if an invalid framerate is requested. bool success = PS3EyeDriver::GetInstance().InitCamera(deviceNum, PS3EyeDriver::RESOLUTION_SETTING::FULL_640_480, 60); if(success){ SetFrameWidth(PS3EyeDriver::GetInstance().GetHeight(deviceNum)); SetFrameHeight(PS3EyeDriver::GetInstance().GetWidth(deviceNum)); rawData = (unsigned char*)malloc(GetFrameWidth()*GetFrameHeight()*3*sizeof(unsigned char)); //cv::Mat frame(cv::Mat(cv::Size(GetFrameWidth(), GetFrameHeight()), CV_8U)); if(useThreadedUpdate) PS3EyeDriver::GetInstance().StartThreadUpdate(); } else{ //printf("Unsuccessful\n"); } return success; }
void Table::GetValueRects(int zoom, Draw& w, int x, int& y, int cx, Vector<ValueRect>& vr) const { int zfw = DocZoomLn(zoom, GetFrameWidth()); int li = 0; cx -= 2 * zfw + DocZoom(zoom, GetLm()) + DocZoom(zoom, GetRm()); y += zfw; while(li < GetRows()) { Vector<Line> line; int span = 0; for(;;) { int k = li + line.GetCount(); if(k >= GetRows() || line.GetCount() && !KeepLine(k) && span <= 0) break; span = max((line.Add() = GetLine(zoom, k, cx, NULL)).span, span); span--; } y += Span(line); RectLines(zoom, w, x, y, li, line, vr); li += line.GetCount(); } y += zfw; }
void CMLineIndexTable::AdjustToText() { const JFontManager* fontMgr = GetFontManager(); JFont font = itsText->GetCurrentFont(); const JSize lineCount = itsText->IsEmpty() ? 0 : itsText->GetLineCount(); const JString lineCountStr = GetLongestLineText(lineCount); const JSize lineHeight = font.GetLineHeight(); const JSize lineNumberWidth = font.GetStringWidth(lineCountStr); SetColWidth(kBreakpointColumn, lineHeight); SetColWidth(kExecPointColumn, lineHeight); SetColWidth(kLineNumberColumn, lineNumberWidth + 2*kMarginWidth); SetAllRowHeights(lineHeight); const JSize origRowCount = GetRowCount(); if (origRowCount < lineCount) { AppendRows(lineCount - origRowCount, lineHeight); } else if (origRowCount > lineCount) { RemovePrevRows(origRowCount, origRowCount - lineCount); } const JCoordinate tableWidth = GetBoundsWidth(); const JCoordinate apWidth = GetApertureWidth(); if (tableWidth != apWidth) { AdjustSize(tableWidth-apWidth, 0); itsText->Place(GetFrameWidth(), 0); itsText->AdjustSize(apWidth-tableWidth, 0); } ScrollTo(0, itsVScrollbar->GetValue()); UpdateBreakpoints(); }
void Table::DrawLine(int zoom, Draw& w, int x, int y, int i, const Line& ln, int ymax, Vector<int> *yl) const { const Array<TableCell>& row = cell[i]; x += DocZoom(zoom, GetLm()) + DocZoomLn(zoom, GetFrameWidth()); if(yl) yl->SetCount(row.GetCount(), 0); for(int j = 0; j < row.GetCount(); j++) { const TableCell& cell = row[j]; const Cell& cl = ln.cell[j]; Size sz = cl.size; if(cl.paint) { TableCell::PaintInfo pi; int h = cl.span ? cl.spanh : ln.height; if(yl) { pi.yl = (*yl)[j]; if(ymax - y >= 0) h = min(ymax - y, h); } cell.Paint(zoom, w, x, y, sz.cx, h, sz.cy, GetFrameColor(), pi); if(yl) (*yl)[j] = pi.yl; } x += sz.cx; } }
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; }
bool Table::Paint(int zoom, Draw& w, int x, int y, int cx, int ymax, PaintInfo& pi) const { int j; Vector<Line> header; int zfw = DocZoomLn(zoom, GetFrameWidth()); int tcx = cx - 2 * zfw - DocZoom(zoom, GetLm()) - DocZoom(zoom, GetRm()); bool breakpage = pi.line != pi.oline; int pgcy = ymax - y; pi.oline = pi.line; if(pi.line) { int m = min(GetHeaderRows(), cell.GetCount()); for(j = 0; j < m; j++) header.Add() = GetLine(zoom, j, tcx, NULL); } int hdrcy = Span(header); if(hdrcy > ymax - y) { header.Clear(); hdrcy = 0; } int hg = hdrcy; int yp = y; y += zfw; bool was = false; if(y >= ymax) { pi.ypos = y; return true; } while(pi.line < GetRows() && y < ymax) { Vector<Line> line; Vector<int> *yl = &pi.yl; int span = 0; bool nospan = true; for(;;) { int k = pi.line + line.GetCount(); if(k >= GetRows() || line.GetCount() && !KeepLine(k) && span <= 0) break; span = max((line.Add() = GetLine(zoom, k, tcx, yl)).span, span); if(span) nospan = false; yl = NULL; span--; } hg += Span(line); int lhg = line.Top().height; if(hg + y + zfw > ymax) { if((!breakpage || lhg > style.breakcy && ymax - (y + hg - lhg) - zfw > style.breakpgcy) && nospan && line.GetCount() && hg + y + zfw - lhg <= ymax) { int yy = y + hdrcy; PaintLines(zoom, w, x, yy, 0, header, 0); yy = y + hdrcy; int i; for(i = 0; i < line.GetCount() - 1; i++) { DrawLine(zoom, w, x, yy, pi.line++, line[i], ymax, NULL); yy += line[i].height; } DrawLine(zoom, w, x, yy, pi.line, line[i], ymax, &pi.yl); breakpage = was = true; y = ymax; } if(breakpage) { FrameTab(zoom, w, was, x, y, yp, cx); pi.ypos = y; return true; } } y += hg; int yy = y; PaintLines(zoom, w, x, yy, pi.line, line, &pi.yl); PaintLines(zoom, w, x, yy, 0, header, 0); pi.yl.Clear(); header.Clear(); hg = 0; breakpage = was = true; pi.line += line.GetCount(); } FrameTab(zoom, w, was, x, y, yp, cx); pi.ypos = y + zfw; return false; }