void CStartupView::CalculateBkgRects(Gdiplus::RectF &gdipRcLeft, Gdiplus::RectF &gdipRcMiddle, Gdiplus::RectF &gdipRcRight, Gdiplus::REAL &y, float fHeight) { CSize siTotal = GetTotalSize(); CRect rcClient(0, 0, siTotal.cx, siTotal.cy); int iLeft = 6; int iLeftOffset = 4; int iRight = 13; int iMiddle = rcClient.Width() - iLeft - iRight; gdipRcLeft.X = rcClient.left + iLeftOffset; gdipRcLeft.Y = rcClient.top + y; gdipRcLeft.Width = iLeft; gdipRcLeft.Height = fHeight; gdipRcMiddle.X = rcClient.left + iLeft + iLeftOffset; gdipRcMiddle.Y = rcClient.top + y; gdipRcMiddle.Width = iMiddle; gdipRcMiddle.Height = fHeight; gdipRcRight.X = rcClient.left + iLeft + iMiddle + iLeftOffset; gdipRcRight.Y = rcClient.top + y; gdipRcRight.Width = iRight; gdipRcRight.Height = fHeight; y += fHeight; }
BOOL CSpermView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { // TODO: Add your message handler code here and/or call default CSize sz1=GetTotalSize(); CRect rect; GetClientRect(rect); CSize sz2(rect.Width(),rect.Height()); if(sz1.cy<sz2.cy) return CScrollView::OnMouseWheel(nFlags, zDelta, pt);; SCROLLINFO si; zDelta = -zDelta; GetScrollInfo(SB_VERT,&si); si.nPos += zDelta/12; SetScrollInfo(SB_VERT,&si); CPoint sp=GetScrollPosition(); CRect rc; GetClientRect(rc); CDC* pDC=GetDC(); rc.bottom+=sp.y; rc.right+=sp.x; pDC->SetViewportOrg(-sp); DrawMemDCImage(pDC,rc); ReleaseDC(pDC); return CScrollView::OnMouseWheel(nFlags, zDelta, pt); }
trap_retval ReqWrite_io( void ) { write_io_req *acc; write_io_ret *ret; void *data; trap_elen len; acc = GetInPtr(0); data = GetInPtr( sizeof( *acc ) ); len = GetTotalSize() - sizeof( *acc ); ret = GetOutPtr(0); if( len == 1 ) { Out_b( acc->IO_offset, *( (byte __far *)data ) ); ret->len = 1; } else if( len == 2 ) { Out_w( acc->IO_offset, *( (word __far *)data ) ); ret->len = 2; } else if ( Flags.Is386 ) { Out_d( acc->IO_offset, *( (dword __far *)data ) ); ret->len = 4; } else { ret->len = 0; } return( sizeof( *ret ) ); }
BOOL CResPacker::Compile(PVOID output, UINT buff_size, PUINT pcomp_size) { std::list<_ResFrame>::iterator it = _res.begin(); DWORD offset = 0; *pcomp_size = GetTotalSize(); if (*pcomp_size > buff_size) { return false; } while (it != _res.end()) { *(UINT *)((UINT)output + offset) = it->id; offset += sizeof(UINT); *(UINT *)((UINT)output + offset) = it->size; offset += sizeof(UINT); memcpy((PVOID)((UINT)output + offset), it->pdata, it->size); offset += it->size; it++; } return true; }
void CPrime95View::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { CFrameWnd *parent; CSize sz; CPoint pos; int new_scroll_height, new_scroll_width; parent = GetParentFrame(); if (parent != NULL) { if (charHeight == 0) getCharSize (); sz = GetTotalSize (); new_scroll_height = NumLines * charHeight; new_scroll_width = MaxLineSize * charWidth; pos = GetScrollPosition (); pos.y += (new_scroll_height - sz.cy); if (pos.y < 0) pos.y = 0; sz.cx = new_scroll_width; sz.cy = new_scroll_height; SetScrollSizes (MM_TEXT, sz); ScrollToPosition (pos); parent->RecalcLayout (); } CScrollView::OnUpdate (pSender, lHint, pHint); }
trap_retval ReqWrite_mem( void ) { bool int_tbl; write_mem_req *acc; write_mem_ret *ret; trap_elen len; void *data; acc = GetInPtr(0); ret = GetOutPtr(0); data = GetInPtr(sizeof(*acc)); len = GetTotalSize() - sizeof(*acc); acc->mem_addr.offset &= 0xffff; int_tbl = IsInterrupt( acc->mem_addr, len ); if( int_tbl ) SetIntVecs(); if( ( acc->mem_addr.offset + len ) > 0xffff ) { len = 0x10000 - acc->mem_addr.offset; } MoveBytes( FP_SEG( data ), FP_OFF( data ), acc->mem_addr.segment, acc->mem_addr.offset, len ); if( int_tbl ) ClrIntVecs(); ret->len = len; return( sizeof( *ret ) ); }
unsigned ReqFile_write( void ) { DWORD bytes; BOOL rc; file_write_req *acc; file_write_ret *ret; DWORD len; void *buff; acc = GetInPtr( 0 ); buff = GetInPtr( sizeof( *acc ) ); ret = GetOutPtr( 0 ); len = GetTotalSize() - sizeof( *acc ); rc = WriteFile( ( HANDLE )acc->handle, buff, len, &bytes, NULL ); if( !rc ) { ret->err = GetLastError(); bytes = 0; } else { ret->err = 0; } ret->len = bytes; return( sizeof( *ret ) ); }
trap_retval ReqSplit_cmd( void ) { char *cmd; char *start; split_cmd_ret *ret; unsigned len; cmd = GetInPtr( sizeof( split_cmd_req ) ); ret = GetOutPtr( 0 ); ret->parm_start = 0; start = cmd; len = GetTotalSize() - sizeof( split_cmd_req ); while( len != 0 ) { switch( *cmd ) { case '\0': case ' ': case '\t': ret->parm_start = 1; len = 0; continue; } ++cmd; --len; } ret->parm_start += cmd - start; ret->cmd_end = cmd - start; CONV_LE_16( ret->cmd_end ); CONV_LE_16( ret->parm_start ); return( sizeof( *ret ) ); }
void JPartition::PTBoundsChanged() { const JSize compartmentCount = GetCompartmentCount(); JCoordinate delta = GetTotalSize() - kDragRegionSize * (compartmentCount-1); for (JIndex i=1; i<=compartmentCount; i++) { delta -= GetCompartmentSize(i); } if (delta != 0) { JArray<JCoordinate> newSizes; if (delta > 0) { FillSpace(*itsSizes, itsElasticIndex, delta, &newSizes); } else if (delta < 0) { JCoordinate trueDelta; const JBoolean ok = CreateSpace(*itsSizes, *itsMinSizes, itsElasticIndex, -delta, -delta, &newSizes, &trueDelta); assert( ok ); } *itsSizes = newSizes; SetCompartmentSizes(); } }
/****************************************************************************** Function Name : OnUpdate Input(s) : CView* pSender, LPARAM lHint, CObject* pHint Output : - Functionality : Called by the frame work to update the view. Scrolls to the position, for any changes in the view. Member of : CFileView Friend of : - Author(s) : Amarnath Shastry Date Created : 05.03.2002 ******************************************************************************/ void CFileView::OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/) { CSize omDocSize; // Set SCROLL Sizes CFunctionEditorDoc* pomDoc = omGetDocument(); // Get Character Height & Width CClientDC omDeviceContext(this); m_nCharHeight = GET_FILE_VIEW_CHAR_HEIGHT(); m_nCharWidth = GET_FILE_VIEW_CHAR_WIDTH(); if(pomDoc != nullptr) { omDocSize.cx = ((pomDoc -> nGetMaxLineLength() + 1) * m_nCharWidth); omDocSize.cy = m_nCharHeight * ((pomDoc -> dwGetLineCount() + 1) + SPACE_BET_LINE_IN_FILE_VIEW); if( GetTotalSize() != omDocSize) { SetScrollSizes(MM_TEXT, omDocSize); } } // refresh the view Invalidate(TRUE); }
void VScrollTemplate::OnHandleMouseUp(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiMouseEventArgs& arguments) { if (draggingHandle) { vint totalPixels = handle->GetParent()->GetBounds().Height(); vint currentOffset = handle->GetBounds().Top(); vint newOffset = currentOffset + (arguments.y - draggingStartLocation.y); vint totalSize = GetTotalSize(); double ratio = (double)newOffset / totalPixels; vint newPosition = (vint)(ratio * totalSize); vint offset1 = (vint)(((double)newPosition / totalSize) * totalPixels); vint offset2 = vint(((double)(newPosition + 1) / totalSize) * totalPixels); vint delta1 = abs((int)(offset1 - newOffset)); vint delta2 = abs((int)(offset2 - newOffset)); if(delta1 < delta2) { GetCommands()->SetPosition(newPosition); } else { GetCommands()->SetPosition(newPosition + 1); } } }
unsigned ReqFile_write_console( void ) { DWORD bytes; BOOL rc; file_write_console_req *acc; file_write_console_ret *ret; DWORD len; void *buff; HANDLE handle; acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); buff = GetInPtr( sizeof( *acc ) ); len = GetTotalSize() - sizeof( *acc ); handle = GetStdHandle( STD_ERROR_HANDLE ); if( DebugeePid ) { //NYI: write to program screen } else { rc = WriteFile( handle, buff, len, &bytes, NULL ); if( !rc ) { ret->err = GetLastError(); bytes = 0; } else { ret->err = 0; } ret->len = bytes; } return( sizeof( *ret ) ); }
void CResizableFormView::GetTotalClientRect(LPRECT lpRect) { GetClientRect(lpRect); // get dialog template's size // (this is set in CFormView::Create) CSize size = GetTotalSize(); // before initialization use dialog's size if (!m_bInitDone) { lpRect->right = lpRect->left + size.cx; lpRect->bottom = lpRect->top + size.cy; return; } // otherwise, give the correct size if scrollbars active if (m_nMapMode < 0) // scrollbars disabled return; // enlarge reported client area when needed CRect rect(lpRect); if (rect.Width() < size.cx) rect.right = rect.left + size.cx; if (rect.Height() < size.cy) rect.bottom = rect.top + size.cy; rect.OffsetRect(-GetScrollPosition()); *lpRect = rect; }
void ITxFormView::GetTotalClientRect(LPRECT lpRect) { GetClientRect(lpRect); // get scrollable size CSize size = GetTotalSize(); // before initialization, "size" is dialog template size if (!m_bInitDone) { lpRect->right = lpRect->left + size.cx; lpRect->bottom = lpRect->top + size.cy; return; } // otherwise, give correct size if scrollbars active if (m_nMapMode < 0) // scrollbars disabled { return; } // enlarge reported client area when needed CRect rect(lpRect); if (rect.Width() < size.cx) { lpRect->right = lpRect->left + size.cx; } if (rect.Height() < size.cy) { lpRect->bottom = lpRect->top + size.cy; } }
trap_retval ReqFile_run_cmd( void ) { file_run_cmd_ret *ret; #if defined(__WINDOWS__) ret = GetOutPtr( 0 ); ret->err = 0; #else bool chk; char buff[64]; file_run_cmd_req *acc; unsigned len; tiny_ret_t rc; acc = GetInPtr( 0 ); len = GetTotalSize() - sizeof( *acc ); ret = GetOutPtr( 0 ); chk = CheckPointMem( acc->chk_size, buff ); rc = Fork( (char *)GetInPtr( sizeof(*acc) ), len ); ret->err = TINY_ERROR( rc ) ? TINY_INFO( rc ) : 0; if( chk ) CheckPointRestore(); #endif return( sizeof( *ret ) ); }
void CStartupView::OnSize(UINT nType, int cx, int cy) { BOOL bHBar, bVBar; CheckScrollBars(bHBar, bVBar); CScrollView::OnSize(nType, cx, cy); int iNewWidth = cx < VIEW_DEFAULT_WIDTH ? VIEW_DEFAULT_WIDTH : cx; int iNewHeight = cy < VIEW_DEFAULT_HEIGHT ? VIEW_DEFAULT_HEIGHT : cy; int nVOffset = 0; int nHOffset = 0; DWORD dwStyle = AfxGetApp()->GetMainWnd()->GetStyle(); CRect rcMainWnd; AfxGetApp()->GetMainWnd()->GetWindowRect(&rcMainWnd); if((dwStyle & WS_MAXIMIZE) != 0 || m_bIsRetFromEditMode) { nVOffset = bVBar? 17: 0; nHOffset = bHBar? 17: 0; } CSize siTotal = GetTotalSize(); CRect rcClient(0, 0, siTotal.cx, siTotal.cy); if (!m_bIsRetFromEditMode || ! m_rcLastMainWndRect.EqualRect(&rcMainWnd)) { SetScrollSizes(MM_TEXT, CSize(iNewWidth + nHOffset, iNewHeight + nVOffset)); } else { SetScrollSizes(MM_TEXT, m_szLastSize); } RepositionButtons(); UpdateBars(); }
Long64_t sizeOnDisk(TBranch *branch, bool inclusive) { // Return the size on disk on this branch. // If 'inclusive' is true, include also the size // of all its sub-branches. return GetTotalSize(branch, true, inclusive); }
Long64_t GetTotalSize( TObjArray * branches, bool ondisk ) { Long64_t result = 0; size_t n = branches->GetEntries(); for( size_t i = 0; i < n; ++ i ) { result += GetTotalSize( dynamic_cast<TBranch*>( branches->At( i ) ), ondisk, true ); cerr << "After " << branches->At( i )->GetName() << " " << result << endl; } return result; }
void CStartupView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) { // TODO: Add your specialized code here and/or call the base class if (bActivate == FALSE) { m_szLastSize = GetTotalSize(); AfxGetApp()->GetMainWnd()->GetWindowRect(&m_rcLastMainWndRect); } CScrollView::OnActivateView(bActivate, pActivateView, pDeactiveView); }
void CGUIControlGroupList::ValidateOffset() { // calculate how many items we have on this page m_totalSize = GetTotalSize(); // check our m_offset range if (m_scroller.GetValue() > m_totalSize - Size()) m_scroller.SetValue(m_totalSize - Size()); if (m_scroller.GetValue() < 0) m_scroller.SetValue(0); }
void CAutoPFAView::ZoomDocSize(double scale)//按scale比率放大或缩小图形 { CSize szDoc = GetTotalSize(); m_Scale *= scale; szDoc.cx *= scale; szDoc.cy *= scale; SetScrollSizes(MM_TEXT,szDoc); Invalidate(); }
//******************************************************************************* void CBCGPChartView::AdjustLayout(int nWidth, int nHeight) { if (m_pWndChartCtrl->GetSafeHwnd () != NULL) { CSize szTotal = GetTotalSize(); nWidth = max(szTotal.cx, nWidth); nHeight = max(szTotal.cy, nHeight); int nHorzOffset = -GetScrollPos(SB_HORZ); int nVertOffset = -GetScrollPos(SB_VERT); if (m_pWndLegendCtrl->GetSafeHwnd () == NULL) { m_pWndChartCtrl->SetWindowPos (NULL, nHorzOffset, nVertOffset, nWidth, nHeight, SWP_NOZORDER | SWP_NOACTIVATE); } else { CBCGPSize szLegend = m_pWndLegendCtrl->GetLegend()->GetLegendSize(); szLegend += CSize(1, 1); switch (m_legendPosition) { case BCGPChartLayout::LP_RIGHT: case BCGPChartLayout::LP_TOPRIGHT: m_pWndChartCtrl->SetWindowPos (NULL, nHorzOffset, nVertOffset, nWidth - (int)szLegend.cx, nHeight, SWP_NOZORDER | SWP_NOACTIVATE); m_pWndLegendCtrl->SetWindowPos (NULL, nWidth - (int)szLegend.cx + nHorzOffset, nVertOffset, (int)szLegend.cx, nHeight,SWP_NOZORDER | SWP_NOACTIVATE); break; case BCGPChartLayout::LP_LEFT: m_pWndLegendCtrl->SetWindowPos (NULL, nHorzOffset, nVertOffset, (int)szLegend.cx, nHeight, SWP_NOZORDER | SWP_NOACTIVATE); m_pWndChartCtrl->SetWindowPos (NULL, (int)szLegend.cx + nHorzOffset, nVertOffset, nWidth - (int)szLegend.cx, nHeight, SWP_NOZORDER | SWP_NOACTIVATE); break; case BCGPChartLayout::LP_TOP: m_pWndLegendCtrl->SetWindowPos (NULL, nHorzOffset, nVertOffset, nWidth, (int)szLegend.cy, SWP_NOZORDER | SWP_NOACTIVATE); m_pWndChartCtrl->SetWindowPos (NULL, nHorzOffset, (int)szLegend.cy + nVertOffset, nWidth, nHeight - (int)szLegend.cy, SWP_NOZORDER | SWP_NOACTIVATE); break; case BCGPChartLayout::LP_BOTTOM: m_pWndChartCtrl->SetWindowPos (NULL, nHorzOffset, nVertOffset, nWidth, nHeight - (int)szLegend.cy, SWP_NOZORDER | SWP_NOACTIVATE); m_pWndLegendCtrl->SetWindowPos (NULL, nHorzOffset, nHeight - (int)szLegend.cy + nVertOffset, nWidth, (int)szLegend.cy, SWP_NOZORDER | SWP_NOACTIVATE); break; } } } }
trap_retval ReqProg_load( void ) /***************************/ { char *src; char *dst; char *name; char ch; prog_load_ret *ret; unsigned len; int rc; char cmdl[128]; _DBG1( "AccLoadProg\r\n" ); ret = GetOutPtr( 0 ); src = name = GetInPtr( sizeof( prog_load_req ) ); while( *src++ != '\0' ) {} len = GetTotalSize() - ( src - name ) - sizeof( prog_load_req ); if( len > 126 ) len = 126; dst = cmdl + 1; for( ; len > 0; --len ) { ch = *src++; if( ch == '\0' ) { if( len == 1 ) break; ch = ' '; } *dst++ = ch; } *dst = '\0'; *cmdl = dst - cmdl - 1; rc = DebugLoad( name, cmdl ); _DBG1( "back from debugload - %d\r\n", rc ); ret->flags = LD_FLAG_IS_BIG | LD_FLAG_IS_PROT | LD_FLAG_DISPLAY_DAMAGED | LD_FLAG_HAVE_RUNTIME_DLLS; ret->mod_handle = 0; if( rc == 0 ) { ret->err = 0; ret->task_id = DebugPSP; AddModsInfo( name, (epsp_t *)GetModuleHandle( DebugPSP ) ); } else { ret->task_id = 0; if( rc == 1 ) { ret->err = ERR_ACCESS_DENIED; } else if( rc == 2 ) { ret->err = ERR_INVALID_FORMAT; } else if( rc == 3 ) { ret->err = ERR_INSUFFICIENT_MEMORY; } else { ret->err = rc; } } _DBG1( "done AccLoadProg\r\n" ); return( sizeof( *ret ) ); }
trap_retval ReqWrite_mem( void ) { write_mem_req *acc; write_mem_ret *ret; _DBG1(( "WriteMem" )); acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); ret->len = WriteMemory( &acc->mem_addr, GetInPtr( sizeof(*acc) ), GetTotalSize() - sizeof(*acc) ); return( sizeof( *ret ) ); }
trap_retval ReqFile_write_console( void ) { tiny_ret_t rc; file_write_console_ret *ret; ret = GetOutPtr( 0 ); rc = TinyWrite( TINY_ERR, GetInPtr( sizeof( file_write_console_req ) ), ( GetTotalSize() - sizeof( file_write_console_req ) ) ); ret->len = TINY_INFO( rc ); ret->err = TINY_ERROR( rc ) ? TINY_INFO( rc ) : 0; return( sizeof( *ret ) ); }
unsigned ReqWrite_mem( void ) /***************************/ { write_mem_req *acc; write_mem_ret *ret; acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); ret->len = WriteMemory( &acc->mem_addr, GetInPtr( sizeof( *acc ) ), GetTotalSize() - sizeof( *acc ) ); return( sizeof( *ret ) ); }
void CGUIControlGroupList::ValidateOffset() { // calculate item gap. this needs to be done // before fetching the total size CalculateItemGap(); // calculate how many items we have on this page m_totalSize = GetTotalSize(); // check our m_offset range if (m_scroller.GetValue() > m_totalSize - Size()) m_scroller.SetValue(m_totalSize - Size()); if (m_scroller.GetValue() < 0) m_scroller.SetValue(0); }
void FixedMalloc::DumpMemoryInfo() { size_t inUse, ask; GetUsageInfo(ask, inUse); GCLog("[mem] FixedMalloc total %d pages inuse %d bytes ask %d bytes\n", GetTotalSize(), inUse, ask); for (int i=0; i<kNumSizeClasses; i++) { m_allocs[i].GetUsageInfo(ask, inUse); if( m_allocs[i].GetNumBlocks() > 0) GCLog("[mem] FixedMalloc[%d] total %d pages inuse %d bytes ask %d bytes\n", kSizeClasses[i], m_allocs[i].GetNumBlocks(), inUse, ask); } GCLog("[mem] FixedMalloc[large] total %d pages\n", GetNumLargeBlocks()); }
trap_retval ReqFile_write_console( void ) { file_write_console_ret *ret; ret = GetOutPtr( 0 ); ret->len = DoWrite( 2, GetInPtr( sizeof( file_write_console_req ) ), GetTotalSize() - sizeof( file_write_console_req ) ); ret->err = errno; CONV_LE_32( ret->err ); CONV_LE_16( ret->len ); return( sizeof( *ret ) ); }
trap_retval ReqFile_write( void ) { tiny_ret_t rc; file_write_req *acc; file_write_ret *ret; acc = GetInPtr( 0 ); ret = GetOutPtr( 0 ); rc = TinyWrite( TRPH2LH( acc ), GetInPtr( sizeof( *acc ) ), ( GetTotalSize() - sizeof( *acc ) ) ); ret->len = TINY_INFO( rc ); ret->err = TINY_ERROR( rc ) ? TINY_INFO( rc ) : 0; return( sizeof( *ret ) ); }